From 0167332b3db8fe910ab0165a2cfe9927dc7facb2 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:31:42 +0200 Subject: [PATCH 01/53] [cleanup] accept HR_METADATA --- lib_com/ivas_cnst.h | 8 -- lib_com/ivas_masa_com.c | 4 - lib_com/ivas_prot.h | 6 -- lib_com/ivas_rom_com.c | 6 -- lib_com/ivas_rom_com.h | 2 - lib_com/ivas_stat_com.h | 2 - lib_com/options.h | 3 - lib_dec/ivas_masa_dec.c | 181 ---------------------------------- lib_dec/ivas_qmetadata_dec.c | 95 ------------------ lib_enc/ivas_masa_enc.c | 22 ----- lib_enc/ivas_qmetadata_enc.c | 71 ------------- lib_enc/ivas_qspherical_enc.c | 6 -- lib_util/masa_file_reader.c | 157 ----------------------------- 13 files changed, 563 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 9557f7aef1..f59ac2f000 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1186,9 +1186,7 @@ enum #define MASA_DIRECTION_MAX_BITS 11 #define MASA_NO_INDEX 32767 #define MASA_BITS_ER 3 -#ifdef HR_METADATA #define MASA_BITS_ER_HR 4 -#endif #define MASA_MIN_BITS_TF 4 #define MASA_LIMIT_2D 2 #define MASA_NO_CV_COH 8 @@ -1208,10 +1206,8 @@ enum #define QMETADATA_MAX_NO_DIRECTIONS 2 #define MASA_MAX_BITS 1300 /* max. bit-budget for MASA metadata */ -#ifdef HR_METADATA #define MASA_MAX_BITS_HR 2000 /* max. bit-budget for MASA metadata in HR mode*/ #define HR_MASA_ER_LEVELS 16 -#endif #ifdef FIX_HBR_MASAMETA #define MAX_REDUCED_NBANDS 18 /* max number of subbands that is less than the default value 24 */ #endif @@ -1246,12 +1242,8 @@ enum #define MASA_STEREO_MIN_BITRATE IVAS_24k4 #define MASA_BIT_REDUCT_PARAM 10 -#ifdef HR_METADATA #define MASA_MAXIMUM_TWO_DIR_BANDS 24 #define NBITS_HR_COH 4 -#else -#define MASA_MAXIMUM_TWO_DIR_BANDS 18 -#endif typedef enum { MASA_STEREO_NOT_DEFINED, diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 22caa5d2cf..820d505e47 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -53,7 +53,6 @@ #define MASA_SMALL_INC_META_BITS 10 -#ifdef HR_METADATA /*--------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------*/ @@ -62,7 +61,6 @@ static int16_t quantize_theta_masa( float x, const int16_t no_cb, float *xhat ); static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *phi_hat, const int16_t n ); -#endif /*--------------------------------------------------------------- @@ -454,7 +452,6 @@ void masa_sample_rate_band_correction( } -#ifdef HR_METADATA /*------------------------------------------------------------------------- * index_theta_phi_16() * @@ -803,4 +800,3 @@ void deindex_sph_idx( return; } -#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2a040f2d57..211b3f3326 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3109,7 +3109,6 @@ ivas_error ivas_qmetadata_enc_encode( const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); -#ifdef HR_METADATA ivas_error ivas_qmetadata_enc_encode_hr_384_512( BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ @@ -3130,7 +3129,6 @@ uint16_t index_theta_phi_16( float * p_phi, /* i/o: input azimuth to be indexed */ const SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ ); -#endif void reset_metadata_spatial( const IVAS_FORMAT ivas_format, /* i : IVAS format */ @@ -3166,7 +3164,6 @@ int16_t ivas_qmetadata_dec_decode( const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); -#ifdef HR_METADATA /*! r: number of bits read */ int16_t ivas_qmetadata_dec_decode_hr_384_512( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ @@ -3180,7 +3177,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( uint8_t ncoding_bands_config #endif ); -#endif /*! r: number of bits read */ int16_t ivas_qmetadata_dec_sid_decode( @@ -3266,10 +3262,8 @@ void quantize_direction_frame( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ); /*! r: quantized spherical index */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 9f67c602f6..8f32d0067f 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2538,7 +2538,6 @@ const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_ /*----------------------------------------------------------------------------------* * MASA ROM tables *----------------------------------------------------------------------------------*/ -#ifdef HR_METADATA const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS] = { @@ -2579,7 +2578,6 @@ const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1] = 0.8673095703125f, 2.0f /* out-of-range large value to make searching easier */ }; -#endif const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS] = { 11, @@ -2775,11 +2773,7 @@ const uint8_t masa_joined_nbands[IVAS_NUM_ACTIVE_BRATES] = const uint8_t masa_twodir_bands[IVAS_NUM_ACTIVE_BRATES] = { -#ifdef HR_METADATA 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 24 -#else - 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 12 -#endif }; const uint8_t masa_twodir_bands_joined[IVAS_NUM_ACTIVE_BRATES] = diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index a6437565c9..ed3ffa6c08 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -298,10 +298,8 @@ extern const uint8_t masa_joined_nbands[]; extern const uint8_t masa_twodir_bands[]; extern const uint8_t masa_twodir_bands_joined[]; -#ifdef HR_METADATA extern const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS]; extern const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1]; -#endif /* Multi-channel input and output setups */ extern const float ls_azimuth_CICP2[2]; diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index cc0fbf89b3..c4be5a6c63 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -432,9 +432,7 @@ typedef struct ivas_masa_directional_spatial_meta_struct float elevation[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float spread_coherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#ifdef HR_METADATA uint16_t spherical_index[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#endif } MASA_DIRECTIONAL_SPATIAL_META; diff --git a/lib_com/options.h b/lib_com/options.h index 3a1e1b24c1..9c1c6ff625 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -147,7 +147,6 @@ #define UPDATE_SBA_FILTER /* Dolby (Orange, FhG) : Contribution 36 - SBA HRIR update */ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define HR_METADATA /* Nok: Contribution #45: encode directional MASA metadata with more bits at 384k and 512k */ #define SBA_TD_RESIDUAL /* Dlb : Issue 426: SBA encoder complexity optimization */ @@ -218,9 +217,7 @@ #define SBA_MODE_CLEAN_UP /* Dlb: Cean up SBA mode references */ #define FIX_502_IND_LIST_SIZE /* Fix issue #502: insufficient index buffer sizes */ -#ifdef HR_METADATA #define FIX_505_MASA_SPHGRID_REUSE /* Nokia: Fix issue #505: MASA spherical grid reuse fix */ -#endif #define FIX_481_UNUSED_VARIABLES /* Nokia: Fix issue #481: Unused debug variables */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 8d6cebe036..d284d3f7d9 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -55,11 +55,6 @@ /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ -#ifndef HR_METADATA -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 ); -#endif static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ); @@ -196,7 +191,6 @@ ivas_error ivas_masa_decode( /* Remove already read bits from the bit budget */ hQMetaData->metadata_max_bits -= *nb_bits_read; -#ifdef HR_METADATA if ( ivas_total_brate >= IVAS_384k ) { if ( ivas_total_brate >= IVAS_512k ) @@ -220,12 +214,9 @@ ivas_error ivas_masa_decode( } else { -#endif *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos, 0 ); -#ifdef HR_METADATA } -#endif /* Get direction decoding quality. EC 1 and 2 are handled by the default value. */ if ( hQMetaData->ec_flag == 2 ) @@ -529,7 +520,6 @@ static ivas_error ivas_masa_dec_config( ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); -#ifdef HR_METADATA if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k ) { hMasa->config.mergeRatiosOverSubframes = 0; @@ -540,7 +530,6 @@ static ivas_error ivas_masa_dec_config( generate_gridEq( hMasa->data.sph_grid16 ); } } -#endif st_ivas->hQMetaData->metadata_max_bits = hMasa->config.max_metadata_bits; st_ivas->hQMetaData->bandMap = hMasa->data.band_mapping; st_ivas->hQMetaData->nchan_transport = st_ivas->nchan_transport; @@ -643,176 +632,6 @@ void ivas_masa_prerender( /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ -#ifndef HR_METADATA -/* !r: index of quantized value */ -static int16_t quantize_theta( - float x, /* i : theta value to be quantized */ - int16_t no_cb, /* i : number of codewords */ - float *xhat /* o : quantized value */ -) -{ - int16_t imin; - float diff1, diff2; - - imin = (int16_t) ( x * MASA_INV_ANGLE_AT_EQUATOR_DEG + 0.5f ); - - if ( imin >= no_cb - 1 ) - { - imin = no_cb - 1; - diff1 = x - 90; - diff2 = x - MASA_ANGLE_AT_EQUATOR_DEG * ( imin - 1 ); - if ( fabsf( diff1 ) > fabsf( diff2 ) ) - { - imin--; - *xhat = imin * MASA_ANGLE_AT_EQUATOR_DEG; - } - else - { - *xhat = 90; - } - } - else - { - *xhat = imin * MASA_ANGLE_AT_EQUATOR_DEG; - } - - return imin; -} - - -/* !r: index azimuth */ -static int16_t quantize_phi_masa( - float phi, /* i : azimuth value */ - int16_t flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ - float *phi_hat, /* o : quantized azimuth */ - const int16_t n /* i : azimuth codebook size */ -) -{ - int16_t id_phi; - float dd; - float delta_phi; - - delta_phi = 360.0f / (float) n; - - if ( n == 1 ) - { - *phi_hat = 0; - - return 0; - } - - if ( flag_delta == 1 ) - { - dd = delta_phi / 2.0f; - } - else - { - dd = 0; - } - - id_phi = (int16_t) ( ( phi - dd + delta_phi / 2.0f ) / (float) delta_phi ); - - if ( id_phi == n ) - { - id_phi = 0; - } - - if ( id_phi == -1 ) - { - id_phi = n - 1; - } - - *phi_hat = id_phi * delta_phi + dd; - - return id_phi; -} - - -/* !r: output index for direction */ -static uint16_t index_theta_phi_16( - float theta, /* i : input elevation to be indexed */ - float phi, /* i : input azimuth to be indexed */ - SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ -) -{ - float abs_theta; - int16_t sign_th, id_phi, id_th; - uint16_t idx_sph; - uint16_t cum_n; - float theta_hat, phi_hat; /* Can be removed */ - - phi = phi + 180; - - if ( theta < 0 ) - { - abs_theta = -theta; - sign_th = -1; - } - else - { - abs_theta = theta; - sign_th = 1; - } - - id_th = quantize_theta( abs_theta, gridData->no_theta, &theta_hat ); - if ( gridData->no_theta > 1 ) - { - if ( gridData->no_phi[id_th] > 1 ) - { - id_phi = quantize_phi_masa( phi, ( id_th % 2 == 1 ), &phi_hat, gridData->no_phi[id_th] ); - } - else - { - id_phi = 0; - phi_hat = 180; - } - } - else - { - id_phi = quantize_phi_masa( phi, ( id_th % 2 == 1 ), &phi_hat, gridData->no_phi[id_th] ); - } - - /* Starting from Equator, alternating positive and negative */ - if ( id_th == 0 ) - { - idx_sph = id_phi; - } - else - { - if ( id_th == gridData->no_theta - 1 ) - { - idx_sph = 65534 + ( sign_th < 0 ); - } - else - { - theta = MASA_ANGLE_AT_EQUATOR * (float) ( id_th + 0.5f ); - if ( id_th == 1 ) - { - cum_n = 2 * (uint16_t) ceilf( MASA_NTOT2_FAC * ( sinf( theta ) - MASA_ASIN_OFFSET ) ); - } - else - { - cum_n = 2 * (uint16_t) roundf( MASA_NTOT2_FAC * ( sinf( theta ) - MASA_ASIN_OFFSET ) ); - } - - cum_n += gridData->no_phi[0]; - - if ( sign_th > 0 ) - { - cum_n -= 2 * gridData->no_phi[id_th]; - } - else - { - cum_n -= gridData->no_phi[id_th]; - } - idx_sph = cum_n + id_phi; - } - } - - - return idx_sph; -} -#endif static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index cfd748afde..eabe725035 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -50,17 +50,13 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness( uint16_t *bitstream, i static int16_t ivas_qmetadata_entropy_decode_df_ratio( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction, int16_t *dfRatio_bits ); static int16_t ivas_qmetadata_entropy_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band -#ifdef HR_METADATA , const int16_t hrmasa_flag -#endif ); static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const int16_t nbands, const int16_t start_band -#ifdef HR_METADATA , const int16_t hrmasa_flag -#endif ); static uint16_t ivas_qmetadata_DecodeQuasiUniform( const uint16_t *bitstream, int16_t *index, const uint16_t alphabet_size ); @@ -88,19 +84,15 @@ static int16_t read_truncGR_azimuth( uint16_t *bitstream, IVAS_QDIRECTION *q_dir static ivas_error read_huf( int16_t *num_bits_read, const uint16_t *bitstream, uint16_t *out, const int16_t start_pos, const int16_t len, const int16_t *huff_code, const int16_t max_len ); static int16_t read_coherence_data( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir -#ifdef HR_METADATA , const int16_t hrmasa_flag -#endif ); static int16_t read_surround_coherence( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData ); static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, int16_t idx_d, const int16_t no_frames -#ifdef HR_METADATA , const int16_t hrmasa_flag -#endif ); static void decode_combined_index( uint64_t comb_index, const int16_t *no_cv_vec, uint16_t *index, const int16_t len ); @@ -111,7 +103,6 @@ static int16_t read_GR_min_removed_data( uint16_t *bitstream, int16_t *p_bit_pos static int16_t decode_fixed_rate_composed_index_coherence( uint16_t *bitstream, int16_t *p_bit_pos, const int16_t no_bands, int16_t *no_cv_vec, uint16_t *decoded_index, const int16_t no_symb ); -#ifdef HR_METADATA static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr_512( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction ); @@ -121,7 +112,6 @@ static int16_t ivas_qmetadata_raw_decode_dir_512( IVAS_QDIRECTION *q_direction, static int16_t read_surround_coherence_hr( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData ); static int16_t read_coherence_data_hr_512( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir, const int16_t nbits_coh ); -#endif /*-----------------------------------------------------------------------* @@ -463,10 +453,8 @@ int16_t ivas_qmetadata_dec_decode( if ( all_coherence_zero == 0 ) { bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d -#ifdef HR_METADATA , 0 -#endif ); } else @@ -516,19 +504,15 @@ int16_t ivas_qmetadata_dec_decode( if ( raw_flag[0] == 0 ) { bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band -#ifdef HR_METADATA , 0 -#endif ); } else { bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band -#ifdef HR_METADATA , 0 -#endif ); } } @@ -550,10 +534,8 @@ int16_t ivas_qmetadata_dec_decode( if ( raw_flag[b] == 0 ) { bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b -#ifdef HR_METADATA , 0 -#endif ); } else @@ -599,10 +581,8 @@ int16_t ivas_qmetadata_dec_decode( if ( raw_flag[b] ) { bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b -#ifdef HR_METADATA , 0 -#endif ); } } @@ -638,10 +618,8 @@ int16_t ivas_qmetadata_dec_decode( if ( nblocks > 1 ) { decode_spread_coherence( hQMetaData, d, nblocks -#ifdef HR_METADATA , 0 -#endif ); } } @@ -783,7 +761,6 @@ int16_t ivas_qmetadata_dec_decode( } -#ifdef HR_METADATA /*-----------------------------------------------------------------------* * ivas_qmetadata_dec_decode_hr_384_512() * @@ -1248,7 +1225,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( return ( start_index_0 - *index ); } -#endif /*-----------------------------------------------------------------------* @@ -1637,7 +1613,6 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * ivas_qmetadata_entropy_decode_diffuseness_hr() * @@ -1764,7 +1739,6 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr_512( return ( index_start - *index ); } -#endif /*-------------------------------------------------------------------* @@ -1899,10 +1873,8 @@ static int16_t ivas_qmetadata_entropy_decode_dir( const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t b, m; @@ -1930,18 +1902,14 @@ static int16_t ivas_qmetadata_entropy_decode_dir( /*Raw coding for high diffuseness*/ for ( b = start_band; b < nbands; b++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif diff_idx_min = min( diff_idx_min, diff_idx ); if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) @@ -1953,11 +1921,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir( elev_alph[b] = no_theta_masa[bits_direction_masa[diff_idx] - 3] * 2 - 1; } -#ifdef HR_METADATA if ( q_direction->band_data[b].energy_ratio_index_mod[0] > diffuseness_index_max_ec_frame ) -#else - if ( diff_idx > diffuseness_index_max_ec_frame ) -#endif { bands_entropic[b] = 0; @@ -2010,18 +1974,14 @@ static int16_t ivas_qmetadata_entropy_decode_dir( if ( bands_entropic[b] ) { int16_t tmp_index; -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { @@ -2071,18 +2031,14 @@ static int16_t ivas_qmetadata_entropy_decode_dir( { if ( bands_entropic[b] ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif for ( m = 0; m < nblocks; m++ ) { @@ -2141,18 +2097,14 @@ static int16_t ivas_qmetadata_entropy_decode_dir( { if ( bands_entropic[b] ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif for ( m = 0; m < nblocks; m++ ) { @@ -2273,7 +2225,6 @@ static int16_t ivas_qmetadata_entropy_decode_dir( } -#ifdef HR_METADATA /*------------------------------------------------------------------------- * ivas_qmetadata_raw_decode_dir() * @@ -2324,7 +2275,6 @@ static int16_t ivas_qmetadata_raw_decode_dir_512( return ( index_start - *index ); } -#endif /*------------------------------------------------------------------------- * ivas_qmetadata_raw_decode_dir() @@ -2338,10 +2288,8 @@ static int16_t ivas_qmetadata_raw_decode_dir( int16_t *index, const int16_t nbands, const int16_t start_band -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t b, m, azith_alph; @@ -2360,18 +2308,14 @@ static int16_t ivas_qmetadata_raw_decode_dir( } else { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif for ( m = 0; m < nblocks; m++ ) { @@ -3413,10 +3357,8 @@ static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: quantized metadata structure */ int16_t idx_d, /* i : direction index */ const int16_t no_frames /* i : number of time subframes */ -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t i, j; @@ -3426,9 +3368,7 @@ static void decode_spread_coherence( int16_t MASA_grouping[MASA_MAXIMUM_CODING_SUBBANDS]; IVAS_QDIRECTION *q_direction; int16_t coding_subbands, coding_subbands_0, d, two_dir_band[MASA_MAXIMUM_CODING_SUBBANDS]; -#ifdef HR_METADATA int16_t min_index; -#endif coding_subbands_0 = hQMetaData->q_direction[0].cfg.nbands; coding_subbands = hQMetaData->q_direction[idx_d].cfg.nbands; @@ -3485,7 +3425,6 @@ static void decode_spread_coherence( { var_azi = var( q_direction->band_data[i].azimuth, no_frames ); -#ifdef HR_METADATA if ( hrmasa_flag ) { minimum_s( (int16_t *) ( q_direction->band_data[i].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); @@ -3504,16 +3443,6 @@ static void decode_spread_coherence( { idx_sub_cb = MASA_NO_CV_COH * ( min_index + DIRAC_DIFFUSE_LEVELS ); /* NO_CV_COH = 8 */ } -#else - if ( var_azi < MASA_DELTA_AZI_DCT0 ) - { - idx_sub_cb = MASA_NO_CV_COH * q_direction->band_data[i].energy_ratio_index[0]; - } - else - { - idx_sub_cb = MASA_NO_CV_COH * ( q_direction->band_data[i].energy_ratio_index[0] + DIRAC_DIFFUSE_LEVELS ); /* NO_CV_COH = 8 */ - } -#endif dct_coh[i][0] = coherence_cb0_masa[idx_sub_cb + q_direction->coherence_band_data[i].spread_coherence_dct0_index]; @@ -3774,7 +3703,6 @@ static int16_t decode_fixed_rate_composed_index_coherence( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * read_coherence_data_hr_512() * @@ -3852,7 +3780,6 @@ static int16_t read_coherence_data_hr_512( nbits = nbits - *p_bit_pos; return nbits; } -#endif /*------------------------------------------------------------------- * @@ -3867,10 +3794,8 @@ static int16_t read_coherence_data( int16_t *p_bit_pos, /* i : position in the bitstream */ IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata structure */ const int16_t idx_dir /* i : direction index */ -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t j; @@ -3888,9 +3813,7 @@ static int16_t read_coherence_data( int16_t decoded_idx[MASA_MAXIMUM_CODING_SUBBANDS]; uint16_t byteBuffer; int16_t idx_ER; -#ifdef HR_METADATA int16_t min_index; -#endif coding_subbands = hQMetaData->q_direction[idx_dir].cfg.nbands; @@ -3902,7 +3825,6 @@ static int16_t read_coherence_data( { for ( j = 0; j < coding_subbands; j++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + coding_subbands / MASA_FACTOR_CV_COH; @@ -3910,11 +3832,8 @@ static int16_t read_coherence_data( else { -#endif idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH; -#ifdef HR_METADATA } -#endif no_cv_vec[j] = idx_ER + 1; } @@ -3938,11 +3857,7 @@ static int16_t read_coherence_data( { if ( no_cv_vec[j] > 1 ) { -#ifdef HR_METADATA q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_idx[j] * ( 255.0f / (float) ( 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> ( hrmasa_flag ) ) + coding_subbands / MASA_FACTOR_CV_COH ) ) ); -#else - q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_idx[j] * ( 255.0f / (float) ( 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH ) ) ); -#endif } else { @@ -3959,11 +3874,7 @@ static int16_t read_coherence_data( { if ( no_cv_vec[j] > 1 ) { -#ifdef HR_METADATA q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_index[j] * ( 255.0f / (float) ( 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> ( hrmasa_flag ) ) + coding_subbands / MASA_FACTOR_CV_COH ) ) ); -#else - q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_index[j] * ( 255.0f / (float) ( 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH ) ) ); -#endif } else { @@ -3976,7 +3887,6 @@ static int16_t read_coherence_data( { for ( j = 0; j < coding_subbands; j++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); @@ -3984,11 +3894,8 @@ static int16_t read_coherence_data( } else { -#endif no_cv_vec[j] = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; /* spread coherence DCT0*/ -#ifdef HR_METADATA } -#endif } if ( sum_s( no_cv_vec, coding_subbands ) > MASA_COH_LIMIT_2IDX ) @@ -4274,7 +4181,6 @@ static int16_t read_surround_coherence( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * read_surround_coherence_hr() * @@ -4434,7 +4340,6 @@ static int16_t read_surround_coherence_hr( return bits_sur_coherence; } -#endif /*-------------------------------------------------------------------* * decode_combined_index() diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 707e1b3397..17a9b68074 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -62,14 +62,12 @@ 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 ); static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] -#ifdef HR_METADATA , const SPHERICAL_GRID_DATA *sphGrid #ifdef FIX_505_MASA_SPHGRID_REUSE , const uint8_t useSphGrid #endif -#endif ); static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); @@ -250,19 +248,15 @@ ivas_error ivas_masa_encode( mvr2r( hMasa->masaMetadata.directional_meta[i].azimuth[j], h_orig_metadata[i].azimuth[j], MASA_FREQUENCY_BANDS ); mvr2r( hMasa->masaMetadata.directional_meta[i].elevation[j], h_orig_metadata[i].elevation[j], MASA_FREQUENCY_BANDS ); mvr2r( hMasa->masaMetadata.directional_meta[i].energy_ratio[j], h_orig_metadata[i].energy_ratio[j], MASA_FREQUENCY_BANDS ); -#ifdef HR_METADATA mvs2s( (int16_t *) ( hMasa->masaMetadata.directional_meta[i].spherical_index[j] ), (int16_t *) ( h_orig_metadata[i].spherical_index[j] ), MASA_FREQUENCY_BANDS ); -#endif } } } -#ifdef HR_METADATA if ( ivas_format == MASA_FORMAT && ivas_total_brate >= IVAS_384k ) { hMasa->config.mergeRatiosOverSubframes = 0; } -#endif /* Combine frequency bands and sub-frames */ combine_freqbands_and_subframes( hMasa ); @@ -327,7 +321,6 @@ ivas_error ivas_masa_encode( } /* Encode metadata */ -#ifdef HR_METADATA if ( ivas_total_brate >= IVAS_384k ) { if ( ivas_total_brate >= IVAS_512k ) @@ -341,12 +334,9 @@ ivas_error ivas_masa_encode( } else { -#endif ivas_qmetadata_enc_encode( hMetaData, hQMetaData, 0 ); -#ifdef HR_METADATA } -#endif *nb_bits_metadata = hMetaData->nb_bits_tot; @@ -512,10 +502,8 @@ ivas_error ivas_masa_enc_config( int16_t maxBin, sf; #endif ivas_error error; -#ifdef HR_METADATA #ifndef FIX_505_MASA_SPHGRID_REUSE SPHERICAL_GRID_DATA *sphGrid; -#endif #endif error = IVAS_ERR_OK; @@ -537,7 +525,6 @@ ivas_error ivas_masa_enc_config( if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) { -#ifdef HR_METADATA #ifndef FIX_505_MASA_SPHGRID_REUSE if ( ( sphGrid = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) { @@ -552,19 +539,16 @@ ivas_error ivas_masa_enc_config( { sphGrid->no_theta = 0; } -#endif #endif /* average over sub-frames */ average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy -#ifdef HR_METADATA , #ifdef FIX_505_MASA_SPHGRID_REUSE &( hMasa->data.Sph_Grid16 ), ivas_total_brate == IVAS_512k ? TRUE : FALSE #else sphGrid -#endif #endif ); } @@ -1149,9 +1133,7 @@ static void move_metadata_to_qmetadata( hQMeta->q_direction[dir].band_data[band].azimuth[sf] = hMeta->directional_meta[dir].azimuth[sf][band]; hQMeta->q_direction[dir].band_data[band].elevation[sf] = hMeta->directional_meta[dir].elevation[sf][band]; hQMeta->q_direction[dir].band_data[band].energy_ratio[sf] = hMeta->directional_meta[dir].energy_ratio[sf][band]; -#ifdef HR_METADATA hQMeta->q_direction[dir].band_data[band].spherical_index[sf] = hMeta->directional_meta[dir].spherical_index[sf][band]; -#endif if ( hQMeta->q_direction[dir].coherence_band_data != NULL ) { hQMeta->q_direction[dir].coherence_band_data[band].spread_coherence[sf] = (uint8_t) roundf( hMeta->directional_meta[dir].spread_coherence[sf][band] * UINT8_MAX ); @@ -1840,14 +1822,12 @@ void ivas_masa_enc_reconfigure( static void average_masa_metadata( MASA_METADATA_FRAME *hMeta, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] -#ifdef HR_METADATA , const SPHERICAL_GRID_DATA *Sph_Grid16 #ifdef FIX_505_MASA_SPHGRID_REUSE , const uint8_t useSphGrid #endif -#endif ) { int16_t i, j, k; @@ -1895,7 +1875,6 @@ static void average_masa_metadata( j = 0; hMeta->directional_meta[i].azimuth[j][k] = atan2f( y_sum, x_sum ) / EVS_PI * 180.0f; hMeta->directional_meta[i].elevation[j][k] = atan2f( z_sum, sqrtf( x_sum * x_sum + y_sum * y_sum ) ) / EVS_PI * 180.0f; -#ifdef HR_METADATA #ifdef FIX_505_MASA_SPHGRID_REUSE if ( useSphGrid == TRUE ) #else @@ -1905,7 +1884,6 @@ static void average_masa_metadata( hMeta->directional_meta[i].spherical_index[j][k] = index_theta_phi_16( &( hMeta->directional_meta[i].elevation[j][k] ), &( hMeta->directional_meta[i].azimuth[j][k] ), Sph_Grid16 ); } -#endif vec_len = sqrtf( x_sum * x_sum + y_sum * y_sum + z_sum * z_sum ); hMeta->directional_meta[i].energy_ratio[j][k] = vec_len / ( energy_sum + EPSILON ); diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 213c0ce756..bae7edc5fd 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -61,10 +61,8 @@ static void ivas_qmetadata_reorder_2dir_bands( IVAS_QMETADATA_HANDLE hQMetaData static int16_t ivas_qmetadata_entropy_encode_df_ratio( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, int16_t *df_ratio_bits ); static int16_t ivas_qmetadata_entropy_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, int16_t max_bits -#ifdef HR_METADATA , const int16_t hrmasa_flag -#endif ); static int16_t ivas_qmetadata_raw_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t nbands, const int16_t start_band ); @@ -94,19 +92,15 @@ static ivas_error write_ec_direction( int16_t *num_bits_written, BSTR_ENC_HANDLE static int16_t write_fixed_rate_direction( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t j_idx, const int16_t len ); static int16_t ivas_qmetadata_quantize_coherence( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t write_flag, int16_t *indice_coherence -#ifdef HR_METADATA , const int16_t hrmasa_flag -#endif ); static void dct4_transform( uint8_t *v, float *dct_v ); static float quantize_DCT_0_coh( const float x, const int16_t j, const float *coherence_cb, const float delta_var, const int16_t no_cb, IVAS_QDIRECTION *q_direction, uint16_t *idx_x, int16_t *p_no_cb -#ifdef HR_METADATA , const int16_t hrmasa_flag -#endif ); static int16_t encode_coherence_indexesDCT0( uint16_t *idx_dct, const int16_t len, int16_t *no_cb_vec, BSTR_ENC_HANDLE hMetaData, const int16_t indice_coherence, const int16_t nbits, const int16_t nbits1 ); @@ -133,7 +127,6 @@ static void transform_azimuth_dir2( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *d static int16_t calc_var_azi( const IVAS_QDIRECTION *q_direction, const int16_t diffuseness_index_max_ec_frame, const float avg_azimuth, float *avg_azimuth_out ); -#ifdef HR_METADATA static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, int16_t *dfRatioBits, const int16_t bits_dir_hr ); static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); @@ -145,7 +138,6 @@ static int16_t encode_surround_coherence_hr( IVAS_QMETADATA *hQMetaData, BSTR_EN static void ivas_qmetadata_reorder_2dir_bands_hr( IVAS_QMETADATA_HANDLE hQMetaData ); static int16_t ivas_qmetadata_quantize_coherence_hr_512( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t bits_coh ); -#endif /*-----------------------------------------------------------------------* @@ -424,10 +416,8 @@ ivas_error ivas_qmetadata_enc_encode( if ( all_coherence_zero == 0 ) { bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence -#ifdef HR_METADATA , 0 -#endif ); } @@ -441,10 +431,8 @@ ivas_error ivas_qmetadata_enc_encode( { /* Quantize directions*/ quantize_direction_frame( q_direction, azimuth_orig, elevation_orig -#ifdef HR_METADATA , 0 -#endif ); } @@ -480,10 +468,8 @@ ivas_error ivas_qmetadata_enc_encode( reduce_bits = hQMetaData->is_masa_ivas_format ? ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) - 1 ) : MASA_MAX_BITS; bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits -#ifdef HR_METADATA , 0 -#endif ); if ( bits_ec < 0 ) @@ -539,10 +525,8 @@ ivas_error ivas_qmetadata_enc_encode( /* Write ec bits */ bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS -#ifdef HR_METADATA , 0 -#endif ); if ( bits_ec >= 0 ) @@ -647,10 +631,8 @@ ivas_error ivas_qmetadata_enc_encode( bit_pos_start = hMetaData->nb_bits_tot; hMetaData->nb_bits_tot = bit_pos_start_coh; ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence -#ifdef HR_METADATA , 0 -#endif ); hMetaData->nb_bits_tot = bit_pos_start; } @@ -740,7 +722,6 @@ ivas_error ivas_qmetadata_enc_encode( } -#ifdef HR_METADATA /*-----------------------------------------------------------------------* * ivas_qmetadata_enc_encode_hr_384_512() * @@ -1015,7 +996,6 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( #endif return error; } -#endif /*-----------------------------------------------------------------------* @@ -1472,7 +1452,6 @@ int16_t quantize_direction2D( } -#ifdef HR_METADATA /*------------------------------------------------------------------------- * ivas_qmetadata_quantize_diffuseness_nrg_ratios() * @@ -1765,7 +1744,6 @@ static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( return ( hMetaData->nb_bits_tot - start_bit_pos ); } -#endif /*------------------------------------------------------------------------- * ivas_qmetadata_quantize_diffuseness_nrg_ratios() @@ -2583,10 +2561,8 @@ static int16_t ivas_qmetadata_entropy_encode_dir( const int16_t start_band, const int16_t direction_bits_raw, int16_t max_bits -#ifdef HR_METADATA , const int16_t hrmasa_flag -#endif ) { uint16_t diff_idx_min; @@ -2634,18 +2610,14 @@ static int16_t ivas_qmetadata_entropy_encode_dir( for ( i = start_band; i < nbands; i++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx_min = 0; // min( q_direction->band_data[i].energy_ratio_index_mod[0]>>1, diff_idx_min ); } else { -#endif diff_idx_min = min( q_direction->band_data[i].energy_ratio_index_mod[0], diff_idx_min ); -#ifdef HR_METADATA } -#endif if ( q_direction->band_data[i].energy_ratio_index_mod[0] > diffuseness_index_max_ec_frame ) { @@ -4856,10 +4828,8 @@ static int16_t encode_spread_coherence_1sf( IVAS_QMETADATA *q_metadata, /* i : quantized metadata */ const int16_t idx_d, /* i : current direction index */ BSTR_ENC_HANDLE hMasaMetaData /* i/o: metadata bitstream handle */ -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ -#endif ) { int16_t i, j, k; @@ -4890,18 +4860,14 @@ static int16_t encode_spread_coherence_1sf( extra_cv = coding_subbands / MASA_FACTOR_CV_COH; for ( j = 0; j < coding_subbands; j++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + extra_cv; } else { -#endif idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + extra_cv; -#ifdef HR_METADATA } -#endif if ( idx_ER > 0 ) { @@ -5252,7 +5218,6 @@ static int16_t encode_surround_coherence( } -#ifdef HR_METADATA static int16_t encode_surround_coherence_hr( IVAS_QMETADATA *hQMetaData, /* i : quantized metadata */ BSTR_ENC_HANDLE hMetaData /* i/o: metadata bitstream handle */ @@ -5453,7 +5418,6 @@ static int16_t encode_surround_coherence_hr( return nbits; } -#endif /*-------------------------------------------------------------------* @@ -5472,21 +5436,16 @@ static float quantize_DCT_0_coh( IVAS_QDIRECTION *q_direction, /* i : quantized metadata */ uint16_t *idx_x, /* o : codewords index */ int16_t *p_no_cb /* o : actual number of codewords dependent on energy ratio value */ -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ -#endif ) { float var_azi, xhat; int16_t idx_sub_cb, idx; -#ifdef HR_METADATA int16_t min_index; -#endif /* quantize first DCT component */ var_azi = var( q_direction->band_data[j].azimuth, q_direction->cfg.nblocks ); -#ifdef HR_METADATA if ( hrmasa_flag ) { minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); @@ -5509,20 +5468,6 @@ static float quantize_DCT_0_coh( idx = squant( x, &xhat, &coherence_cb[idx_sub_cb], len_cb_dct0_masa[min_index] ); *p_no_cb = len_cb_dct0_masa[min_index]; -#else - if ( var_azi < delta_var ) - { - idx_sub_cb = no_cb * q_direction->band_data[j].energy_ratio_index[0]; - } - else - { - idx_sub_cb = no_cb * ( q_direction->band_data[j].energy_ratio_index[0] + DIRAC_DIFFUSE_LEVELS ); - } - - idx = squant( x, &xhat, &coherence_cb[idx_sub_cb], len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]] ); - - *p_no_cb = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; -#endif *idx_x = idx; return xhat; @@ -5591,7 +5536,6 @@ static void dct4_transform( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * ivas_qmetadata_quantize_coherence_hr_512() * @@ -5697,7 +5641,6 @@ static int16_t ivas_qmetadata_quantize_coherence_hr_512( nbits = hMetaData->nb_bits_tot - nbits; return nbits; } -#endif /*-------------------------------------------------------------------* @@ -5714,10 +5657,8 @@ static int16_t ivas_qmetadata_quantize_coherence( BSTR_ENC_HANDLE hMetaData, /* i : metadata handle */ const int16_t write_flag, /* i : flag to actually write the data or not */ int16_t *indice_coherence -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ -#endif ) { int16_t j, k; @@ -5732,10 +5673,8 @@ static int16_t ivas_qmetadata_quantize_coherence( int16_t two_dir_band[MASA_MAXIMUM_CODING_SUBBANDS]; int16_t no_cb_vec[MASA_MAXIMUM_CODING_SUBBANDS]; IVAS_QDIRECTION *q_direction; -#ifdef HR_METADATA int16_t min_index; min_index = 0; -#endif q_direction = &( hQMetaData->q_direction[idx_d] ); coding_subbands = q_direction->cfg.nbands; nbits = 0; @@ -5748,10 +5687,8 @@ static int16_t ivas_qmetadata_quantize_coherence( if ( hQMetaData->q_direction[idx_d].cfg.nblocks == 1 ) { nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData -#ifdef HR_METADATA , hrmasa_flag -#endif ); return nbits; @@ -5808,7 +5745,6 @@ static int16_t ivas_qmetadata_quantize_coherence( /* DCT transform */ dct4_transform( hQMetaData->q_direction[idx_d].coherence_band_data[j].spread_coherence, dct_coh[j] ); -#ifdef HR_METADATA if ( hrmasa_flag ) { minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); @@ -5816,20 +5752,15 @@ static int16_t ivas_qmetadata_quantize_coherence( } else { -#endif no_cb_vec[j] = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; -#ifdef HR_METADATA } -#endif if ( write_flag ) { /* quantize first DCT parameter */ dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j] -#ifdef HR_METADATA , hrmasa_flag -#endif ); } @@ -5994,7 +5925,6 @@ static void ivas_qmetadata_reorder_2dir_bands( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * ivas_qmetadata_reorder_2dir_bands_hr() * @@ -6052,7 +5982,6 @@ static void ivas_qmetadata_reorder_2dir_bands_hr( return; } -#endif /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_qspherical_enc.c b/lib_enc/ivas_qspherical_enc.c index 4c79b875b7..00ca0f1cd6 100644 --- a/lib_enc/ivas_qspherical_enc.c +++ b/lib_enc/ivas_qspherical_enc.c @@ -60,10 +60,8 @@ void quantize_direction_frame( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t i, j; @@ -97,7 +95,6 @@ void quantize_direction_frame( q_direction->not_in_2D += q_direction->band_data[i].elevation_index[j]; -#ifdef HR_METADATA if ( hrmasa_flag ) { if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) @@ -113,7 +110,6 @@ void quantize_direction_frame( } else { -#endif if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[idx] - 3]; @@ -124,9 +120,7 @@ void quantize_direction_frame( q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[idx] - 3] * 2 - 1; q_direction->band_data[i].azimuth_m_alphabet[j] = no_phi_masa[bits_direction_masa[idx] - 1][( q_direction->band_data[i].elevation_index[j] + 1 ) >> 1]; } -#ifdef HR_METADATA } -#endif if ( q_direction->band_data[i].azimuth_index[j] == MASA_NO_INDEX ) { diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 90756a39b1..09cdf1b2d0 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -96,161 +96,6 @@ IVAS_MASA_METADATA_HANDLE MasaFileReader_getMetadataHandle( } -#ifndef HR_METADATA -/*------------------------------------------------------------------------- - * deindex_sph_idx() - * - * deindex the MASA metadata from the input metadata file - *------------------------------------------------------------------------*/ -static void deindex_sph_idx( - const uint16_t sphIndex, /* i : Spherical index */ - const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ - float *theta, /* o : Elevation */ - float *phi /* o : Azimuth */ -) -{ - float ba_crt, del_crt, div_crt, a4_crt; - float estim; - int32_t base_low, base_up; - int16_t n_crt; - int16_t id_th; - int16_t sign_theta; - int16_t id_phi; - int16_t no_th = gridData->no_theta; - const int16_t *n = gridData->no_phi; - const float ba[3] = { - 2.137991118026424e+02f, - 1.244854404591542e+02f, - 1.228408647140870e+02f, - }; - const float del[3] = { 7.998262115303199e+05f, 1.300883976959332e+06f, 1.424072242426373e+06f }; - const float div[3] = { -0.237662341081474f, -0.100938185496887f, -0.092050209205032f }; - const float a4[3] = { -8.415300425381099f, -19.814106922515204f, -21.727272727270197f }; - const uint16_t limit_index1 = 64964, limit_index2 = 47870; - - if ( sphIndex >= limit_index1 ) - { - ba_crt = ba[2]; - div_crt = div[2]; - a4_crt = a4[2]; - del_crt = del[2]; - } - else if ( sphIndex >= limit_index2 ) - { - ba_crt = ba[1]; - div_crt = div[1]; - a4_crt = a4[1]; - del_crt = del[1]; - } - else - { - ba_crt = ba[0]; - div_crt = div[0]; - a4_crt = a4[0]; - del_crt = del[0]; - } - estim = ba_crt + div_crt * sqrtf( del_crt + a4_crt * sphIndex ); - - if ( estim > MASA_NO_CIRCLES ) - { - estim = MASA_NO_CIRCLES; - } - - assert( estim > 0 ); - id_th = (int16_t) roundf( estim ) - 1; - if ( id_th < 0 ) - { - id_th = 0; - } - - if ( id_th == 0 ) - { - base_low = 0; - base_up = n[0]; - } - else - { - estim = MASA_ANGLE_AT_EQUATOR * (float) ( id_th - 0.5f ); - base_low = n[0]; - if ( id_th >= 2 ) - { - if ( id_th == 2 ) - { - base_low += 2 * (int16_t) ceilf( MASA_NTOT2_FAC * ( sinf( estim ) - MASA_ASIN_OFFSET ) ); - } - else - { - base_low += 2 * (int16_t) roundf( MASA_NTOT2_FAC * ( sinf( estim ) - MASA_ASIN_OFFSET ) ); - } - } - base_up = base_low + 2 * n[id_th]; - } - - sign_theta = 1; - - n_crt = n[id_th]; - if ( sphIndex < base_low ) - { - id_th--; - n_crt = n[id_th]; - if ( id_th == 0 ) - { - base_low = 0; - base_up = n_crt; - } - else - { - base_up = base_low; - base_low -= 2 * n[id_th]; - } - assert( sphIndex >= base_low ); - } - else if ( sphIndex >= base_up ) - { - id_th++; - n_crt = n[id_th]; - base_low = base_up; - base_up += 2 * n_crt; - assert( sphIndex < base_up ); - } - - id_phi = (int16_t) ( sphIndex - base_low ); - if ( sphIndex - base_low >= n_crt ) - { - id_phi -= n_crt; - sign_theta = -1; - } - - if ( id_th == 0 ) - { - *theta = 0.f; - *phi = (float) sphIndex * 360 / (float) n_crt - 180; - } - else - { - if ( id_th == no_th - 1 ) - { - id_phi = 0; - *phi = -180; - *theta = 90 * (float) sign_theta; - } - else - { - *theta = id_th * MASA_ANGLE_AT_EQUATOR_DEG * (float) sign_theta; - if ( id_th % 2 == 0 ) - { - *phi = (float) id_phi * 360 / (float) n_crt - 180; - } - else - { - *phi = ( (float) id_phi + 0.5f ) * 360 / (float) n_crt - 180; - } - } - } - - return; -} -#endif /*------------------------------------------------------------------------- @@ -344,9 +189,7 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { deindex_sph_idx( readIndex[b], &self->sph_grid16, &( hMeta->directional_meta[i].elevation[j][b] ), &( hMeta->directional_meta[i].azimuth[j][b] ) ); -#ifdef HR_METADATA hMeta->directional_meta[i].spherical_index[j][b] = readIndex[b]; -#endif } /* Direct-to-total ratio */ -- GitLab From 36b6d26cc97c45682c37c7e3e8ab4bc501b77253 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:32:41 +0200 Subject: [PATCH 02/53] [cleanup] accept SBA_TD_RESIDUAL --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9c1c6ff625..b258c52eba 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define SBA_TD_RESIDUAL /* Dlb : Issue 426: SBA encoder complexity optimization */ #define FIX_357_DTX_32K /* Eri: issue 357 - Forced LP-CNG at 32k */ #define FIX_435_ISM_MERGE_BUG /* Eri: Merge bug fix for ISM NULL metadata and tcx_only cases */ -- GitLab From e4a50a64085f1b41bbdeeb84ffc052101b8bf609 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:33:17 +0200 Subject: [PATCH 03/53] [cleanup] accept FIX_357_DTX_32K --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b258c52eba..33b5aca8a5 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_357_DTX_32K /* Eri: issue 357 - Forced LP-CNG at 32k */ #define FIX_435_ISM_MERGE_BUG /* Eri: Merge bug fix for ISM NULL metadata and tcx_only cases */ #define FIX_355_REFACTOR_PARAMBIN_TO_5MS /* Nokia: Fixes issue 355 by refactoring parametric binauralizer code to 5 ms mode */ #define FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING /* Eri: Fix incorrect use of stack variable used for channel aware config file */ -- GitLab From 7532e399821167b4d288c7bdad8d16f5a5a8e906 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:33:55 +0200 Subject: [PATCH 04/53] [cleanup] accept FIX_435_ISM_MERGE_BUG --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 33b5aca8a5..fcc7ef5182 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_435_ISM_MERGE_BUG /* Eri: Merge bug fix for ISM NULL metadata and tcx_only cases */ #define FIX_355_REFACTOR_PARAMBIN_TO_5MS /* Nokia: Fixes issue 355 by refactoring parametric binauralizer code to 5 ms mode */ #define FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING /* Eri: Fix incorrect use of stack variable used for channel aware config file */ #define COMBINED_FORMAT_SIGNALING /* VA: Introduce a signaling bit for combined format coding */ -- GitLab From eb6eee3687df8bb75f51b1fde93429abefb9b8ac Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:34:39 +0200 Subject: [PATCH 05/53] [cleanup] accept FIX_355_REFACTOR_PARAMBIN_TO_5MS --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index fcc7ef5182..c6612e86fb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_355_REFACTOR_PARAMBIN_TO_5MS /* Nokia: Fixes issue 355 by refactoring parametric binauralizer code to 5 ms mode */ #define FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING /* Eri: Fix incorrect use of stack variable used for channel aware config file */ #define COMBINED_FORMAT_SIGNALING /* VA: Introduce a signaling bit for combined format coding */ -- GitLab From d6e1ff2635da0c78268d3c5d4b96844edf8ed245 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:35:46 +0200 Subject: [PATCH 06/53] [cleanup] accept FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index c6612e86fb..5f016efa99 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING /* Eri: Fix incorrect use of stack variable used for channel aware config file */ #define COMBINED_FORMAT_SIGNALING /* VA: Introduce a signaling bit for combined format coding */ #define FIX_356_ISM_METADATA_SYNC /* Eri: issue 356: Metadata out-of-synch for -no_delay_comp */ -- GitLab From 4f1785ea64cb91e413003873dcb772391c9b162d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:36:37 +0200 Subject: [PATCH 07/53] [cleanup] accept COMBINED_FORMAT_SIGNALING --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5f016efa99..ece0331349 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define COMBINED_FORMAT_SIGNALING /* VA: Introduce a signaling bit for combined format coding */ #define FIX_356_ISM_METADATA_SYNC /* Eri: issue 356: Metadata out-of-synch for -no_delay_comp */ -- GitLab From 3988e6f2f016cb66bc9a904d08f6cd1a96ef4e73 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:37:41 +0200 Subject: [PATCH 08/53] [cleanup] accept FIX_356_ISM_METADATA_SYNC --- apps/decoder.c | 8 ---- lib_com/options.h | 1 - lib_dec/ivas_objectRenderer_internal.c | 19 -------- lib_dec/ivas_stat_dec.h | 2 - lib_dec/lib_dec.c | 8 ---- lib_dec/lib_dec.h | 4 -- lib_rend/ivas_objectRenderer.c | 66 -------------------------- lib_rend/ivas_objectRenderer_sources.c | 8 ---- lib_rend/ivas_prot_rend.h | 21 -------- 9 files changed, 137 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 7ceda8f6f3..455114a186 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -386,18 +386,10 @@ int main( /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ -#ifdef FIX_356_ISM_METADATA_SYNC #ifdef FIX_439_OTR_PARAMS if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef FIX_439_OTR_PARAMS - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK ) -#endif #endif { diff --git a/lib_com/options.h b/lib_com/options.h index ece0331349..4cd607270b 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -150,7 +150,6 @@ -#define FIX_356_ISM_METADATA_SYNC /* Eri: issue 356: Metadata out-of-synch for -no_delay_comp */ #define FIX_446_STEREO_DMX_CRASH /* FhG: fix discrepancy with EVS code that could cause crashes in rare cases */ diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index ba14104ed9..c023c14f79 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -75,7 +75,6 @@ ivas_error ivas_td_binaural_renderer( const int16_t output_frame /* i : output frame length */ ) { -#ifdef FIX_356_ISM_METADATA_SYNC int16_t ism_md_subframe_update; if ( st_ivas->hDecoderConfig->Opt_delay_comp ) @@ -92,14 +91,6 @@ ivas_error ivas_td_binaural_renderer( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, ism_md_subframe_update, output, output_frame ); -#else - return ivas_td_binaural_renderer_unwrap( - st_ivas->hReverb, - st_ivas->transport_config, - st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, - ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); -#endif } @@ -125,7 +116,6 @@ ivas_error ivas_td_binaural_renderer_sf( int16_t ch, slot_size, slots_to_render, output_frame; ivas_error error; -#ifdef FIX_356_ISM_METADATA_SYNC int16_t ism_md_subframe_update_jbm; int16_t c_indx, nS; @@ -139,7 +129,6 @@ ivas_error ivas_td_binaural_renderer_sf( ism_md_subframe_update_jbm = st_ivas->hTcBuffer->nb_subframes - 2; } -#endif for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { p_reverb_signal[ch] = reverb_signal[ch]; @@ -174,7 +163,6 @@ ivas_error ivas_td_binaural_renderer_sf( output_frame = st_ivas->hTcBuffer->subframe_nbslots[subframe_idx] * st_ivas->hTcBuffer->n_samples_granularity; /* Update object position(s) */ -#ifdef FIX_356_ISM_METADATA_SYNC c_indx = 0; for ( nS = 0; nS < st_ivas->nchan_transport; nS++ ) @@ -190,9 +178,6 @@ ivas_error ivas_td_binaural_renderer_sf( { TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, st_ivas->ivas_format, st_ivas->hIsmMetaData ); } -#else - TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, tc_local ); -#endif /* Update the listener's location/orientation */ TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, @@ -208,11 +193,7 @@ ivas_error ivas_td_binaural_renderer_sf( } /* Render subframe */ -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( error = TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0, ism_md_subframe_update_jbm ) ) != IVAS_ERR_OK ) -#else - if ( ( error = TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index cd565f3eae..892f941c7d 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1226,9 +1226,7 @@ typedef struct decoder_config_structure #ifdef JBM_TSM_ON_TCS int16_t voip_active; #endif -#ifdef FIX_356_ISM_METADATA_SYNC int16_t Opt_delay_comp; /* flag indicating delay compensation active */ -#endif } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index fd33c41101..062add5aaa 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -280,9 +280,7 @@ static void init_decoder_config( hDecoderConfig->voip_active = 0; #endif -#ifdef FIX_356_ISM_METADATA_SYNC hDecoderConfig->Opt_delay_comp = 0; -#endif return; } @@ -450,12 +448,8 @@ ivas_error IVAS_DEC_Configure( #endif const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ -#ifdef FIX_356_ISM_METADATA_SYNC const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ const int16_t delayCompensationEnabled /* i : enable delay compensation */ -#else - const float non_diegetic_pan_gain /* i : non diegetic panning gain */ -#endif ) { Decoder_Struct *st_ivas; @@ -511,9 +505,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled; hDecoderConfig->Opt_non_diegetic_pan = Opt_non_diegetic_pan; hDecoderConfig->non_diegetic_pan_gain = non_diegetic_pan_gain; -#ifdef FIX_356_ISM_METADATA_SYNC hDecoderConfig->Opt_delay_comp = delayCompensationEnabled; -#endif /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 0539d75188..3b42cb80de 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -152,12 +152,8 @@ ivas_error IVAS_DEC_Configure( #endif const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ -#ifdef FIX_356_ISM_METADATA_SYNC const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ const int16_t delayCompensationEnabled /* i : enable delay compensation */ -#else - const float non_diegetic_pan_gain /* i : non diegetic panning gain */ -#endif ); void IVAS_DEC_Close( diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 2f5b406c66..1b6f2eeccc 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -263,9 +263,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t ism_md_subframe_update, /* i: Number of subframes to delay ism metadata to sync with audio */ -#endif #ifdef JBM_TSM_ON_TCS float *output[], /* i/o: SCE channels / Binaural synthesis */ #else @@ -278,9 +276,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( int16_t subframe_idx; float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; ivas_error error; -#ifdef FIX_356_ISM_METADATA_SYNC int16_t c_indx, nS; -#endif #ifdef JBM_TSM_ON_TCS float *p_reverb_signal[BINAURAL_CHANNELS]; int16_t ch; @@ -293,7 +289,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef FIX_356_ISM_METADATA_SYNC c_indx = 0; for ( nS = 0; nS < num_src; nS++ ) { @@ -304,20 +299,14 @@ ivas_error ivas_td_binaural_renderer_unwrap( c_indx++; } } -#else - /* Update object position(s) */ - TDREND_Update_object_positions( hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, output ); -#endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { -#ifdef FIX_356_ISM_METADATA_SYNC if ( subframe_idx == ism_md_subframe_update ) { /* Update object position(s) */ TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData ); } -#endif /* Update the listener's location/orientation */ TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL, ( Pos != NULL ) ? &Pos[subframe_idx] : NULL ); @@ -334,11 +323,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( } /* Render subframe */ -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx, ism_md_subframe_update ) ) != IVAS_ERR_OK ) -#else - if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -369,12 +354,8 @@ ivas_error TDREND_GetMix( float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ #endif const int16_t subframe_length, /* i/o: subframe length */ -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ const int16_t ism_md_subframe_update /* Number of subframes to delay ism metadata to sync with audio */ -#else - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#endif ) { int16_t i; @@ -387,11 +368,9 @@ ivas_error TDREND_GetMix( float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; float pan_left, pan_right; -#ifdef FIX_356_ISM_METADATA_SYNC int16_t subframe_update_flag; subframe_update_flag = subframe_idx == ism_md_subframe_update; -#endif error = IVAS_ERR_OK; @@ -416,11 +395,7 @@ ivas_error TDREND_GetMix( if ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) ) { TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev, -#ifdef FIX_356_ISM_METADATA_SYNC Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_update_flag ); -#else - Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_idx ); -#endif } /* Render source if needed */ @@ -481,45 +456,20 @@ static void TDREND_Clear_Update_flags( void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ -#ifndef FIX_356_ISM_METADATA_SYNC - const int16_t lfe_idx, /* i : Input LFE index */ -#endif const IVAS_FORMAT in_format, /* i : Format of input sources */ const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ -#ifndef FIX_356_ISM_METADATA_SYNC - , -#ifdef JBM_TSM_ON_TCS - float *output[] /* i/o: SCE/MC channels */ -#else - float output[][L_FRAME48k] /* i/o: SCE/MC channels */ -#endif -#endif ) { TDREND_DirAtten_t *DirAtten_p; int16_t nS; float Pos[3]; float Dir[3]; -#ifndef FIX_356_ISM_METADATA_SYNC - int16_t c_indx; -#endif DirAtten_p = hBinRendererTd->DirAtten_p; /* For each source, write the frame data to the source object*/ -#ifndef FIX_356_ISM_METADATA_SYNC - c_indx = 0; -#endif for ( nS = 0; nS < num_src; nS++ ) { -#ifndef FIX_356_ISM_METADATA_SYNC - if ( !( in_format == MC_FORMAT && nS == lfe_idx ) ) /* Skip LFE for MC */ - { - hBinRendererTd->Sources[c_indx]->InputFrame_p = output[nS]; - hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; - c_indx++; - } -#endif if ( in_format == ISM_FORMAT ) { /* Update the source positions */ @@ -689,9 +639,7 @@ ivas_error ivas_td_binaural_renderer_ext( IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; ivas_error error; -#ifdef FIX_356_ISM_METADATA_SYNC int16_t ism_md_subframe_update_ext; -#endif #ifdef JBM_TSM_ON_TCS float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; @@ -707,9 +655,7 @@ ivas_error ivas_td_binaural_renderer_ext( inConfigType = getAudioConfigType( inConfig ); lfe_idx = LFE_CHANNEL; hIsmMetaData[0] = NULL; -#ifdef FIX_356_ISM_METADATA_SYNC ism_md_subframe_update_ext = 0; -#endif if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { @@ -743,25 +689,13 @@ ivas_error ivas_td_binaural_renderer_ext( } #ifdef JBM_TSM_ON_TCS -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, ( headRotData != NULL ) ? headRotData->Pos : NULL, ism_md_subframe_update_ext, p_output, output_frame ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, - ( headRotData != NULL ) ? headRotData->Pos : NULL, p_output, output_frame ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, ( headRotData != NULL ) ? headRotData->Pos : NULL, ism_md_subframe_update_ext, output, output_frame ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, - ( headRotData != NULL ) ? headRotData->Pos : NULL, output, output_frame ) ) != IVAS_ERR_OK ) -#endif #endif { return error; diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 1468273572..a1cac4f1d3 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -259,11 +259,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( int16_t *itd, /* o: ITD value */ float *Gain, /* o: Gain value */ TDREND_SRC_t *Src_p, /* i/o: Source pointer */ -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t subframe_update_flag -#else - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#endif ) { TDREND_MIX_Listener_t *Listener_p; @@ -357,11 +353,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( azim_delta = ( azim_delta > 180.0f ) ? ( azim_delta - 360 ) : ( ( azim_delta < -180.0f ) ? ( azim_delta + 360 ) : ( azim_delta ) ); /* map to -180:180 range */ *intp_count = min( MAX_INTERPOLATION_STEPS, max( (int16_t) ( fabsf( azim_delta ) * MAX_ANGULAR_STEP_INV ), (int16_t) ( fabsf( elev_delta ) * MAX_ANGULAR_STEP_INV ) ) ); -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( *intp_count > 0 ) && subframe_update_flag ) -#else - if ( ( *intp_count > 0 ) && subframe_idx == 0 ) -#endif { /* Set deltas for interpolation */ v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ac9e765abe..a088f171c1 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -236,9 +236,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t ism_md_subframe_update, -#endif #ifdef JBM_TSM_ON_TCS float *output[], /* i/o: SCE channels / Binaural synthesis */ #else @@ -291,12 +289,8 @@ ivas_error TDREND_GetMix( float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ #endif const int16_t subframe_length, /* i/o: subframe length */ -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ const int16_t ism_md_subframe_update /* Number of subframes to delay metadata to sync with audio */ -#else - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#endif ); void TDREND_Update_listener_orientation( @@ -309,19 +303,8 @@ void TDREND_Update_listener_orientation( void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ -#ifndef FIX_356_ISM_METADATA_SYNC - const int16_t lfe_idx, /* i : Input LFE index */ -#endif const IVAS_FORMAT in_format, /* i : Format of input sources */ const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ -#ifndef FIX_356_ISM_METADATA_SYNC - , -#ifdef JBM_TSM_ON_TCS - float *output[] /* i/o: SCE/MC channels */ -#else - float output[][L_FRAME48k] /* i/o: SCE/MC channels */ -#endif -#endif ); void BSplineModelEvalDealloc( @@ -392,11 +375,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( int16_t *itd, /* o: ITD value */ float *Gain, /* o: Gain value */ TDREND_SRC_t *Src_p, -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t subframe_update_flag /* i : Flag to determine update subframe idx */ -#else - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#endif ); ivas_error TDREND_SRC_Alloc( -- GitLab From 995c2d725bf8aaa718c68576c9ecdc420acf379d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:38:31 +0200 Subject: [PATCH 09/53] [cleanup] accept FIX_446_STEREO_DMX_CRASH --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4cd607270b..436d152325 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,7 +151,6 @@ -#define FIX_446_STEREO_DMX_CRASH /* FhG: fix discrepancy with EVS code that could cause crashes in rare cases */ #define FIX_386_CORECODER_RECONFIG_2 /* VA: Issue 386: Resolve remaining ToDo comments in CoreCoder reconfig. */ -- GitLab From ec112185860448db706a93d82c9ef0a3ee492d33 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:39:25 +0200 Subject: [PATCH 10/53] [cleanup] accept FIX_386_CORECODER_RECONFIG_2 --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 436d152325..5163a82430 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,7 +152,6 @@ -#define FIX_386_CORECODER_RECONFIG_2 /* VA: Issue 386: Resolve remaining ToDo comments in CoreCoder reconfig. */ #define FIX_439_OTR_PARAMS /* Philips: Issue 439: orientation tracking parameter aspects. */ -- GitLab From a429a5a5e95e08825dc805b73d646603a003a59a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:40:24 +0200 Subject: [PATCH 11/53] [cleanup] accept FIX_439_OTR_PARAMS --- apps/decoder.c | 8 ----- apps/renderer.c | 40 ------------------------ lib_com/common_api_types.h | 2 -- lib_com/ivas_cnst.h | 22 ------------- lib_com/options.h | 2 -- lib_dec/ivas_init_dec.c | 42 ------------------------- lib_dec/ivas_stat_dec.h | 4 --- lib_dec/lib_dec.c | 45 --------------------------- lib_dec/lib_dec.h | 6 ---- lib_rend/ivas_orient_trk.c | 63 -------------------------------------- lib_rend/ivas_prot_rend.h | 4 --- lib_rend/ivas_stat_rend.h | 4 --- lib_rend/lib_rend.c | 41 ------------------------- lib_rend/lib_rend.h | 4 --- 14 files changed, 287 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 455114a186..5eb46f618c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -218,11 +218,7 @@ int main( * Open decoder handle *------------------------------------------------------------------------------------------*/ -#ifdef FIX_439_OTR_PARAMS if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -386,11 +382,7 @@ int main( /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ -#ifdef FIX_439_OTR_PARAMS if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); diff --git a/apps/renderer.c b/apps/renderer.c index 84d616af1e..640899679b 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -144,11 +144,7 @@ typedef struct char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#ifdef FIX_439_OTR_PARAMS int8_t orientation_tracking; -#else - int8_t orientationTracking; -#endif int16_t nonDiegeticPan; float nonDiegeticPanGain; bool delayCompensationEnabled; @@ -771,11 +767,7 @@ int main( } } -#ifdef FIX_439_OTR_PARAMS if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1475,54 +1467,30 @@ static bool parseDiegeticPan( static bool parseOrientationTracking( char *value, -#ifdef FIX_439_OTR_PARAMS int8_t *orientation_tracking -#else - int8_t *tracking_type -#endif ) { to_upper( value ); if ( strcmp( value, "NONE" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_NONE; -#else - *tracking_type = IVAS_ORIENT_TRK_NONE; -#endif } else if ( strcmp( value, "REF" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_REF; -#else - *tracking_type = IVAS_ORIENT_TRK_REF; -#endif } else if ( strcmp( value, "AVG" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_AVG; -#else - *tracking_type = IVAS_ORIENT_TRK_AVG; -#endif } else if ( strcmp( value, "REF_VEC" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC; -#else - *tracking_type = IVAS_ORIENT_TRK_REF_VEC; -#endif } else if ( strcmp( value, "REF_VEC_LEV" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC_LEV; -#else - *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV; -#endif } else { @@ -1746,11 +1714,7 @@ static CmdlnArgs defaultArgs( clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); -#ifdef FIX_439_OTR_PARAMS args.orientation_tracking = HEAD_ORIENT_TRK_NONE; -#else - args.orientationTracking = IVAS_ORIENT_TRK_NONE; -#endif args.nonDiegeticPan = 0; args.nonDiegeticPanGain = 0.f; @@ -1858,11 +1822,7 @@ static void parseOption( break; case CmdLnOptionId_orientationTracking: assert( numOptionValues == 1 ); -#ifdef FIX_439_OTR_PARAMS if ( !parseOrientationTracking( optionValues[0], &args->orientation_tracking ) ) -#else - if ( !parseOrientationTracking( optionValues[0], &args->orientationTracking ) ) -#endif { fprintf( stderr, "Unknown option for orientation tracking: %s\n", optionValues[0] ); exit( -1 ); diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 33ddc9e881..17cc8e2abb 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -94,7 +94,6 @@ typedef struct float x, y, z; } IVAS_VECTOR3; -#ifdef FIX_439_OTR_PARAMS typedef enum { HEAD_ORIENT_TRK_NONE, @@ -103,7 +102,6 @@ typedef enum HEAD_ORIENT_TRK_REF_VEC, HEAD_ORIENT_TRK_REF_VEC_LEV } HEAD_ORIENT_TRK_T; -#endif typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index f59ac2f000..3ba4c27c93 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1606,28 +1606,6 @@ typedef enum } SFX_OpMode_t; -#ifndef FIX_439_OTR_PARAMS -/*----------------------------------------------------------------------------------* - * Orientation tracking constants - *----------------------------------------------------------------------------------*/ - -/* Orientation tracking types */ -#define IVAS_ORIENT_TRK_NONE 0 -#define IVAS_ORIENT_TRK_REF 1 -#define IVAS_ORIENT_TRK_AVG 2 -#define IVAS_ORIENT_TRK_REF_VEC 3 -#define IVAS_ORIENT_TRK_REF_VEC_LEV 4 - -typedef enum -{ - OTR_TRACKING_NONE = IVAS_ORIENT_TRK_NONE, - OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: no rotation) */ - OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */ - , - OTR_TRACKING_REF_VEC = IVAS_ORIENT_TRK_REF_VEC, /* track orientation relative to external reference vector */ - OTR_TRACKING_REF_VEC_LEV = IVAS_ORIENT_TRK_REF_VEC_LEV /* track orientation relative to level component of external reference vector */ -} OTR_TRACKING_T; -#endif /*----------------------------------------------------------------------------------* * Reverberator constants diff --git a/lib_com/options.h b/lib_com/options.h index 5163a82430..b5d598b7f4 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,7 +153,6 @@ -#define FIX_439_OTR_PARAMS /* Philips: Issue 439: orientation tracking parameter aspects. */ #define FIX_440_PARAM_ISM_DIR_NOISE /* FhG: Issue 440: Fix directional background noise becoming diffuse in ParamISM */ @@ -173,7 +172,6 @@ #define COMPLEXITY_LEVEL_INDICATION -#define FIX_439_OTR_PARAMS /* Philips: Issue 439: orientation tracking parameter aspects. */ #define ARITH_HUFF_CODER_CHANGES /* DLB: Optimization of metadata memory for Huffman and arithmetic coders */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2452b34edb..6faa3a3a49 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -786,52 +786,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { -#ifdef FIX_439_OTR_PARAMS if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_NONE ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_NONE ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_AVG_ORIENT ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_ORIENT ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC_LEV ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC_LEV ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - return IVAS_ERR_WRONG_MODE; - } -#endif } /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 892f941c7d..f92781d6d8 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1210,11 +1210,7 @@ typedef struct decoder_config_structure int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ -#ifdef FIX_439_OTR_PARAMS HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */ -#else - int16_t orientation_tracking; /* indicates orientation tracking type */ -#endif int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ float non_diegetic_pan_gain; /* non diegetic panning gain*/ int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 062add5aaa..76bb28480c 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -115,11 +115,7 @@ static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSampl static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, int16_t *pcmBuf ); #endif static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); -#ifdef FIX_439_OTR_PARAMS static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); -#else -static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, const int16_t orientation_tracking ); -#endif #ifdef JBM_TSM_ON_TCS static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ); static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec ); @@ -141,10 +137,6 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, ivas_error IVAS_DEC_Open( IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ const IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */ -#ifndef FIX_439_OTR_PARAMS - , - const int16_t orientation_tracking /* i : orientation tracking type */ -#endif ) { IVAS_DEC_HANDLE hIvasDec; @@ -198,11 +190,7 @@ ivas_error IVAS_DEC_Open( st_ivas = hIvasDec->st_ivas; /* initialize Decoder Config. handle */ -#ifdef FIX_439_OTR_PARAMS init_decoder_config( hIvasDec->st_ivas->hDecoderConfig ); -#else - init_decoder_config( hIvasDec->st_ivas->hDecoderConfig, orientation_tracking ); -#endif /* initialize pointers to handles to NULL */ ivas_initialize_handles_dec( st_ivas ); @@ -255,10 +243,6 @@ ivas_error IVAS_DEC_Open( static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig /* i/o: configuration structure */ -#ifndef FIX_439_OTR_PARAMS - , - const int16_t orientation_tracking -#endif ) { hDecoderConfig->Opt_AMR_WB = 0; @@ -268,11 +252,7 @@ static void init_decoder_config( hDecoderConfig->Opt_HRTF_binary = 0; hDecoderConfig->Opt_Headrotation = 0; hDecoderConfig->Opt_RendConfigCustom = 0; -#ifdef FIX_439_OTR_PARAMS hDecoderConfig->orientation_tracking = HEAD_ORIENT_TRK_NONE; -#else - hDecoderConfig->orientation_tracking = orientation_tracking; -#endif hDecoderConfig->Opt_non_diegetic_pan = 0; hDecoderConfig->non_diegetic_pan_gain = 0; @@ -443,9 +423,7 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ -#endif const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ @@ -498,9 +476,7 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_LsCustom = customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = enableHeadRotation; -#ifdef FIX_439_OTR_PARAMS hDecoderConfig->orientation_tracking = orientation_tracking; -#endif hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled; hDecoderConfig->Opt_non_diegetic_pan = Opt_non_diegetic_pan; @@ -2760,7 +2736,6 @@ static ivas_error printConfigInfo_dec( fprintf( stdout, "Head rotation: ON\n" ); } -#ifdef FIX_439_OTR_PARAMS if ( st_ivas->hDecoderConfig->orientation_tracking != HEAD_ORIENT_TRK_NONE ) { switch ( st_ivas->hDecoderConfig->orientation_tracking ) @@ -2781,26 +2756,6 @@ static ivas_error printConfigInfo_dec( break; } } -#else - if ( st_ivas->hDecoderConfig->orientation_tracking != IVAS_ORIENT_TRK_NONE ) - { - switch ( st_ivas->hDecoderConfig->orientation_tracking ) - { - case IVAS_ORIENT_TRK_AVG: - fprintf( stdout, "Orientation tracking: AVG\n" ); - break; - case IVAS_ORIENT_TRK_REF: - fprintf( stdout, "Orientation tracking: REF\n" ); - break; - case IVAS_ORIENT_TRK_REF_VEC: - fprintf( stdout, "Orientation tracking: REF_VEC\n" ); - break; - case IVAS_ORIENT_TRK_REF_VEC_LEV: - fprintf( stdout, "Orientation tracking: REF_VEC_LEV\n" ); - break; - } - } -#endif if ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) { diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 3b42cb80de..c317b45e3a 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -133,10 +133,6 @@ typedef ivas_error ( *JbmTraceFileWriterFn )( const void *data, void *writer ); ivas_error IVAS_DEC_Open( IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */ -#ifndef FIX_439_OTR_PARAMS - , - const int16_t orientation_tracking /* i : orientation tracking type */ -#endif ); /*! r: error code */ @@ -147,9 +143,7 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ -#endif const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index ae646b4d5c..5fc4b7c45a 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -406,11 +406,7 @@ ivas_error ivas_orient_trk_Init( pOTR->refRot = identity; /* set safe default tracking mode */ -#ifdef FIX_439_OTR_PARAMS pOTR->orientation_tracking = HEAD_ORIENT_TRK_NONE; -#else - pOTR->trackingType = OTR_TRACKING_NONE; -#endif return IVAS_ERR_OK; } @@ -424,11 +420,7 @@ ivas_error ivas_orient_trk_Init( ivas_error ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ -#else - const OTR_TRACKING_T trackingType /* i/o: orientation tracking type */ -#endif ) { if ( pOTR == NULL ) @@ -436,11 +428,7 @@ ivas_error ivas_orient_trk_SetTrackingType( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_439_OTR_PARAMS pOTR->orientation_tracking = orientation_tracking; -#else - pOTR->trackingType = trackingType; -#endif return IVAS_ERR_OK; } @@ -491,35 +479,17 @@ ivas_error ivas_orient_trk_GetMainOrientation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_439_OTR_PARAMS switch ( pOTR->orientation_tracking ) -#else - switch ( pOTR->trackingType ) -#endif { -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: -#else - case OTR_TRACKING_NONE: -#endif *pOrientation = IdentityQuaternion(); break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_REF_VEC: case HEAD_ORIENT_TRK_REF_VEC_LEV: case HEAD_ORIENT_TRK_REF: -#else - case OTR_TRACKING_REF_VEC: - case OTR_TRACKING_REF_VEC_LEV: - case OTR_TRACKING_REF_ORIENT: -#endif *pOrientation = pOTR->refRot; break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_AVG: -#else - case OTR_TRACKING_AVG_ORIENT: -#endif *pOrientation = pOTR->absAvgRot; break; } @@ -571,30 +541,15 @@ ivas_error ivas_orient_trk_SetReferenceVector( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_439_OTR_PARAMS switch ( pOTR->orientation_tracking ) -#else - switch ( pOTR->trackingType ) -#endif { -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: case HEAD_ORIENT_TRK_REF: case HEAD_ORIENT_TRK_AVG: case HEAD_ORIENT_TRK_REF_VEC: -#else - case OTR_TRACKING_NONE: - case OTR_TRACKING_REF_ORIENT: - case OTR_TRACKING_AVG_ORIENT: - case OTR_TRACKING_REF_VEC: -#endif acousticFrontVector = VectorSubtract( listenerPos, refPos ); break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_REF_VEC_LEV: -#else - case OTR_TRACKING_REF_VEC_LEV: -#endif /* ignore the height difference between listener position and reference position */ listenerPosLevel.z = refPosLevel.z = listenerPos.z; listenerPosLevel.x = listenerPos.x; @@ -652,28 +607,14 @@ ivas_error ivas_orient_trk_Process( result = IVAS_ERR_OK; -#ifdef FIX_439_OTR_PARAMS switch ( pOTR->orientation_tracking ) -#else - switch ( pOTR->trackingType ) -#endif { -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: -#else - case OTR_TRACKING_NONE: -#endif pOTR->trkRot = absRot; break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_REF: case HEAD_ORIENT_TRK_REF_VEC: case HEAD_ORIENT_TRK_REF_VEC_LEV: -#else - case OTR_TRACKING_REF_VEC: - case OTR_TRACKING_REF_VEC_LEV: - case OTR_TRACKING_REF_ORIENT: -#endif /* Reset average orientation */ pOTR->absAvgRot = absRot; @@ -685,11 +626,7 @@ ivas_error ivas_orient_trk_Process( QuaternionProduct( pOTR->trkRot, absRot, &pOTR->trkRot ); break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_AVG: -#else - case OTR_TRACKING_AVG_ORIENT: -#endif /* Compute average (low-pass filtered) absolute orientation */ QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index a088f171c1..f59ab91e0d 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -897,11 +897,7 @@ ivas_error ivas_orient_trk_Init( ivas_error ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ -#else - const OTR_TRACKING_T trackingType /* i : orientation tracking type */ -#endif ); ivas_error ivas_orient_trk_SetReferenceRotation( diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 877076db9a..b90b7b5507 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -228,11 +228,7 @@ typedef struct EFAP typedef struct ivas_orient_trk_state_t { -#ifdef FIX_439_OTR_PARAMS HEAD_ORIENT_TRK_T orientation_tracking; -#else - OTR_TRACKING_T trackingType; -#endif float centerAdaptationRate; float offCenterAdaptationRate; float adaptationAngle; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 41f68b6520..4551426e2a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3914,51 +3914,10 @@ ivas_error IVAS_REND_SetHeadRotation( ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ -#else - const uint8_t otrMode /* i : Orientation tracking mode */ -#endif ) { -#ifdef FIX_439_OTR_PARAMS return ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); -#else - OTR_TRACKING_T mode; - ivas_error error; - - if ( hIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - switch ( otrMode ) - { - case IVAS_ORIENT_TRK_AVG: - mode = OTR_TRACKING_AVG_ORIENT; - break; - case IVAS_ORIENT_TRK_REF: - mode = OTR_TRACKING_REF_ORIENT; - break; - case IVAS_ORIENT_TRK_REF_VEC: - mode = OTR_TRACKING_REF_VEC; - break; - case IVAS_ORIENT_TRK_REF_VEC_LEV: - mode = OTR_TRACKING_REF_VEC_LEV; - break; - case IVAS_ORIENT_TRK_NONE: - default: - mode = OTR_TRACKING_NONE; - break; - } - - if ( ( error = ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, mode ) ) != IVAS_ERR_OK ) - { - return error; - } - - return IVAS_ERR_OK; -#endif } diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 33cbd78f56..cf0db7e4b5 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -251,11 +251,7 @@ ivas_error IVAS_REND_SetHeadRotation( ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ -#else - const uint8_t otrMode /* i : Orientation tracking mode */ -#endif ); ivas_error IVAS_REND_SetReferenceRotation( -- GitLab From f6a99021563653b7c62246c1aac8e9ced111ef03 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:41:12 +0200 Subject: [PATCH 12/53] [cleanup] accept FIX_440_PARAM_ISM_DIR_NOISE --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b5d598b7f4..d84610484f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,7 +154,6 @@ -#define FIX_440_PARAM_ISM_DIR_NOISE /* FhG: Issue 440: Fix directional background noise becoming diffuse in ParamISM */ #define LBR_SBA_DIRAC_FIX /* DLB: Bug fix for DirAC at low bitrates */ -- GitLab From 76b8d3ffc987be9cf4c89bd3c61cf5513067db50 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:42:18 +0200 Subject: [PATCH 13/53] [cleanup] accept LBR_SBA_DIRAC_FIX --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index d84610484f..dbbbe76f3c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,7 +155,6 @@ -#define LBR_SBA_DIRAC_FIX /* DLB: Bug fix for DirAC at low bitrates */ #define FIX_445_SNS_BUGFIXES /* FhG: bug fix for spectral tilt in SNS computation + necessary update of codebooks and converison to fixedpoint-compatible tables */ #define FIX_447_PARAMBIN_MASA_REGU_FAC /* Nokia: Issue 447: Fix issue by adjusting regularization factor minimum value. */ -- GitLab From 724a7438c9bb881de7d139639cde9bb97589e46c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:43:19 +0200 Subject: [PATCH 14/53] [cleanup] accept FIX_445_SNS_BUGFIXES --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index dbbbe76f3c..1bc295f563 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -156,7 +156,6 @@ -#define FIX_445_SNS_BUGFIXES /* FhG: bug fix for spectral tilt in SNS computation + necessary update of codebooks and converison to fixedpoint-compatible tables */ #define FIX_447_PARAMBIN_MASA_REGU_FAC /* Nokia: Issue 447: Fix issue by adjusting regularization factor minimum value. */ #define FIX_441_SBA_PARAMBIN_GAINS /* Nokia: Fix issue 441 by changing gains in SBA path of parametric binauralizer */ -- GitLab From 5c0e81219173dac20cb1557ba9a4900a8324f960 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:44:09 +0200 Subject: [PATCH 15/53] [cleanup] accept FIX_447_PARAMBIN_MASA_REGU_FAC --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1bc295f563..7324e4adfc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -156,7 +156,6 @@ -#define FIX_447_PARAMBIN_MASA_REGU_FAC /* Nokia: Issue 447: Fix issue by adjusting regularization factor minimum value. */ #define FIX_441_SBA_PARAMBIN_GAINS /* Nokia: Fix issue 441 by changing gains in SBA path of parametric binauralizer */ #define MC_PARAMUPMIX_MODE /* Dlb: Contribution 39: Multichannel Parametric Upmix */ -- GitLab From 9419fc1c87031390a594d4fe9c4987daf6e38b12 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:44:53 +0200 Subject: [PATCH 16/53] [cleanup] accept FIX_441_SBA_PARAMBIN_GAINS --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7324e4adfc..29a6d266b6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -156,7 +156,6 @@ -#define FIX_441_SBA_PARAMBIN_GAINS /* Nokia: Fix issue 441 by changing gains in SBA path of parametric binauralizer */ #define MC_PARAMUPMIX_MODE /* Dlb: Contribution 39: Multichannel Parametric Upmix */ #define FIX_469_BRSWITCH_PUPMIX /* Dlb: Fix issue 469 for Param Upmix bitrate switching */ -- GitLab From dfb5ff6579e2cbd81d9426316dd393b47f3b300d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:45:43 +0200 Subject: [PATCH 17/53] [cleanup] accept MC_PARAMUPMIX_MODE --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 29a6d266b6..8d33de3978 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,7 +157,6 @@ -#define MC_PARAMUPMIX_MODE /* Dlb: Contribution 39: Multichannel Parametric Upmix */ #define FIX_469_BRSWITCH_PUPMIX /* Dlb: Fix issue 469 for Param Upmix bitrate switching */ #define FIX_MASA_DELAY_PRINTOUT /* VA: issue 444: fix MASA decoder delay printout */ -- GitLab From 0280b6cdbc34901a88d5123d5069b198a71e2945 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:47:21 +0200 Subject: [PATCH 18/53] [cleanup] accept FIX_469_BRSWITCH_PUPMIX --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8d33de3978..43c96f9bfc 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,7 +157,6 @@ -#define FIX_469_BRSWITCH_PUPMIX /* Dlb: Fix issue 469 for Param Upmix bitrate switching */ #define FIX_MASA_DELAY_PRINTOUT /* VA: issue 444: fix MASA decoder delay printout */ #define HODIRAC /* FhG: Contribution 32: Sector-based HO-DirAC method for SBA at high bitrates */ -- GitLab From b41179349fbab06922ec4100e303a946bafb2ead Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:48:04 +0200 Subject: [PATCH 19/53] [cleanup] accept FIX_MASA_DELAY_PRINTOUT --- lib_com/options.h | 1 - lib_dec/lib_dec.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 43c96f9bfc..4351af7175 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,7 +157,6 @@ -#define FIX_MASA_DELAY_PRINTOUT /* VA: issue 444: fix MASA decoder delay printout */ #define HODIRAC /* FhG: Contribution 32: Sector-based HO-DirAC method for SBA at high bitrates */ #define DIRAC_ALLOC_HARM /* VA: harmonize DirAC parameters allocation/deallocation */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 76bb28480c..3f1c20643a 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1599,13 +1599,11 @@ ivas_error IVAS_DEC_GetDelay( nSamples[2] = (int16_t) roundf( (float) st_ivas->binaural_latency_ns * hDecoderConfig->output_Fs / 1000000000.f ); nSamples[0] = nSamples[1] + nSamples[2]; -#ifdef FIX_MASA_DELAY_PRINTOUT if ( st_ivas->ivas_format == MASA_FORMAT ) { /* note: in MASA, all delay is compensated at the decoder by default, so subtract the encoder delay for print-out */ nSamples[1] -= NS2SA( hDecoderConfig->output_Fs, IVAS_ENC_DELAY_NS ); } -#endif *timeScale = hDecoderConfig->output_Fs; -- GitLab From 629a817d92d1559a11e174d9d76835f92158b5dc Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:48:49 +0200 Subject: [PATCH 20/53] [cleanup] accept HODIRAC --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4351af7175..07219993b3 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,6 @@ -#define HODIRAC /* FhG: Contribution 32: Sector-based HO-DirAC method for SBA at high bitrates */ #define DIRAC_ALLOC_HARM /* VA: harmonize DirAC parameters allocation/deallocation */ -- GitLab From ffc6a2d3db2b18b26ea3e781c6019690bc715e28 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:49:34 +0200 Subject: [PATCH 21/53] [cleanup] accept DIRAC_ALLOC_HARM --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 07219993b3..4708230822 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,6 @@ -#define DIRAC_ALLOC_HARM /* VA: harmonize DirAC parameters allocation/deallocation */ #define COMPLEXITY_LEVEL_INDICATION -- GitLab From 49ceda62b64f00da3ed9b94d625fdca4e65d5572 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:50:10 +0200 Subject: [PATCH 22/53] [cleanup] accept COMPLEXITY_LEVEL_INDICATION --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4708230822..5ee9ab59f9 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,6 @@ -#define COMPLEXITY_LEVEL_INDICATION #define ARITH_HUFF_CODER_CHANGES /* DLB: Optimization of metadata memory for Huffman and arithmetic coders */ -- GitLab From 99ea4b1efef3a417ea2712194ad5ff1fe35dfb47 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:52:36 +0200 Subject: [PATCH 23/53] [cleanup] accept ARITH_HUFF_CODER_CHANGES --- lib_com/ivas_cnst.h | 4 -- lib_com/ivas_dirac_com.c | 58 ------------------------ lib_com/ivas_prot.h | 12 ----- lib_com/ivas_rom_com.c | 4 -- lib_com/ivas_spar_com.c | 8 ---- lib_com/ivas_stat_com.h | 2 - lib_com/options.h | 1 - lib_dec/ivas_spar_md_dec.c | 2 - lib_enc/ivas_entropy_coder.c | 86 ------------------------------------ lib_enc/ivas_sba_enc.c | 2 - lib_enc/ivas_spar_encoder.c | 8 ---- lib_enc/ivas_spar_md_enc.c | 83 ---------------------------------- 12 files changed, 270 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 3ba4c27c93..f4891c0a86 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1023,10 +1023,8 @@ typedef enum /* AGC constants */ #define AGC_BITS_PER_CH 3 #define AGC_EMAX 0 -#ifdef ARITH_HUFF_CODER_CHANGES #define AGC_SIGNALLING_BITS 1 #define IVAS_SPAR_ARITH_OVERSHOOT_BITS (16) -#endif /* Common SPAR metadata constants */ #define IVAS_ACTIVEW_DM_F_SCALE 0.5f @@ -1741,10 +1739,8 @@ typedef enum #define SPAR_DIRAC_DTX_BANDS ( SPAR_DTX_BANDS + DIRAC_DTX_BANDS ) #define CLDFB_PAR_WEIGHT_START_BAND 7 -#ifdef ARITH_HUFF_CODER_CHANGES #define QUANT_STRAT_0 0 #define QUANT_STRAT_2 2 -#endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 091215ac63..55d9911c3e 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -377,7 +377,6 @@ void ivas_dirac_config_bands( return; } -#ifdef ARITH_HUFF_CODER_CHANGES void ivas_get_dirac_sba_max_md_bits( const int32_t sba_total_brate, int16_t *bits_frame_nominal, @@ -440,7 +439,6 @@ void ivas_get_dirac_sba_max_md_bits( return; } -#endif /*------------------------------------------------------------------------- * ivas_dirac_sba_config() @@ -547,68 +545,12 @@ ivas_error ivas_dirac_sba_config( } #endif } -#ifdef ARITH_HUFF_CODER_CHANGES ivas_get_dirac_sba_max_md_bits( sba_total_brate, &hQMetaData->bits_frame_nominal, &hQMetaData->metadata_max_bits, &hQMetaData->qmetadata_max_bit_req, hQMetaData->q_direction[0].cfg.nbands ); -#else - if ( sba_total_brate <= IVAS_13k2 ) - { - hQMetaData->bits_frame_nominal = ACELP_9k60 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 70; - } - else if ( sba_total_brate <= IVAS_16k4 ) - { - hQMetaData->bits_frame_nominal = ACELP_13k20 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 80; - } - else if ( sba_total_brate <= IVAS_24k4 ) - { - hQMetaData->bits_frame_nominal = ACELP_16k40 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 103; - } - else if ( sba_total_brate <= IVAS_32k ) - { - hQMetaData->bits_frame_nominal = ACELP_32k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 214; - } - else if ( sba_total_brate <= IVAS_48k ) - { - hQMetaData->bits_frame_nominal = IVAS_48k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 240; - } - else if ( sba_total_brate <= IVAS_64k ) - { - hQMetaData->bits_frame_nominal = IVAS_64k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_80k ) - { - hQMetaData->bits_frame_nominal = IVAS_80k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_96k ) - { - hQMetaData->bits_frame_nominal = IVAS_96k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_128k ) - { - hQMetaData->bits_frame_nominal = IVAS_128k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 250; - } - else - { - hQMetaData->bits_frame_nominal = (int16_t) ( sba_total_brate / FRAMES_PER_SEC ); - hQMetaData->metadata_max_bits = MAX16B; /* no limit */ - } - - hQMetaData->metadata_max_bits = (int16_t) ceilf( (float) hQMetaData->metadata_max_bits * hQMetaData->q_direction[0].cfg.nbands / 5 ); - hQMetaData->qmetadata_max_bit_req = QMETADATA_MAXBIT_REQ_SBA >> 1; -#endif return error; #ifndef SBA_MODE_CLEAN_UP diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 211b3f3326..25b2fb3711 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -119,10 +119,8 @@ ivas_error ivas_spar_md_enc_init ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -#ifdef ARITH_HUFF_CODER_CHANGES int16_t ivas_sba_get_max_md_bits( Encoder_Struct *st_ivas ); -#endif void destroy_sce_enc( SCE_ENC_HANDLE hSCE /* i/o: SCE encoder structure */ @@ -3625,14 +3623,12 @@ void ivas_dirac_config_bands( IVAS_FB_MIXER_HANDLE hFbMdft ); -#ifdef ARITH_HUFF_CODER_CHANGES void ivas_get_dirac_sba_max_md_bits( const int32_t sba_total_brate, int16_t *bits_frame_nominal, int16_t *metadata_max_bits, int16_t *qmetadata_max_bit_req, int16_t nbands ); -#endif ivas_error ivas_dirac_sba_config( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ @@ -4499,13 +4495,11 @@ void ivas_spar_set_bitrate_config( ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ const int16_t table_idx, /* i : config. table index */ const int16_t num_bands /* i : number of bands */ -#ifdef ARITH_HUFF_CODER_CHANGES , const int16_t dirac2spar_md_flag, const int16_t enc_flag, const int16_t pca_flag, const int16_t agc_flag -#endif ); void ivas_spar_bitrate_dist( @@ -5027,15 +5021,9 @@ int16_t ivas_get_bits_to_encode( void ivas_huffman_encode( ivas_huffman_cfg_t *huff_cfg, int16_t in, int16_t *hcode, int16_t *hlen ); void ivas_spar_huff_coeffs_com_init( ivas_huff_coeffs_t *pHuff_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, const int16_t enc_dec ); void ivas_spar_arith_coeffs_com_init( ivas_arith_coeffs_t *pArith_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, const int16_t enc_dec ); -#ifdef ARITH_HUFF_CODER_CHANGES int16_t ivas_arith_encode_cmplx_cell_array( -#else -void ivas_arith_encode_cmplx_cell_array( -#endif ivas_arith_t *pArith_re, ivas_arith_t *pArith_re_diff, const int16_t *pDo_diff, const int16_t nB, int16_t *pSymbol_re, int16_t *pSymbol_old_re, ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, const int16_t any_diff -#ifdef ARITH_HUFF_CODER_CHANGES , int32_t wc_strat_arith -#endif ); ivas_error ivas_huffman_decode( ivas_huffman_cfg_t *huff_cfg, Decoder_State *st0, int16_t *dec_out ); void ivas_arith_decode_cmplx_cell_array( ivas_arith_t *pArith_re, ivas_arith_t *pArith_re_diff, Decoder_State *st0, ivas_cell_dim_t *pCell_dims, int16_t *pDo_diff, const int16_t nB, int16_t *pSymbol_re, int16_t *pSymbol_re_old ); diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 8f32d0067f..67ed4d80bb 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -936,11 +936,7 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] = { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } }, { { 31, 11, 11, 1 },{ 1, 1, 1, 1 }, -#ifdef ARITH_HUFF_CODER_CHANGES { 1, 1, 1, 1 } -#else - { 31, 1, 1, 1 } -#endif }, 1, 2, 0 }, { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } }, // not yet optimized diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 8e7da38580..f8f3fa1209 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -2132,27 +2132,23 @@ void ivas_spar_set_bitrate_config( ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ const int16_t table_idx, /* i : config. table index */ const int16_t num_bands /* i : number of bands */ -#ifdef ARITH_HUFF_CODER_CHANGES , const int16_t dirac2spar_md_flag, const int16_t enc_flag, const int16_t pca_flag, const int16_t agc_flag -#endif ) { int32_t ivas_total_brate; int16_t i, total_bits, max_bits, code, length; int16_t sba_order; int16_t md_coding_bits_header; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t agc_bits, pca_bits, num_PR_bits_dirac_bands; int16_t bits_PR, bits_C, bits_P; int16_t wc_coarse_strat; int16_t n_input, n_dmx, n_dec; int16_t quant_strat; int16_t bands_bw; -#endif pSpar_md_cfg->nchan_transport = ivas_spar_br_table_consts[table_idx].nchan_transport; for ( i = 0; i < pSpar_md_cfg->nchan_transport; i++ ) @@ -2191,7 +2187,6 @@ void ivas_spar_set_bitrate_config( pSpar_md_cfg->tgt_bits_per_blk -= md_coding_bits_header; pSpar_md_cfg->max_bits_per_blk -= md_coding_bits_header; -#ifdef ARITH_HUFF_CODER_CHANGES if ( ivas_total_brate < IVAS_24k4 ) { bands_bw = 2; @@ -2200,7 +2195,6 @@ void ivas_spar_set_bitrate_config( { bands_bw = 1; } -#endif pSpar_md_cfg->tgt_bits_per_blk = (int16_t) ceilf( ( 1.0f * pSpar_md_cfg->tgt_bits_per_blk * num_bands ) / IVAS_MAX_NUM_BANDS ); pSpar_md_cfg->max_bits_per_blk = (int16_t) ceilf( ( 1.0f * pSpar_md_cfg->max_bits_per_blk * num_bands ) / IVAS_MAX_NUM_BANDS ); @@ -2208,7 +2202,6 @@ void ivas_spar_set_bitrate_config( pSpar_md_cfg->tgt_bits_per_blk += md_coding_bits_header; pSpar_md_cfg->max_bits_per_blk += md_coding_bits_header; -#ifdef ARITH_HUFF_CODER_CHANGES if ( enc_flag ) { /*calculate the actual worst case bits*/ @@ -2275,7 +2268,6 @@ void ivas_spar_set_bitrate_config( } pSpar_md_cfg->max_md_bits_spar = pSpar_md_cfg->max_bits_per_blk + agc_bits + pca_bits; } -#endif return; } diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index c4be5a6c63..fe261ef6e8 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -265,9 +265,7 @@ typedef struct ivas_spar_md_com_cfg int16_t agc_bits_ch_idx; int16_t planarCP; int16_t num_umx_chs; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t max_md_bits_spar; -#endif } ivas_spar_md_com_cfg; diff --git a/lib_com/options.h b/lib_com/options.h index 5ee9ab59f9..07a234e8c0 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,7 +162,6 @@ -#define ARITH_HUFF_CODER_CHANGES /* DLB: Optimization of metadata memory for Huffman and arithmetic coders */ #define FIX_463_TD_RENDERER_DIRECTIVITY_RESET /* Eri: Remove unintentional reset of directivity pattern */ #define FIX_642 /* FhG: Fix for issue 642, buggy DoA-array access in DirAC head rotation*/ diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 03f014ecfd..86fcaa1faf 100755 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -487,11 +487,9 @@ ivas_error ivas_spar_md_dec_init( hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, hMdDec->spar_md.num_bands -#ifdef ARITH_HUFF_CODER_CHANGES , hMdDec->spar_hoa_dirac2spar_md_flag, 0, 0, 0 -#endif ); nchan_transport = hMdDec->spar_md_cfg.nchan_transport; diff --git a/lib_enc/ivas_entropy_coder.c b/lib_enc/ivas_entropy_coder.c index 830a05e41a..02f3f1bea2 100644 --- a/lib_enc/ivas_entropy_coder.c +++ b/lib_enc/ivas_entropy_coder.c @@ -128,19 +128,13 @@ static ivas_error ivas_get_dyn_freq_model( * * Arith encoding of an array of symbols *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_arith_encode_array( -#else -static void ivas_arith_encode_array( -#endif int16_t *pInput, ivas_arith_t *pArith, BSTR_ENC_HANDLE hMetaData, const int16_t in_len -#ifdef ARITH_HUFF_CODER_CHANGES , int32_t wc_strat_arith -#endif ) { int16_t model_index, i, ind; @@ -152,12 +146,10 @@ static void ivas_arith_encode_array( if ( pArith->dyn_model_bits > 0 ) { ivas_get_dyn_freq_model( pInput, in_len, &model_index, pArith, &pCum_freq ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + pArith->dyn_model_bits ) > wc_strat_arith ) { return -1; } -#endif push_next_indice( hMetaData, model_index, pArith->dyn_model_bits ); } else @@ -172,27 +164,19 @@ static void ivas_arith_encode_array( ind = pInput[i] - pArith->vals[0]; ivas_ari_encode_14bits_ext( hMetaData, &as, ind, (const uint16_t *) pCum_freq ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( hMetaData->nb_bits_tot > wc_strat_arith ) { return -1; } -#endif } ivas_ari_done_encoding_14bits( hMetaData, &as ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( hMetaData->nb_bits_tot > wc_strat_arith ) { return -1; } -#endif } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -201,26 +185,18 @@ static void ivas_arith_encode_array( * * Differential arith encoding *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_arithCoder_encode_array_diff( -#else -static void ivas_arithCoder_encode_array_diff( -#endif ivas_arith_t *pArith_diff, int16_t *pIn_new, int16_t *pIn_old_scratch, const int16_t length, BSTR_ENC_HANDLE hMetaData -#ifdef ARITH_HUFF_CODER_CHANGES , int32_t wc_strat_arith -#endif ) { int16_t n; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif if ( length > 0 ) { @@ -231,22 +207,14 @@ static void ivas_arithCoder_encode_array_diff( ivas_wrap_arround( pIn_old_scratch, pArith_diff->vals[0], pArith_diff->vals[pArith_diff->range - 1], length ); -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_array( pIn_old_scratch, pArith_diff, hMetaData, length, wc_strat_arith ); if ( arith_result < 0 ) { return -1; } -#else - ivas_arith_encode_array( pIn_old_scratch, pArith_diff, hMetaData, length ); -#endif } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -280,27 +248,19 @@ void ivas_huffman_encode( * * Arithmetic encode a cell array *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t arith_encode_cell_array( -#else -static void arith_encode_cell_array( -#endif ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, const int16_t nB, ivas_arith_t *pArith, int16_t *pSymbol -#ifdef ARITH_HUFF_CODER_CHANGES , int32_t wc_strat_arith -#endif ) { int16_t total_symbol_len = 0; int16_t i; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif for ( i = 0; i < nB; i++ ) { @@ -313,24 +273,16 @@ static void arith_encode_cell_array( { if ( pArith->range > 1 ) { -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_array( pSymbol, pArith, hMetaData, total_symbol_len, wc_strat_arith ); if ( arith_result < 0 ) { return -1; } -#else - ivas_arith_encode_array( pSymbol, pArith, hMetaData, total_symbol_len ); -#endif } } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -339,27 +291,19 @@ static void arith_encode_cell_array( * * Arithmetic encode a cell array - differential *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t arith_encode_cell_array_diff( -#else -static void arith_encode_cell_array_diff( -#endif const ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, int16_t nB, ivas_arith_t *pArith_diff, int16_t *pSymbol_old, int16_t *pSymbol -#ifdef ARITH_HUFF_CODER_CHANGES , int32_t wc_strat_arith -#endif ) { int16_t i, total_symbol_len; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif total_symbol_len = 0; for ( i = 0; i < nB; i++ ) @@ -373,24 +317,16 @@ static void arith_encode_cell_array_diff( { if ( pArith_diff->range > 1 ) { -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arithCoder_encode_array_diff( pArith_diff, pSymbol, pSymbol_old, total_symbol_len, hMetaData, wc_strat_arith ); if ( arith_result < 0 ) { return -1; } -#else - ivas_arithCoder_encode_array_diff( pArith_diff, pSymbol, pSymbol_old, total_symbol_len, hMetaData ); -#endif } } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -399,11 +335,7 @@ static void arith_encode_cell_array_diff( * * Arithmetic encode a cell array *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES int16_t ivas_arith_encode_cmplx_cell_array( -#else -void ivas_arith_encode_cmplx_cell_array( -#endif ivas_arith_t *pArith_re, ivas_arith_t *pArith_re_diff, const int16_t *pDo_diff, @@ -413,10 +345,8 @@ void ivas_arith_encode_cmplx_cell_array( ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, const int16_t any_diff -#ifdef ARITH_HUFF_CODER_CHANGES , int32_t wc_strat_arith -#endif ) { int16_t input_old[IVAS_MAX_INPUT_LEN]; @@ -425,9 +355,7 @@ void ivas_arith_encode_cmplx_cell_array( ivas_cell_dim_t cell_dim[IVAS_MAX_NUM_BANDS], cell_dim_diff[IVAS_MAX_NUM_BANDS]; int16_t len, idx, i, j, idx1; int16_t total_len; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif idx1 = 0; if ( any_diff == 1 ) @@ -493,7 +421,6 @@ void ivas_arith_encode_cmplx_cell_array( }*/ #endif -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = arith_encode_cell_array( cell_dim, hMetaData, nB, pArith_re, input, wc_strat_arith ); if ( arith_result < 0 ) @@ -507,30 +434,17 @@ void ivas_arith_encode_cmplx_cell_array( { return -1; } -#else - arith_encode_cell_array( cell_dim, hMetaData, nB, pArith_re, input ); - - arith_encode_cell_array_diff( cell_dim_diff, hMetaData, nB, pArith_re_diff, input_old, input_new ); -#endif } else { -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = arith_encode_cell_array( pCell_dims, hMetaData, nB, pArith_re, pSymbol_re, wc_strat_arith ); if ( arith_result < 0 ) { return -1; } -#else - arith_encode_cell_array( pCell_dims, hMetaData, nB, pArith_re, pSymbol_re ); -#endif } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index e01de98741..c26f8e9983 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -285,7 +285,6 @@ ivas_error ivas_sba_enc_reconfigure( return error; } -#ifdef ARITH_HUFF_CODER_CHANGES int16_t ivas_sba_get_max_md_bits( Encoder_Struct *st_ivas ) { @@ -310,4 +309,3 @@ int16_t ivas_sba_get_max_md_bits( } return max_md_bits; } -#endif diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 5956ef03dd..4d4ed1ef6d 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -454,17 +454,13 @@ static ivas_error ivas_spar_enc_process( #endif int16_t nchan_fb_in; -#ifdef ARITH_HUFF_CODER_CHANGES /*Commented for now*/ /*int16_t start_nb_bits; int16_t total_md_bits, total_sba_bits;*/ -#endif push_wmops( "ivas_spar_enc_process" ); -#ifdef ARITH_HUFF_CODER_CHANGES /*Commented for now*/ // start_nb_bits = hMetaData->nb_bits_tot; -#endif /*-----------------------------------------------------------------------------------------* * Initialization @@ -681,12 +677,10 @@ static ivas_error ivas_spar_enc_process( { ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND -#ifdef ARITH_HUFF_CODER_CHANGES , hSpar->hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, hSpar->AGC_Enable -#endif ); } } @@ -1048,12 +1042,10 @@ static ivas_error ivas_spar_enc_process( pop_wmops(); -#ifdef ARITH_HUFF_CODER_CHANGES /*Commented for now*/ /*total_md_bits = hMetaData->nb_bits_tot - start_nb_bits; total_sba_bits = ivas_sba_get_max_md_bits( st_ivas ); assert( total_md_bits <= total_sba_bits );*/ -#endif return error; } diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 50ef2f0348..38d9a52810 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -71,16 +71,8 @@ static void ivas_band_mixer( float *cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], static void ivas_get_band_differential_index( ivas_band_coeffs_ind_t *pBand_idx, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const int16_t complex_cov, const int16_t dim, const ivas_coeffs_type_t coeff_type ); -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t bands_bw ); -#else -static void ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t bands_bw ); -#endif -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); -#else -static void ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); -#endif static ivas_error ivas_spar_set_enc_config( ivas_spar_md_enc_state_t *hMdEnc, int16_t *max_freq_per_chan, const int16_t nchan_transport, float *pFC, const int16_t nchan_inp ); @@ -328,7 +320,6 @@ ivas_error ivas_spar_md_enc_init( ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND -#ifdef ARITH_HUFF_CODER_CHANGES , hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, @@ -338,7 +329,6 @@ ivas_error ivas_spar_md_enc_init( ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, ivas_spar_br_table_consts[table_idx].nchan_transport ) #endif -#endif ); /* get FB coefficients */ @@ -595,22 +585,16 @@ ivas_error ivas_spar_md_enc_process( int16_t last_ind_start; #endif BSTR_ENC_DATA hMetaData_tmp; -#ifdef ARITH_HUFF_CODER_CHANGES Indice *ind_list_tmp; int16_t md_indices_allocated; -#else - Indice ind_list_tmp[MAX_BITS_METADATA]; // IVAS_fmToDo: size to be optimized -#endif #ifdef IND_LIST_DYN int16_t max_num_indices_tmp; #endif float Wscale[IVAS_MAX_NUM_BANDS]; -#ifdef ARITH_HUFF_CODER_CHANGES /*extra 16 bits for arithmetic coder as overshoot check is after a symbol is written*/ md_indices_allocated = hMdEnc->spar_md_cfg.max_bits_per_blk + IVAS_SPAR_ARITH_OVERSHOOT_BITS; ind_list_tmp = (Indice *) malloc( sizeof( Indice ) * md_indices_allocated ); -#endif num_quant_strats = hMdEnc->spar_md_cfg.num_quant_strats; num_ch = ivas_sba_get_nchan_metadata( sba_order, @@ -978,17 +962,11 @@ ivas_error ivas_spar_md_enc_process( strat = cs[i]; if ( strat != NO_STRAT ) { -#ifdef ARITH_HUFF_CODER_CHANGES reset_indices_enc( &hMetaData_tmp, md_indices_allocated ); -#else - reset_indices_enc( &hMetaData_tmp, MAX_BITS_METADATA ); -#endif ivas_write_spar_md_bitstream( hMdEnc, num_bands, bands_bw, &hMetaData_tmp, hEncoderConfig->ivas_total_brate, strat, qsi, planarCP ); -#ifdef ARITH_HUFF_CODER_CHANGES /*write to main buffer if its a valid bitstream*/ if ( hMetaData_tmp.nb_bits_tot > 0 ) { -#endif if ( hMetaData->nb_bits_tot == bit_pos_start || hMetaData_tmp.nb_bits_tot < ( hMetaData->nb_bits_tot - bit_pos_start ) ) { write_metadata_buffer( &hMetaData_tmp, hMetaData, bit_pos_start, next_ind_start @@ -1016,27 +994,21 @@ ivas_error ivas_spar_md_enc_process( break; } -#ifdef ARITH_HUFF_CODER_CHANGES /*only if valid bitstream was written to main buffer*/ if ( hMetaData->nb_bits_tot > bit_pos_start ) -#endif { if ( hMetaData->nb_bits_tot - bit_pos_start + ( ( ( hEncoderConfig->ivas_total_brate == IVAS_256k ) && ( sba_order == SBA_FOA_ORDER ) ) ? 1 : 0 ) <= hMdEnc->spar_md_cfg.max_bits_per_blk ) { -#ifdef ARITH_HUFF_CODER_CHANGES packed_ok = 1; -#endif break; } } } -#ifdef ARITH_HUFF_CODER_CHANGES if ( dtx_vad == 1 ) { assert( packed_ok == 1 ); } -#endif if ( hEncoderConfig->ivas_total_brate >= IVAS_256k ) { assert( qsi == 0 ); @@ -1279,9 +1251,7 @@ ivas_error ivas_spar_md_enc_process( hMdEnc->spar_md.dtx_vad = dtx_vad; hMdEnc->spar_md.num_bands = num_bands; -#ifdef ARITH_HUFF_CODER_CHANGES free( ind_list_tmp ); -#endif return IVAS_ERR_OK; } @@ -1352,9 +1322,7 @@ static void ivas_write_spar_md_bitstream( { int16_t no_ec, i; int16_t do_diff[IVAS_MAX_NUM_BANDS]; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t entropy_coding_result; -#endif if ( strat == NO_STRAT ) { @@ -1459,28 +1427,22 @@ static void ivas_write_spar_md_bitstream( #endif if ( no_ec == 1 ) { -#ifdef ARITH_HUFF_CODER_CHANGES entropy_coding_result = -#endif ivas_get_huffman_coded_bs( hMdEnc, hMetaData, nB, qsi, planarCP, bands_bw ); } else { -#ifdef ARITH_HUFF_CODER_CHANGES entropy_coding_result = -#endif ivas_get_arith_coded_bs( hMdEnc, hMetaData, do_diff, bands_bw, nB, qsi, planarCP, strat, ivas_total_brate ); } -#ifdef ARITH_HUFF_CODER_CHANGES if ( entropy_coding_result < 0 ) { hMetaData->nb_bits_tot = 0; } -#endif return; } @@ -1491,11 +1453,7 @@ static void ivas_write_spar_md_bitstream( * * Generate huffman coded bitstream *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_get_huffman_coded_bs( -#else -static void ivas_get_huffman_coded_bs( -#endif ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, @@ -1528,12 +1486,10 @@ static void ivas_get_huffman_coded_bs( for ( j = pred_offset; j < pred_coeff_dim; j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.pred_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].pred_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } @@ -1542,12 +1498,10 @@ static void ivas_get_huffman_coded_bs( if ( keep_planar[(int16_t) floor( j / ( ndm - 1 ) )] ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.drct_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].drct_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } } @@ -1557,12 +1511,10 @@ static void ivas_get_huffman_coded_bs( if ( keep_planar[j] ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.decd_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].decd_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } } @@ -1572,46 +1524,36 @@ static void ivas_get_huffman_coded_bs( for ( j = pred_offset; j < pred_coeff_dim; j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.pred_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].pred_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } for ( j = 0; j < ndec * ( ndm - 1 ); j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.drct_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].drct_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } for ( j = 0; j < ndec; j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.decd_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].decd_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } } } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -1620,11 +1562,7 @@ static void ivas_get_huffman_coded_bs( * * Generate arithmetic coded bitstream *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_get_arith_coded_bs( -#else -static void ivas_get_arith_coded_bs( -#endif ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, @@ -1643,9 +1581,7 @@ static void ivas_get_arith_coded_bs( ivas_cell_dim_t decx_cell_dims[IVAS_MAX_NUM_BANDS]; int16_t symbol_arr_re[IVAS_MAX_INPUT_LEN]; int16_t symbol_arr_old_re[IVAS_MAX_INPUT_LEN]; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif for ( i = 0; i < nB; i++ ) { @@ -1720,7 +1656,6 @@ static void ivas_get_arith_coded_bs( ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); } -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.pred_arith_re[qsi], &hMdEnc->arith_coeffs.pred_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, pred_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); @@ -1728,10 +1663,6 @@ static void ivas_get_arith_coded_bs( { return -1; } -#else - ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.pred_arith_re[qsi], &hMdEnc->arith_coeffs.pred_arith_re_diff[qsi], pDo_diff, nB, - symbol_arr_re, symbol_arr_old_re, pred_cell_dims, hMetaData, any_diff ); -#endif if ( hMdEnc->spar_hoa_md_flag && hMdEnc->spar_hoa_dirac2spar_md_flag ) { @@ -1773,7 +1704,6 @@ static void ivas_get_arith_coded_bs( } } -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.drct_arith_re[qsi], &hMdEnc->arith_coeffs.drct_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, drct_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); @@ -1781,10 +1711,6 @@ static void ivas_get_arith_coded_bs( { return -1; } -#else - ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.drct_arith_re[qsi], &hMdEnc->arith_coeffs.drct_arith_re_diff[qsi], pDo_diff, nB, - symbol_arr_re, symbol_arr_old_re, drct_cell_dims, hMetaData, any_diff ); -#endif ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF, planarCP ); @@ -1801,7 +1727,6 @@ static void ivas_get_arith_coded_bs( decd_cell_dims[i].dim1 = decd_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.decd_arith_re[qsi], &hMdEnc->arith_coeffs.decd_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, decd_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); @@ -1809,10 +1734,6 @@ static void ivas_get_arith_coded_bs( { return -1; } -#else - ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.decd_arith_re[qsi], &hMdEnc->arith_coeffs.decd_arith_re_diff[qsi], pDo_diff, nB, - symbol_arr_re, symbol_arr_old_re, decd_cell_dims, hMetaData, any_diff ); -#endif ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF, planarCP ); @@ -1822,11 +1743,7 @@ static void ivas_get_arith_coded_bs( ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF, planarCP ); } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } -- GitLab From 621a3a43375bb6e8064de744930286bc2a300092 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 21:53:43 +0200 Subject: [PATCH 24/53] [cleanup] accept FIX_463_TD_RENDERER_DIRECTIVITY_RESET --- lib_com/options.h | 1 - lib_rend/ivas_objectRenderer.c | 7 ------- lib_rend/lib_rend.c | 2 -- 3 files changed, 10 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 07a234e8c0..b856ce09ca 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,6 @@ -#define FIX_463_TD_RENDERER_DIRECTIVITY_RESET /* Eri: Remove unintentional reset of directivity pattern */ #define FIX_642 /* FhG: Fix for issue 642, buggy DoA-array access in DirAC head rotation*/ #define FIX_443_FD_CNG_INIT /* FhG: correct bitrate value for FD-CNG init */ #define VARIABLE_SPEED_DECODING /* FhG: Contribution 37: variable speed decoding employing the JBM functioniality */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 1b6f2eeccc..cb71f5b731 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -477,13 +477,6 @@ void TDREND_Update_object_positions( angles_to_vec( hIsmMetaData[nS]->radius, hIsmMetaData[nS]->azimuth, hIsmMetaData[nS]->elevation, Pos ); angles_to_vec( 1.0f, hIsmMetaData[nS]->yaw, hIsmMetaData[nS]->pitch, Dir ); -#ifndef FIX_463_TD_RENDERER_DIRECTIVITY_RESET - - /* Source directivity info */ - DirAtten_p->ConeInnerAngle = 360.0f; - DirAtten_p->ConeOuterAngle = 360.0f; - DirAtten_p->ConeOuterGain = 1.0f; -#endif TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4551426e2a..3810cb1918 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3794,9 +3794,7 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->room_acoustics.nBands = hRCin->roomAcoustics.nBands; hRCout->room_acoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; hRCout->room_acoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; -#ifdef FIX_463_TD_RENDERER_DIRECTIVITY_RESET mvr2r( hRCin->directivity, hRCout->directivity, 3 ); -#endif mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->room_acoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); -- GitLab From 9441545adbeba0f6394c6f4e45707b0f785bb6a5 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:01:08 +0200 Subject: [PATCH 25/53] [cleanup] accept FIX_642 --- lib_com/options.h | 1 - lib_dec/ivas_dirac_dec.c | 31 +------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b856ce09ca..2ccdd37eb4 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,6 @@ -#define FIX_642 /* FhG: Fix for issue 642, buggy DoA-array access in DirAC head rotation*/ #define FIX_443_FD_CNG_INIT /* FhG: correct bitrate value for FD-CNG init */ #define VARIABLE_SPEED_DECODING /* FhG: Contribution 37: variable speed decoding employing the JBM functioniality */ #define JBM_TSM_ON_TCS /* FhG: Contribution 37: run the TSM part of JBM on the TCs instead of the final output pcm waveforms */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 502420781f..00f0c6ad9a 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2812,28 +2812,6 @@ void ivas_dirac_dec_render_sf( #endif #ifdef JBM_TSM_ON_TCS /* Another workaround for self test BE */ -#ifndef FIX_642 - if ( st_ivas->hHeadTrackData && st_ivas->hDecoderConfig->voip_active == 0 ) - { - QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); - - p_Rmat = &st_ivas->hHeadTrackData->Rmat[0][0]; - - if ( st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - index_slot = slot_idx_start + slot_idx; - rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); - } - } - } - else - { - p_Rmat = 0; - } -#endif /* copy parameters into local buffers*/ #ifdef FIX_393_459_460_SBA_MD @@ -2880,9 +2858,6 @@ void ivas_dirac_dec_render_sf( #ifdef JBM_TSM_ON_TCS if ( st_ivas->hHeadTrackData -#ifndef FIX_642 - && st_ivas->hDecoderConfig->voip_active == 1 -#endif ) #else if ( st_ivas->hHeadTrackData ) @@ -2919,11 +2894,7 @@ void ivas_dirac_dec_render_sf( #endif } } -#if defined( JBM_TSM_ON_TCS ) & !defined( FIX_642 ) - else if ( !st_ivas->hHeadTrackData ) -#else - else -#endif + else { p_Rmat = 0; } -- GitLab From 87f3ba37cea3a5a928f4b10a2a554773351f16ef Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:01:52 +0200 Subject: [PATCH 26/53] [cleanup] accept FIX_443_FD_CNG_INIT --- lib_com/options.h | 1 - lib_enc/ivas_core_pre_proc_front.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2ccdd37eb4..8382fe7b39 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,6 @@ -#define FIX_443_FD_CNG_INIT /* FhG: correct bitrate value for FD-CNG init */ #define VARIABLE_SPEED_DECODING /* FhG: Contribution 37: variable speed decoding employing the JBM functioniality */ #define JBM_TSM_ON_TCS /* FhG: Contribution 37: run the TSM part of JBM on the TCs instead of the final output pcm waveforms */ #define FIX_DTX_428 /* FhG: fix for issue 428, crash with DTX and bitrate switching */ diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 5f775d2403..3552ee7790 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -563,14 +563,10 @@ ivas_error pre_proc_front_ivas( if ( st->hFdCngEnc != NULL && ( st->ini_frame == 0 || last_element_brate != element_brate || st->last_bwidth != st->bwidth ) ) { -#ifdef FIX_443_FD_CNG_INIT int32_t total_brate; total_brate = ( element_mode == IVAS_SCE ) ? st->total_brate : st->bits_frame_nominal * FRAMES_PER_SEC; configureFdCngEnc( st->hFdCngEnc, max( st->input_bwidth, WB ), total_brate ); -#else - configureFdCngEnc( st->hFdCngEnc, max( st->input_bwidth, WB ), st->bits_frame_nominal * FRAMES_PER_SEC ); -#endif if ( hCPE != NULL ) { st->hFdCngEnc->hFdCngCom->CngBitrate = hCPE->element_brate - 1; -- GitLab From a421d71558296e5ae3a36448805cb3815be71317 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:05:31 +0200 Subject: [PATCH 27/53] [cleanup] accept JBM_TSM_ON_TCS --- apps/decoder.c | 45 --- lib_com/fd_cng_com.c | 2 - lib_com/ivas_cnst.h | 6 - lib_com/ivas_prot.h | 129 ------ lib_com/ivas_stat_com.h | 2 - lib_com/ivas_td_decorr.c | 16 - lib_com/ivas_tools.c | 10 - lib_com/options.h | 19 +- lib_com/prot.h | 6 - lib_com/tools.c | 8 - lib_dec/fd_cng_dec.c | 88 ---- lib_dec/ivas_binRenderer_internal.c | 60 --- lib_dec/ivas_dec.c | 135 ------- lib_dec/ivas_dirac_dec.c | 265 ------------ lib_dec/ivas_dirac_output_synthesis_cov.c | 45 --- lib_dec/ivas_dirac_output_synthesis_dec.c | 121 ------ lib_dec/ivas_init_dec.c | 27 -- lib_dec/ivas_ism_dec.c | 26 -- lib_dec/ivas_ism_dtx_dec.c | 4 - lib_dec/ivas_ism_param_dec.c | 181 --------- lib_dec/ivas_ism_renderer.c | 18 - lib_dec/ivas_jbm_dec.c | 2 - lib_dec/ivas_masa_dec.c | 57 --- lib_dec/ivas_mc_param_dec.c | 402 ------------------- lib_dec/ivas_mct_dec.c | 26 -- lib_dec/ivas_objectRenderer_internal.c | 6 - lib_dec/ivas_out_setup_conversion.c | 18 - lib_dec/ivas_sba_dec.c | 10 - lib_dec/ivas_sba_rendering_internal.c | 56 --- lib_dec/ivas_spar_decoder.c | 178 -------- lib_dec/ivas_spar_md_dec.c | 4 - lib_dec/ivas_stat_dec.h | 30 -- lib_dec/jbm_jb4sb.h | 2 - lib_dec/jbm_pcmdsp_apa.c | 104 ----- lib_dec/jbm_pcmdsp_apa.h | 6 - lib_dec/jbm_pcmdsp_fifo.c | 2 - lib_dec/jbm_pcmdsp_fifo.h | 2 - lib_dec/jbm_pcmdsp_similarityestimation.c | 42 -- lib_dec/jbm_pcmdsp_similarityestimation.h | 16 - lib_dec/jbm_pcmdsp_window.c | 30 -- lib_dec/jbm_pcmdsp_window.h | 4 - lib_dec/lib_dec.c | 231 ----------- lib_dec/lib_dec.h | 6 - lib_rend/ivas_crend.c | 23 -- lib_rend/ivas_dirac_dec_binaural_functions.c | 137 ------- lib_rend/ivas_limiter.c | 4 - lib_rend/ivas_objectRenderer.c | 22 - lib_rend/ivas_prot_rend.h | 41 -- lib_rend/ivas_reverb.c | 69 ---- lib_rend/ivas_rotation.c | 24 -- lib_rend/ivas_sba_rendering.c | 40 -- lib_rend/lib_rend.c | 64 --- 52 files changed, 1 insertion(+), 2870 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 5eb46f618c..db3aad3740 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -82,9 +82,7 @@ static #ifdef VARIABLE_SPEED_DECODING #define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20 #endif -#ifdef JBM_TSM_ON_TCS #define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20 -#endif typedef struct { @@ -136,12 +134,10 @@ typedef struct char *tsmScaleFileName; uint16_t tsmScale; #endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION uint16_t frontendFetchSizeMs; #endif #endif -#endif } DecArguments; @@ -389,7 +385,6 @@ int main( goto cleanup; } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------------------------------* * Configure VoIP mode *------------------------------------------------------------------------------------------*/ @@ -414,7 +409,6 @@ int main( } #endif #endif -#endif #ifdef DEBUGGING /*-----------------------------------------------------------------* @@ -642,17 +636,6 @@ int main( if ( arg.voipMode ) { -#ifndef JBM_TSM_ON_TCS -#ifdef VARIABLE_SPEED_DECODING - if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VOIP, 100, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) -#endif - { - fprintf( stderr, "\nCould not enable VOIP: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } -#endif error = decodeVoIP( arg, hBsReader, hIvasDec ); } #ifdef VARIABLE_SPEED_DECODING @@ -905,11 +888,9 @@ static bool parseCmdlIVAS_dec( arg->tsmScaleFileEnabled = false; arg->tsmScaleFileName = NULL; #endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION arg->frontendFetchSizeMs = JBM_FRONTEND_FETCH_FRAMESIZE_MS; #endif -#endif #ifdef DEBUG_JBM_CMD_OPTION arg->noBadFrameDelay = false; #endif @@ -1078,7 +1059,6 @@ static bool parseCmdlIVAS_dec( } } #endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION else if ( strcmp( argv_to_upper, "-VOIP_FRAMESIZE" ) == 0 ) { @@ -1099,7 +1079,6 @@ static bool parseCmdlIVAS_dec( } } #endif -#endif #endif /* #ifdef DEBUGGING */ else if ( strcmp( argv_to_upper, "-MIME" ) == 0 ) @@ -1388,11 +1367,9 @@ static void usage_dec( void ) fprintf( stdout, "-VS fac : Variable Speed mode: change speed of playout fac as integer in percent.\n" ); fprintf( stdout, " 50 <= fac <= 150; fac<100 faster, fac>100 slower\n" ); #endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION fprintf( stdout, "-VOIP_framesize : VoIP mode: acoustic frontend fetch frame size (must be multiples of 5!)\n" ); #endif -#endif #endif fprintf( stdout, "-fec_cfg_file : Optimal channel aware configuration computed by the JBM \n" ); fprintf( stdout, " as described in Section 6.3.1 of TS26.448. The output is \n" ); @@ -2077,10 +2054,8 @@ static ivas_error decodeVoIP( uint32_t nextPacketRcvTime_ms = 0; uint32_t systemTime_ms = 0; -#ifdef JBM_TSM_ON_TCS uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; int32_t nFramesWritten = 0; -#endif int32_t nFramesFed = 0; @@ -2216,26 +2191,18 @@ static ivas_error decodeVoIP( * Main receiving/decoding loop *------------------------------------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION systemTimeInc_ms = arg.frontendFetchSizeMs; -#endif #endif while ( 1 ) { int16_t nOutSamples = 0; -#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) uint16_t nSamplesAvailableNext = 0; -#endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs ); #else nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS ); -#endif -#else - nOutSamples = (int16_t) ( arg.output_Fs / 50 ); #endif /* read all packets with a receive time smaller than the system time */ while ( nextPacketRcvTime_ms <= systemTime_ms ) @@ -2280,12 +2247,8 @@ static ivas_error decodeVoIP( /* we are finished when all packets have been received and jitter buffer is empty */ /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */ -#ifdef JBM_TSM_ON_TCS /* last clause should make sure that for BE tests we end up with the same number of samples...*/ if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) ) -#else - if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec ) || nFramesFed < 2 ) ) -#endif { break; } @@ -2293,10 +2256,8 @@ static ivas_error decodeVoIP( /* decode and get samples */ if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms -#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) , &nSamplesAvailableNext -#endif #ifdef SUPPORT_JBM_TRACEFILE , writeJbmTraceFileFrameWrapper, @@ -2386,7 +2347,6 @@ static ivas_error decodeVoIP( delayNumSamples -= nOutSamples; } -#ifdef JBM_TSM_ON_TCS /* Write ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { @@ -2433,7 +2393,6 @@ static ivas_error decodeVoIP( } } } -#endif } if ( !arg.quietModeEnabled ) @@ -2442,12 +2401,8 @@ static ivas_error decodeVoIP( } frame++; -#ifdef JBM_TSM_ON_TCS systemTime_ms += systemTimeInc_ms; nFramesWritten++; -#else - systemTime_ms += 20; -#endif #ifdef WMOPS update_mem(); diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index f0408ea3dd..dd82c4f06b 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -941,7 +941,6 @@ void SynthesisSTFT( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------- * SynthesisSTFT_dirac() * @@ -1007,7 +1006,6 @@ void SynthesisSTFT_dirac( return; } -#endif /*------------------------------------------------------------------- diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index f4891c0a86..9c657f69e7 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -203,7 +203,6 @@ typedef enum #define IVAS_NUM_SUPPORTED_FS 3 /* number of supported sampling-rates in IVAS */ -#ifdef JBM_TSM_ON_TCS #define CLDFB_SLOT_NS 1250000L /* 1.25ms: CLDFB slot length */ #define MAX_JBM_SUBFRAMES_5MS 8 #define DEFAULT_JBM_SUBFRAMES_5MS 4 @@ -221,7 +220,6 @@ typedef enum TC_BUFFER_MODE_RENDERER, TC_BUFFER_MODE_BUFFER } TC_BUFFER_MODE; -#endif /*----------------------------------------------------------------------------------* * IVAS Bitrates @@ -1393,11 +1391,7 @@ typedef enum #define PARAM_MC_REG_GHAT (0.001f) /* Regularization factor for mixing matrix calculation */ #define PARAM_MC_MAX_PARAMETER_BANDS 20 /* Maximum number of parameter bands */ #define PARAM_MC_MAX_PARAMETER_BANDS_RES 14 /* Maximum number of parameter bands with decorrelation */ -#ifdef JBM_TSM_ON_TCS #define PARAM_MC_MAX_NSLOTS MAX_JBM_CLDFB_TIMESLOTS /* Maximum number of CLDFB slots in a frame */ -#else -#define PARAM_MC_MAX_NSLOTS 16 /* Maximum number of CLDFB slots in a frame */ -#endif #define PARAM_MC_MAX_NSLOTS_IN_SUBFRAME 4 /* Maximum number of CLDFB slots in a subframe */ #define PARAM_MC_NSUBFRAMES_DEC 4 /* Number of subframes for the synthesis in the decoder */ #define PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND 30 /* Maximum number of CLDFB frequency bands within a parameter band */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 25b2fb3711..729b1fced2 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -258,24 +258,18 @@ ivas_error ivas_compute_core_buffers( /*! r: number of clipped samples */ uint32_t ivas_syn_output( -#ifdef JBM_TSM_ON_TCS float *synth[], /* i/o: float synthesis signal */ -#else - float synth[][L_FRAME48k], /* i/o: float synthesis signal */ -#endif const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ int16_t *synth_out /* o : integer 16 bits synthesis signal */ ); -#ifdef JBM_TSM_ON_TCS void ivas_syn_output_f( float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ float *synth_out /* o : integer 16 bits synthesis signal */ ); -#endif void ivas_initialize_handles_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ @@ -321,11 +315,9 @@ ivas_error ivas_dec( ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ int16_t *data /* o : flushed PCM samples */ -#endif ); ivas_error create_sce_dec( @@ -664,11 +656,9 @@ ivas_error ivas_mc_enc_config( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ - #ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ -#endif ); /*! r: MC format mode (MCT, McMASA, ParamMC) */ @@ -769,7 +759,6 @@ void dtx_read_padding_bits( ); -#ifdef JBM_TSM_ON_TCS /*----------------------------------------------------------------------------------* * JBM prototypes *----------------------------------------------------------------------------------*/ @@ -870,7 +859,6 @@ void ivas_jbm_dec_tc_buffer_close( void ivas_jbm_dec_td_renderers_adapt_subframes( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#endif /*----------------------------------------------------------------------------------* @@ -1025,11 +1013,9 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ , const ISM_MODE last_ism_mode /* i/o: last ISM mode */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ int16_t *data /* o : flushed PCM samples */ -#endif ); ivas_error ivas_param_ism_dec_open( @@ -1046,7 +1032,6 @@ void ivas_param_ism_dec( float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ ); -#ifdef JBM_TSM_ON_TCS void ivas_ism_dec_digest_tc( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -1064,7 +1049,6 @@ void ivas_param_ism_dec_render( uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ float *output_f[] /* o : rendered time signal */ ); -#endif void ivas_param_ism_params_to_masa_param_mapping( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -3440,7 +3424,6 @@ ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef JBM_TSM_ON_TCS ivas_error ivas_sba_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nchan_transport, /* i : number of transport channels */ @@ -3448,7 +3431,6 @@ ivas_error ivas_sba_digest_tc( const int16_t nSamplesForRendering, /* i : number of samples provided */ float *data[] /* i : transport channel samples */ ); -#endif void ivas_init_dec_get_num_cldfb_instances( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ @@ -3559,9 +3541,7 @@ void ivas_sba2mc_cldfb( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ const int16_t nb_channels_out, /* i : nb of output channels */ const int16_t nb_bands, /* i : nb of CLDFB bands to process */ -#ifdef JBM_TSM_ON_TCS const int16_t nb_timeslots, /* i : number of time slots to process */ -#endif const float *hoa_dec_mtx /* i : HOA decoding mtx */ ); @@ -3682,7 +3662,6 @@ void ivas_dirac_dec_read_BS( int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); -#ifdef JBM_TSM_ON_TCS void generate_masking_noise_lb_dirac( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ @@ -3700,9 +3679,7 @@ void ivas_dirac_dec( float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport /* i : number of transport channels */ ); -#endif -#ifdef JBM_TSM_ON_TCS void ivas_dirac_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nchan_transport, /* i : number of transport channels */ @@ -3711,26 +3688,13 @@ void ivas_dirac_dec_render( uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ float *output_f[] /* o : rendered time signal */ ); -#endif -#ifndef JBM_TSM_ON_TCS -void ivas_dirac_dec( -#else void ivas_dirac_dec_render_sf( -#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] -#ifndef JBM_TSM_ON_TCS - , - const int16_t i_sf -#endif ); ivas_error ivas_td_decorr_reconfig_dec( @@ -3845,23 +3809,17 @@ void ivas_dirac_dec_output_synthesis_close( void ivas_dirac_dec_output_synthesis_process_slot( const float *reference_power, /* i : Estimated power */ const float *onset, /* i : onset filter */ -#ifdef JBM_TSM_ON_TCS const int16_t *azimuth, const int16_t *elevation, const float *diffuseness, -#endif DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ -#ifdef JBM_TSM_ON_TCS const int16_t sh_rot_max_order, -#endif const float *p_Rmat, /* i : rotation matrix */ 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 */ -#if defined( JBM_TSM_ON_TCS ) , const int16_t index_slot -#endif , const int16_t hodirac_flag ); @@ -3871,17 +3829,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ -#ifdef JBM_TSM_ON_TCS const int16_t nbslots, /* i : number of slots to process */ -#endif const float *onset_filter , #ifdef FIX_393_459_460_SBA_MD float *diffuseness, #else -#ifdef JBM_TSM_ON_TCS const int16_t md_idx, -#endif #endif const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); @@ -3890,13 +3844,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ -#ifdef JBM_TSM_ON_TCS const int16_t nbslots, /* i : number of slots to process */ #ifdef FIX_393_459_460_SBA_MD float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ #else const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ -#endif #endif float *reference_power_smooth, float qualityBasedSmFactor @@ -3936,11 +3888,9 @@ 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 */ -#ifdef JBM_TSM_ON_TCS const int16_t *azimuth, const int16_t *elevation, const int16_t md_idx, -#endif const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ const float *p_Rmat, /* i : rotation matrix */ @@ -4082,7 +4032,6 @@ void ivas_param_mc_dec_read_BS( int16_t *nb_bits /* o : number of bits written */ ); -#ifdef JBM_TSM_ON_TCS void ivas_param_mc_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ @@ -4096,15 +4045,10 @@ void ivas_param_mc_dec_render( uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ float *output_f[] /* o : rendered time signal */ ); -#endif void ivas_param_mc_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ -#ifdef JBM_TSM_ON_TCS float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif ); void ivas_param_mc_default_icc_map( @@ -4235,12 +4179,10 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( const float *proto_matrix /* i : the prototype (upmix) matrix (only used if mode == 1) */ ); -#ifdef JBM_TSM_ON_TCS void ivas_dirac_dec_output_synthesis_get_interpolator( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ const uint16_t interp_length /* i : interpolator length */ ); -#endif void ivas_dirac_dec_output_synthesis_cov_init( DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ @@ -4256,40 +4198,21 @@ void ivas_dirac_dec_output_synthesis_cov_close( ); void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( -#ifdef JBM_TSM_ON_TCS float *RealBuffer, /* i : input channel filter bank samples (real part) */ float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ -#else - float RealBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ - float ImagBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part */ -#endif float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ const int16_t nchan_in /* i : number of input channels */ -#ifndef JBM_TSM_ON_TCS - , - const int16_t idx_slot /* i : index of the slot to be added to the input covariance */ -#endif ); void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( -#ifdef JBM_TSM_ON_TCS float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ -#else - float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ - float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ -#endif float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ -#ifdef JBM_TSM_ON_TCS float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : parameter band wise mixing matrices (direct part) */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : parameter band wise mixing matrices (residual part) */ -#endif const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ const int16_t nX, /* i : number of input channels */ @@ -4378,11 +4301,7 @@ void ivas_sba_upmixer_renderer( ); ivas_error ivas_sba_linear_renderer( -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : number of input ambisonics channels */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ @@ -4559,7 +4478,6 @@ int16_t ivas_is_res_channel( const int16_t nchan_transport /* i : number of transport channels (1-4) */ ); -#ifdef JBM_TSM_ON_TCS void ivas_spar_dec_agc_pca( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: input/output audio channels */ @@ -4602,7 +4520,6 @@ void ivas_spar_dec_upmixer_sf( float *output[], /* o : output audio channels */ const int16_t nchan_internal /* i : number of internal channels */ ); -#endif void ivas_spar_dec_upmixer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -4871,11 +4788,7 @@ void ivas_td_decorr_dec_close( void ivas_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */ -#ifdef JBM_TSM_ON_TCS float *pcm_in[], /* i : input audio channels */ -#else - float pcm_in[][L_FRAME48k], /* i : input audio channels */ -#endif float **ppOut_pcm, /* o : output audio channels */ const int16_t output_frame /* i : output frame length */ ); @@ -5231,8 +5144,6 @@ void ivas_masa_prerender( const int16_t output_frame /* i : output frame length per channel */ ); -#ifdef JBM_TSM_ON_TCS -#endif void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ @@ -5257,29 +5168,21 @@ void ivas_binRenderer_close( #ifdef DEBUGGING void ivas_binaural_cldfb( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif ); -#ifdef JBM_TSM_ON_TCS void ivas_binaural_cldfb_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_samples_to_render, /* i : output frame length per channel */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); -#endif #endif void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i: : number of time slots to process */ -#endif float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ @@ -5289,12 +5192,8 @@ void ivas_binRenderer( void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ -#ifdef JBM_TSM_ON_TCS float *input_f[], /* i : transport channels */ float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif ); @@ -5308,21 +5207,15 @@ ivas_error ivas_ism_renderer_open( void ivas_ism_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: core-coder transport channels/object output */ -#else - float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ -#endif const int16_t output_frame /* i : output frame length per channel */ ); -#ifdef JBM_TSM_ON_TCS void ivas_ism_render_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t n_samples_to_render /* i : output frame length per channel */ ); -#endif void ivas_ism_get_stereo_gains( const float azimuth, /* i : object azimuth */ @@ -5333,23 +5226,15 @@ void ivas_ism_get_stereo_gains( void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ -#ifdef JBM_TSM_ON_TCS float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ float *buffer_td[], /* o : MC signals (on input) and the HOA3 (on output) */ -#else - float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ -#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order, /* i : SBA order */ const float gain_lfe /* i : gain for LFE, 0=ignore LFE */ ); void ivas_ism2sba( -#ifdef JBM_TSM_ON_TCS float *buffer_td[], /* i/o: TD signal buffers */ -#else - float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ -#endif ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ const int16_t nchan_ism, /* i : number of objects */ @@ -5357,7 +5242,6 @@ void ivas_ism2sba( const int16_t sba_order /* i : SBA order */ ); -#ifdef JBM_TSM_ON_TCS void ivas_ism2sba_sf( float *buffer_in[], /* i : TC buffer */ float *buffer_out[], /* o : TD signal buffers */ @@ -5367,7 +5251,6 @@ void ivas_ism2sba_sf( const int16_t offset, /* i : offset for the interpolatr */ const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -#endif /*----------------------------------------------------------------------------------* @@ -5422,12 +5305,8 @@ void ivas_ls_setup_conversion( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ const int16_t input_chans, /* i : number of input channels to the renderer */ const int16_t output_frame, /* i : frame length */ -#ifdef JBM_TSM_ON_TCS float *input[], /* i : LS input/output synthesis signal */ float *output[] /* i/o: LS input/output synthesis signal */ -#else - float output[][L_FRAME48k] /* i/o: LS input/output synthesis signal */ -#endif ); void ivas_ls_setup_conversion_process_mdct( @@ -5442,9 +5321,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( void ivas_lssetupconversion_process_param_mc( Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ -#ifdef JBM_TSM_ON_TCS const int16_t num_timeslots, /* i : number of time slots to process */ -#endif float Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ float Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ int16_t channel_active[MAX_CICP_CHANNELS] /* i : bitmap indicating which output channels are active */ @@ -5678,21 +5555,15 @@ ivas_error ivas_td_binaural_open( ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: SCE channels / Binaural synthesis */ -#else - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ -#endif const int16_t output_frame /* i : output frame length */ ); -#ifdef JBM_TSM_ON_TCS ivas_error ivas_td_binaural_renderer_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ); -#endif /*----------------------------------------------------------------------------------* * Filter-bank (FB) Mixer diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index fe261ef6e8..917cb0e063 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -708,9 +708,7 @@ typedef struct ivas_td_decorr_state_t int16_t num_apd_sections; int16_t ducking_flag; -#ifdef JBM_TSM_ON_TCS int16_t offset; -#endif } ivas_td_decorr_state_t; diff --git a/lib_com/ivas_td_decorr.c b/lib_com/ivas_td_decorr.c index f2dd0871dc..afba0c3d24 100644 --- a/lib_com/ivas_td_decorr.c +++ b/lib_com/ivas_td_decorr.c @@ -222,9 +222,7 @@ ivas_error ivas_td_decorr_dec_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV decoder" ); } set_f( hTdDecorr_loc->look_ahead_buf, 0, (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ) ); -#ifdef JBM_TSM_ON_TCS hTdDecorr_loc->offset = (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); -#endif hTdDecorr_loc->num_apd_sections = ivas_get_APD_filt_orders( num_out_chans, output_Fs, hTdDecorr_loc->APD_filt_state[0].order ); for ( j = 0; j < num_out_chans; j++ ) @@ -471,32 +469,18 @@ static void ivas_td_decorr_APD_sections( void ivas_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */ -#ifdef JBM_TSM_ON_TCS float *pcm_in[], /* i : input audio channels */ -#else - float pcm_in[][L_FRAME48k], /* i : input audio channels */ -#endif float **ppOut_pcm, /* o : output audio channels */ const int16_t output_frame /* i : output frame length */ ) { int16_t i, j; -#ifndef JBM_TSM_ON_TCS - int16_t offset; -#endif float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; -#ifndef JBM_TSM_ON_TCS - offset = (int16_t) ( output_frame * FRAMES_PER_SEC * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); -#endif /* Look-ahead delay */ mvr2r( pcm_in[0], ppOut_pcm[0], output_frame ); -#ifdef JBM_TSM_ON_TCS delay_signal( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset ); -#else - delay_signal( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, offset ); -#endif /* In ducking gains */ if ( hTdDecorr->ducking_flag ) diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index cf59a751a6..b7fe5821e3 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -122,22 +122,14 @@ void mvc2c( /*! r: number of clipped samples */ uint32_t ivas_syn_output( -#ifdef JBM_TSM_ON_TCS float *synth[], /* i/o: float synthesis signal */ -#else - float synth[][L_FRAME48k], /* i/o: float synthesis signal */ -#endif const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ int16_t *synth_out /* o : integer 16 bits synthesis signal */ ) { int16_t i, n; -#ifdef JBM_TSM_ON_TCS int16_t synth_loc[MAX_JBM_L_FRAME48k]; -#else - int16_t synth_loc[L_FRAME48k]; -#endif uint32_t noClipping = 0; /*-----------------------------------------------------------------* @@ -164,7 +156,6 @@ uint32_t ivas_syn_output( } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_syn_output_f() * @@ -196,7 +187,6 @@ void ivas_syn_output_f( return; } -#endif /*-------------------------------------------------------------------* diff --git a/lib_com/options.h b/lib_com/options.h index 8382fe7b39..14b5e1b921 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -127,7 +127,7 @@ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ //#define DEBUG_AGC_ENCODER_CMD_OPTION /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ #define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ - +#define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality */ #endif /* #################### End DEBUGGING switches ############################ */ @@ -148,23 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ - - - - - - - - - - - - - - - -#define VARIABLE_SPEED_DECODING /* FhG: Contribution 37: variable speed decoding employing the JBM functioniality */ -#define JBM_TSM_ON_TCS /* FhG: Contribution 37: run the TSM part of JBM on the TCs instead of the final output pcm waveforms */ #define FIX_DTX_428 /* FhG: fix for issue 428, crash with DTX and bitrate switching */ #define FIX_STEREO_474 /* FhG fix for issue 574, crash with SBA to stereo output at 512 kbps */ #define FIX_MDCT_ST_PLC_FADEOUT_DELAY diff --git a/lib_com/prot.h b/lib_com/prot.h index 23c3b98756..172053bc54 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -177,11 +177,7 @@ float sum2_f( void set_c( int8_t y[], /* i/o: Vector to set */ const int8_t a, /* i : Value to set the vector to */ -#ifdef JBM_TSM_ON_TCS const int32_t N /* i : Length of the vector */ -#else - const int16_t N /* i : Length of the vector */ -#endif ); void set_s( @@ -8680,7 +8676,6 @@ void generate_masking_noise_mdct( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ); -#ifdef JBM_TSM_ON_TCS void SynthesisSTFT_dirac( float *fftBuffer, /* i : FFT bins */ float *timeDomainOutput, @@ -8689,7 +8684,6 @@ void SynthesisSTFT_dirac( const int16_t samples_out, HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ); -#endif void generate_masking_noise_dirac( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ diff --git a/lib_com/tools.c b/lib_com/tools.c index ab688adbb9..ecd2fdbfa4 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -210,11 +210,7 @@ float sum2_f( void set_c( int8_t y[], /* i/o: Vector to set */ const int8_t a, /* i : Value to set the vector to */ -#ifdef JBM_TSM_ON_TCS const int32_t N /* i : Length of the vector */ -#else - const int16_t N /* i : Length of the vector */ -#endif ) { int16_t i; @@ -391,11 +387,7 @@ uint32_t mvr2s( return 0; } -#ifdef JBM_TSM_ON_TCS if ( (void *) y <= (const void *) x ) -#else - if ( (void *) y < (const void *) x ) -#endif { for ( i = 0; i < n; i++ ) { diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index db8b6a659f..45ab2e3435 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1794,7 +1794,6 @@ void generate_stereo_masking_noise( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------- * generate_masking_noise_hf_cldfb() * @@ -1946,7 +1945,6 @@ void generate_masking_noise_lb_dirac( return; } -#endif /*------------------------------------------------------------------- @@ -1967,12 +1965,6 @@ void generate_masking_noise_dirac( ) { int16_t i; -#ifndef JBM_TSM_ON_TCS - float *cngNoiseLevel = hFdCngCom->cngNoiseLevel; - float *fftBuffer = hFdCngCom->fftBuffer; - float *ptr_r; - float *ptr_i; -#endif float *ptr_level; int16_t *seed = &( hFdCngCom->seed ); float scale; @@ -2024,91 +2016,11 @@ void generate_masking_noise_dirac( { if ( scale != 0 ) { -#ifndef JBM_TSM_ON_TCS - /*Generate LF comfort noise only at first slot, for the whole frame*/ - if ( slot_index == 0 ) - { - ptr_level = cngNoiseLevel; - - /* Generate Gaussian random noise in real and imaginary parts of the FFT bins - Amplitudes are adjusted to the estimated noise level cngNoiseLevel in each bin */ - if ( hFdCngCom->startBand == 0 ) - { - rand_gauss( &fftBuffer[0], seed ); - ptr_r = fftBuffer + 2; - fftBuffer[0] *= (float) sqrt( scale * *ptr_level ); /* DC component in FFT */ - ptr_level++; - } - else - { - fftBuffer[0] = 0.f; - set_f( fftBuffer + 2, 0.0f, 2 * ( hFdCngCom->startBand - 1 ) ); - ptr_r = fftBuffer + 2 * hFdCngCom->startBand; - } - ptr_i = ptr_r + 1; - - for ( ; ptr_level < cngNoiseLevel + hFdCngCom->stopFFTbin - hFdCngCom->startBand; ptr_level++ ) - { - /* Real part in FFT bins */ - rand_gauss( ptr_r, seed ); - ( *ptr_r ) *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); - ptr_r += 2; - /* Imaginary part in FFT bins */ - rand_gauss( ptr_i, seed ); - ( *ptr_i ) *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); - ptr_i += 2; - } - - /* Remaining FFT bins are set to zero */ - set_f( fftBuffer + 2 * hFdCngCom->stopFFTbin, 0.0f, hFdCngCom->fftlen - 2 * hFdCngCom->stopFFTbin ); - /* Nyquist frequency is discarded */ - fftBuffer[1] = 0.f; - - /* Perform STFT synthesis */ - SynthesisSTFT( fftBuffer, tdBuffer, hFdCngCom->olapBufferSynth2, hFdCngCom->olapWinSyn, 0, hFdCngCom, -1, -1 ); - -#ifdef DEBUG_MODE_DIRAC - { - int16_t tmp[1000]; - - for ( i = 0; i < hFdCngCom->frameSize; i++ ) - { - tmp[i] = (int16_t) ( tdBuffer[i] + 0.5f ); - } - dbgwrite( tmp, sizeof( int16_t ), hFdCngCom->frameSize, 1, "./res/ivas_dirac_cna_fft.pcm" ); - } -#endif - } -#endif /* LF CLDFB*/ cldfbAnalysis_ts( &( tdBuffer[hFdCngCom->numCoreBands * slot_index] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, hFdCngCom->numCoreBands, h_cldfb ); } else { -#ifndef JBM_TSM_ON_TCS - if ( slot_index == 0 ) - { - /* very low level case - update random seeds */ - generate_masking_noise_update_seed( hFdCngCom ); - - set_f( fftBuffer, 0.f, hFdCngCom->fftlen ); - - /* Perform STFT synthesis */ - SynthesisSTFT( fftBuffer, tdBuffer, hFdCngCom->olapBufferSynth2, hFdCngCom->olapWinSyn, 0, hFdCngCom, -1, -1 ); - -#ifdef DEBUG_MODE_DIRAC - { - int16_t tmp[1000]; - - for ( i = 0; i < hFdCngCom->frameSize; i++ ) - { - tmp[i] = (int16_t) ( tdBuffer[i] + 0.5f ); - } - dbgwrite( tmp, sizeof( int16_t ), hFdCngCom->frameSize, 1, "./res/ivas_dirac_cna_fft.pcm" ); - } -#endif - } -#endif /* LB ana CLDFB*/ cldfbAnalysis_ts( &( tdBuffer[hFdCngCom->numCoreBands * slot_index] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, hFdCngCom->numCoreBands, h_cldfb ); } diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index d4bd43f544..bac1a69d56 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -59,9 +59,7 @@ static void ivas_binRenderer_filterModule( float out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : imag part of Binaural signals */ float CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : real part of LS signals */ float CLDFB_imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : imag part of LS signals */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { @@ -81,11 +79,7 @@ static void ivas_binRenderer_filterModule( filterTapsRightRealPtr = hBinRenderer->hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx]; filterTapsRightImagPtr = hBinRenderer->hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx]; -#ifdef JBM_TSM_ON_TCS for ( k = 0; k < numTimeSlots; k++ ) -#else - for ( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) -#endif { float outRealLeft = 0.0f, outRealRight = 0.0f, outImagLeft = 0.0f, outImagRight = 0.0f; @@ -951,12 +945,8 @@ void ivas_binRenderer_close( void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ -#ifdef JBM_TSM_ON_TCS float *input_f[], /* i : transport channels */ float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif ) { int16_t render_lfe, idx_lfe; @@ -983,17 +973,10 @@ void ivas_binaural_add_LFE( } for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ ) { -#ifdef JBM_TSM_ON_TCS v_multc( input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain, input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame ); /* copy LFE to left and right channels */ v_add( output_f[0], input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[0], output_frame ); v_add( output_f[1], input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[1], output_frame ); -#else - v_multc( output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain, output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame ); - /* copy LFE to left and right channels */ - v_add( output_f[0], output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[0], output_frame ); - v_add( output_f[1], output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[1], output_frame ); -#endif } } @@ -1010,11 +993,7 @@ void ivas_binaural_add_LFE( void ivas_binaural_cldfb( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif ) { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -1057,11 +1036,7 @@ void ivas_binaural_cldfb( } /* Implement binaural rendering */ -#ifdef JBM_TSM_ON_TCS ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, JBM_CLDFB_SLOTS_IN_SUBFRAME, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#else - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#endif /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { @@ -1084,7 +1059,6 @@ void ivas_binaural_cldfb( } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------------* * ivas_binaural_cldfb_sf() * @@ -1153,11 +1127,7 @@ void ivas_binaural_cldfb_sf( } /* Implement binaural rendering */ -#ifdef JBM_TSM_ON_TCS ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#else - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#endif /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) @@ -1182,7 +1152,6 @@ void ivas_binaural_cldfb_sf( return; } #endif -#endif /*------------------------------------------------------------------------- @@ -1194,9 +1163,7 @@ void ivas_binaural_cldfb_sf( void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i : number of time slots to render*/ -#endif float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ @@ -1204,9 +1171,6 @@ void ivas_binRenderer( ) { int16_t chIdx, k; -#ifndef JBM_TSM_ON_TCS - int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; -#endif push_wmops( "fastconv_binaural_rendering" ); @@ -1230,47 +1194,27 @@ void ivas_binRenderer( if ( hHeadTrackData->shd_rot_max_order == -1 ) { QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); -#ifdef JBM_TSM_ON_TCS rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); -#else - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); -#endif } else if ( hHeadTrackData->shd_rot_max_order > 0 ) { -#ifdef JBM_TSM_ON_TCS rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hHeadTrackData->shd_rot_max_order ); -#else - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, hHeadTrackData->shd_rot_max_order ); -#endif } } else { /* Rotation in SD (CICPx) */ -#ifdef JBM_TSM_ON_TCS rotateFrame_sd_cldfb( hHeadTrackData, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); -#else - rotateFrame_sd_cldfb( hHeadTrackData, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, hBinRenderer->conv_band ); -#endif } } /* HOA decoding to CICP19 if needed*/ if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) { -#ifdef JBM_TSM_ON_TCS ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); -#else - ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, hBinRenderer->hoa_dec_mtx ); -#endif } -#ifdef JBM_TSM_ON_TCS ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer ); -#else - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, hBinRenderer ); -#endif /* Obtain the binaural dmx and compute the reverb */ if ( hBinRenderer->hReverb != NULL ) @@ -1290,11 +1234,7 @@ void ivas_binRenderer( } } -#ifdef JBM_TSM_ON_TCS ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe, inIm, reverbRe, reverbIm ); -#else - ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, inRe, inIm, reverbRe, reverbIm ); -#endif /* Add the conv module and reverb module output */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 82f03fdb3b..1fb8e06cc3 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -66,9 +66,7 @@ ivas_error ivas_dec( AUDIO_CONFIG output_config; float pan_left, pan_right; ivas_error error; -#ifdef JBM_TSM_ON_TCS float *p_output[MAX_OUTPUT_CHANNELS]; -#endif error = IVAS_ERR_OK; @@ -84,11 +82,7 @@ ivas_error ivas_dec( if ( st_ivas->bfi == 0 ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_dec_setup( st_ivas, NULL, NULL ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dec_setup( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -105,12 +99,10 @@ ivas_error ivas_dec( output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); -#ifdef JBM_TSM_ON_TCS for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { p_output[n] = &output[n][0]; } -#endif /*----------------------------------------------------------------* * Decoding + Rendering @@ -149,11 +141,7 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_MC ) { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); -#endif } } else if ( st_ivas->ivas_format == ISM_FORMAT ) @@ -219,11 +207,7 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { /* Convert CICP19 -> Ambisonics */ -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#else - ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif } } } @@ -244,11 +228,7 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ -#ifdef JBM_TSM_ON_TCS ivas_ism_render( st_ivas, p_output, output_frame ); -#else - ivas_ism_render( st_ivas, output, output_frame ); -#endif } #ifdef DEBUGGING else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) @@ -257,22 +237,14 @@ ivas_error ivas_dec( #endif { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ -#ifdef JBM_TSM_ON_TCS ivas_ism2sba( p_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_ism, output_frame, st_ivas->hIntSetup.ambisonics_order ); -#endif } /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef JBM_TSM_ON_TCS if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) -#else - if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -280,29 +252,17 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, -#ifdef JBM_TSM_ON_TCS p_output, -#else - output, -#endif output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#ifdef JBM_TSM_ON_TCS ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } #ifdef DEBUGGING else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -#ifdef JBM_TSM_ON_TCS ivas_binaural_cldfb( st_ivas, p_output ); -#else - ivas_binaural_cldfb( st_ivas, output ); -#endif } #endif } @@ -460,7 +420,6 @@ ivas_error ivas_dec( { ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); } -#ifdef JBM_TSM_ON_TCS #ifndef SBA_MODE_CLEAN_UP else if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->renderer_type != RENDERER_DISABLE ) #else @@ -469,7 +428,6 @@ ivas_error ivas_dec( { ivas_spar_dec_agc_pca( st_ivas, output, output_frame ); } -#endif } if ( st_ivas->ivas_format == MASA_FORMAT ) @@ -508,22 +466,14 @@ ivas_error ivas_dec( { if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_sba_linear_renderer( p_output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_sba_linear_renderer( output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ) ) != IVAS_ERR_OK ) -#endif { return error; } } else if ( st_ivas->renderer_type == RENDERER_DIRAC ) { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec( st_ivas, output, nchan_remapped ); -#else - ivas_dirac_dec( st_ivas, output, nchan_remapped, NULL, NULL, -1 ); -#endif } } else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) @@ -561,11 +511,7 @@ ivas_error ivas_dec( if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -#else - ivas_mc2sba( st_ivas->hTransSetup, output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -#endif } /* Rendering */ @@ -573,54 +519,30 @@ ivas_error ivas_dec( { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, -#ifdef JBM_TSM_ON_TCS p_output, -#else - output, -#endif output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#ifdef JBM_TSM_ON_TCS ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); -#endif } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#else - ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef JBM_TSM_ON_TCS if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) { return error; } ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) - { - return error; - } - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) @@ -649,74 +571,42 @@ ivas_error ivas_dec( if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -#else - ivas_mc2sba( st_ivas->hTransSetup, output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -#endif } /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, output, output_Fs ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef JBM_TSM_ON_TCS ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, output ); -#endif } else { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, output ); -#endif } } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#else - ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef JBM_TSM_ON_TCS if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) -#else - if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef JBM_TSM_ON_TCS ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -748,19 +638,11 @@ ivas_error ivas_dec( /* Rendering */ if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); -#endif } else { -#ifdef JBM_TSM_ON_TCS ivas_param_mc_dec( st_ivas, p_output ); -#else - ivas_param_mc_dec( st_ivas, output ); -#endif } } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -842,19 +724,11 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) /* rendering to CICPxx and Ambisonics */ { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport ); -#else - ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); -#endif if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#else - ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif } else if ( st_ivas->intern_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 ) ) { @@ -878,21 +752,12 @@ ivas_error ivas_dec( * - float to integer conversion *----------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, output_frame, st_ivas->BER_detect ); #ifdef DEBUGGING st_ivas->noClipping += #endif ivas_syn_output( p_output, output_frame, nchan_out, data ); -#else - ivas_limiter_dec( st_ivas->hLimiter, output, nchan_out, output_frame, st_ivas->BER_detect ); - -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - ivas_syn_output( output, output_frame, nchan_out, data ); -#endif /*----------------------------------------------------------------* * Common updates diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 00f0c6ad9a..3bde2aa5ee 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -269,9 +269,7 @@ ivas_error ivas_dirac_dec_config( ivas_error error; int16_t nchan_transport_orig; int16_t hodirac_flag; -#ifdef JBM_TSM_ON_TCS int16_t map_idx; -#endif DIRAC_CONFIG_FLAG flag_config; flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; @@ -302,10 +300,8 @@ ivas_error ivas_dirac_dec_config( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); } nchan_transport_old = 0; -#ifdef JBM_TSM_ON_TCS hDirAC->hParamIsm = NULL; hDirAC->hParamIsmRendering = NULL; -#endif st_ivas->hDirAC = hDirAC; } @@ -401,18 +397,12 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); -#ifdef JBM_TSM_ON_TCS set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); hDirAC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; hDirAC->subframes_rendered = 0; hDirAC->slots_rendered = 0; hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; -#else - hDirAC->subframe_nbslots = (int16_t) ( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); - hDirAC->nb_subframes = CLDFB_NO_COL_MAX / hDirAC->subframe_nbslots; - assert( hDirAC->nb_subframes <= MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif } if ( st_ivas->ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE && ( ( ivas_total_brate > IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate <= IVAS_256k ) || ( ivas_total_brate <= IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate > IVAS_256k ) ) ) @@ -1035,27 +1025,23 @@ ivas_error ivas_dirac_dec_config( { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef JBM_TSM_ON_TCS set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) { hDirAC->render_to_md_map[map_idx] = map_idx; } -#endif } else if ( st_ivas->ivas_format == MASA_FORMAT ) { 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; -#ifdef JBM_TSM_ON_TCS set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) { hDirAC->render_to_md_map[map_idx] = map_idx; } -#endif } else { @@ -1091,7 +1077,6 @@ ivas_error ivas_dirac_dec_config( #ifndef SBA_MODE_CLEAN_UP } #endif -#ifdef JBM_TSM_ON_TCS set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); #ifdef FIX_393_459_460_SBA_MD @@ -1106,7 +1091,6 @@ ivas_error ivas_dirac_dec_config( hDirAC->render_to_md_map[map_idx] = hDirAC->dirac_read_idx + map_idx * num_slots_in_subfr / JBM_CLDFB_SLOTS_IN_SUBFRAME; #endif } -#endif } if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 1 ) ) != IVAS_ERR_OK ) @@ -1162,7 +1146,6 @@ ivas_error ivas_dirac_dec_config( } } #endif -#ifdef JBM_TSM_ON_TCS /* allocate transport channels*/ if ( flag_config == DIRAC_OPEN ) { @@ -1192,7 +1175,6 @@ ivas_error ivas_dirac_dec_config( } } } -#endif /* JBM_TMS_ON_TCS*/ return error; } @@ -2144,29 +2126,20 @@ void ivas_qmetadata_to_dirac( { band_start = band_grouping[band]; band_end = band_grouping[band + 1]; -#ifdef JBM_TSM_ON_TCS tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#else - for ( block = 0; block < hDirAC->nb_subframes; block++ ) -#endif { -#ifdef JBM_TSM_ON_TCS #ifndef FIX_393_459_460_SBA_MD ts_start = hDirAC->block_grouping[block]; ts_end = hDirAC->block_grouping[block + 1]; -#endif #endif for ( b = band_start; b < band_end; b++ ) { -#ifdef JBM_TSM_ON_TCS tmp_write_idx_band = tmp_write_idx_param_band; -#endif hDirAC->spreadCoherence[block][b] = 0.0f; hDirAC->surroundingCoherence[block][b] = 0.0f; -#ifdef JBM_TSM_ON_TCS #ifndef FIX_393_459_460_SBA_MD if ( hDirAC->hConfig->dec_param_estim == FALSE ) { @@ -2196,7 +2169,6 @@ void ivas_qmetadata_to_dirac( tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; } } -#endif #endif } } @@ -2234,11 +2206,7 @@ void ivas_qmetadata_to_dirac( #endif diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; -#ifdef JBM_TSM_ON_TCS for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#else - for ( block = 0; block < hDirAC->nb_subframes; block++ ) -#endif { int16_t block_qmetadata; @@ -2365,11 +2333,7 @@ void ivas_qmetadata_to_dirac( { tmp_write_idx_band = hDirAC->dirac_bs_md_write_idx; -#ifdef JBM_TSM_ON_TCS for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#else - for ( block = 0; block < hDirAC->nb_subframes; block++ ) -#endif { #ifndef FIX_393_459_460_SBA_MD ts_start = hDirAC->block_grouping[block]; @@ -2387,11 +2351,9 @@ void ivas_qmetadata_to_dirac( hDirAC->elevation[tmp_write_idx_band][b] = 0; hDirAC->azimuth[tmp_write_idx_band][b] = 0; hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; -#ifdef JBM_TSM_ON_TCS hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; -#endif tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; #ifndef FIX_393_459_460_SBA_MD } @@ -2402,11 +2364,9 @@ void ivas_qmetadata_to_dirac( hDirAC->elevation[tmp_write_idx_band][b] = 0; hDirAC->azimuth[tmp_write_idx_band][b] = 0; hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; -#ifdef JBM_TSM_ON_TCS hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; -#endif tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; } } @@ -2432,7 +2392,6 @@ void ivas_qmetadata_to_dirac( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------------- * ivas_dirac_dec_set_md_map() * @@ -2657,7 +2616,6 @@ void ivas_dirac_dec_render( return; } -#endif /*------------------------------------------------------------------------- @@ -2666,24 +2624,12 @@ void ivas_dirac_dec_render( * DirAC decoding process *------------------------------------------------------------------------*/ -#ifndef JBM_TSM_ON_TCS -void ivas_dirac_dec( -#else void ivas_dirac_dec_render_sf( -#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] -#ifndef JBM_TSM_ON_TCS - , - const int16_t i_sf -#endif ) { int16_t i, ch, idx_in, idx_lfe; @@ -2692,15 +2638,10 @@ void ivas_dirac_dec_render_sf( float surCohEner; float surCohRatio[CLDFB_NO_CHANNELS_MAX]; int16_t subframe_idx; -#ifndef JBM_TSM_ON_TCS - int16_t sf1, sf2; -#endif int16_t slot_idx, index_slot; int16_t hodirac_flag; float *p_Rmat; -#ifdef JBM_TSM_ON_TCS int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; -#endif /*CLDFB: last output channels reserved to LFT for CICPx*/ float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -2709,7 +2650,6 @@ void ivas_dirac_dec_render_sf( float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; int16_t index, num_freq_bands; -#ifdef JBM_TSM_ON_TCS /* local copies of azi, ele, diffuseness */ #ifdef FIX_393_459_460_SBA_MD int16_t azimuth[CLDFB_NO_CHANNELS_MAX]; @@ -2719,7 +2659,6 @@ void ivas_dirac_dec_render_sf( int16_t azimuth[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; int16_t elevation[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float diffuseness_vector[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#endif #endif DIRAC_DEC_STACK_MEM DirAC_mem; @@ -2727,11 +2666,7 @@ void ivas_dirac_dec_render_sf( float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; uint16_t coherence_flag; -#ifndef JBM_TSM_ON_TCS - push_wmops( "ivas_dirac_dec" ); -#else push_wmops( "ivas_dirac_dec_render" ); -#endif /* Initialize aux buffers */ hDirAC = st_ivas->hDirAC; @@ -2777,30 +2712,10 @@ void ivas_dirac_dec_render_sf( #endif /* Subframe loop */ -#ifndef JBM_TSM_ON_TCS - if ( i_sf == -1 ) - { - sf1 = 0; - sf2 = hDirAC->nb_subframes; - } - else - { - sf1 = i_sf; - sf2 = i_sf + 1; - } -#endif -#ifdef JBM_TSM_ON_TCS slot_idx_start = hDirAC->slots_rendered; slot_idx_start_cldfb_synth = 0; -#endif -#ifdef JBM_TSM_ON_TCS subframe_idx = hDirAC->subframes_rendered; -#else - for ( subframe_idx = sf1; subframe_idx < sf2; subframe_idx++ ) - { -#endif -#ifdef JBM_TSM_ON_TCS if ( hDirAC->hConfig->dec_param_estim == FALSE ) { md_idx = hDirAC->render_to_md_map[subframe_idx]; @@ -2809,8 +2724,6 @@ void ivas_dirac_dec_render_sf( { md_idx = hDirAC->render_to_md_map[slot_idx_start]; } -#endif -#ifdef JBM_TSM_ON_TCS /* Another workaround for self test BE */ /* copy parameters into local buffers*/ @@ -2844,7 +2757,6 @@ void ivas_dirac_dec_render_sf( mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_map[subframe_idx]], diffuseness_vector[slot_idx], hDirAC->num_freq_bands ); } } -#endif #endif if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) @@ -2856,12 +2768,8 @@ void ivas_dirac_dec_render_sf( set_zero( onset_filter_subframe, hDirAC->num_freq_bands ); } -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hHeadTrackData ) -#else - if ( st_ivas->hHeadTrackData ) -#endif { QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); @@ -2876,20 +2784,9 @@ void ivas_dirac_dec_render_sf( rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); } #else -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { -#ifdef JBM_TSM_ON_TCS rotateAziEle_DirAC( azimuth[slot_idx], elevation[slot_idx], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); -#else - /* note, this seems wrong since it does not take the dirac read ptr into account */ - index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; - /* Todo: This access to azimuth & elevation may use wrong indices as access should probably be based on hDirAC->dirac_read_idx */ - rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); -#endif } #endif } @@ -2905,14 +2802,10 @@ void ivas_dirac_dec_render_sf( if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { ivas_dirac_dec_compute_power_factors( hDirAC->num_freq_bands, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD diffuseness_vector, #else diffuseness_vector[0], -#endif -#else - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], #endif hDirAC->h_output_synthesis_psd_params.max_band_decorr, hDirAC->h_output_synthesis_psd_state.direct_power_factor, @@ -2923,11 +2816,7 @@ void ivas_dirac_dec_render_sf( for ( i = 0; i < hDirAC->num_freq_bands; i++ ) { dirEne = hDirAC->h_output_synthesis_psd_state.direct_power_factor[i]; -#ifdef JBM_TSM_ON_TCS surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[md_idx][i]; -#else - surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[hDirAC->dirac_read_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; @@ -2942,11 +2831,7 @@ void ivas_dirac_dec_render_sf( else { ivas_dirac_dec_compute_gain_factors( hDirAC->num_freq_bands, -#ifdef JBM_TSM_ON_TCS hDirAC->diffuseness_vector[md_idx], -#else - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], -#endif hDirAC->h_output_synthesis_psd_params.max_band_decorr, hDirAC->h_output_synthesis_psd_state.direct_power_factor, hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); @@ -2955,11 +2840,7 @@ void ivas_dirac_dec_render_sf( { for ( i = 0; i < hDirAC->num_freq_bands; i++ ) { -#ifdef JBM_TSM_ON_TCS surCohRatio[i] = hDirAC->surroundingCoherence[md_idx][i]; -#else - surCohRatio[i] = hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; -#endif } } else @@ -2973,7 +2854,6 @@ void ivas_dirac_dec_render_sf( ivas_dirac_dec_compute_directional_responses( hDirAC, st_ivas->hVBAPdata, st_ivas->hMasa, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD azimuth, elevation, @@ -2982,7 +2862,6 @@ void ivas_dirac_dec_render_sf( hDirAC->elevation[md_idx], #endif md_idx, -#endif surCohRatio, st_ivas->hHeadTrackData->shd_rot_max_order, p_Rmat, @@ -2993,7 +2872,6 @@ void ivas_dirac_dec_render_sf( ivas_dirac_dec_compute_directional_responses( hDirAC, st_ivas->hVBAPdata, st_ivas->hMasa, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD azimuth, elevation, @@ -3002,7 +2880,6 @@ void ivas_dirac_dec_render_sf( hDirAC->elevation[md_idx], #endif md_idx, -#endif surCohRatio, 0, NULL, @@ -3010,13 +2887,8 @@ void ivas_dirac_dec_render_sf( } } -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { -#ifdef JBM_TSM_ON_TCS index_slot = slot_idx_start + slot_idx; if ( hDirAC->hConfig->dec_param_estim == TRUE ) { @@ -3026,9 +2898,6 @@ void ivas_dirac_dec_render_sf( { md_idx = hDirAC->render_to_md_map[subframe_idx]; } -#else - index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; -#endif #ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) @@ -3047,19 +2916,11 @@ void ivas_dirac_dec_render_sf( /* CLDFB Analysis*/ for ( ch = 0; ch < nchan_transport; ch++ ) { -#ifdef JBM_TSM_ON_TCS cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), Cldfb_RealBuffer[ch][0], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); -#else - cldfbAnalysis_ts( &( output_f[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), - Cldfb_RealBuffer[ch][0], - Cldfb_ImagBuffer[ch][0], - hDirAC->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); -#endif } } @@ -3074,11 +2935,7 @@ void ivas_dirac_dec_render_sf( generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], -#ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer->tc[1], -#else - &( output_f[1][L_FRAME48k - L_FRAME16k] ), -#endif Cldfb_RealBuffer[1][0], Cldfb_ImagBuffer[1][0], index_slot, @@ -3093,11 +2950,7 @@ void ivas_dirac_dec_render_sf( Cldfb_RealBuffer, Cldfb_ImagBuffer, Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], slot_idx, -#ifdef JBM_TSM_ON_TCS md_idx, -#else - subframe_idx, -#endif nchan_transport ); } @@ -3213,17 +3066,12 @@ void ivas_dirac_dec_render_sf( hDirAC->buffer_intensity_real[1][index - 1], hDirAC->buffer_intensity_real[2][index - 1], num_freq_bands, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD azimuth, elevation #else azimuth[slot_idx], elevation[slot_idx] -#endif -#else - hDirAC->azimuth[hDirAC->dirac_estimator_idx], - hDirAC->elevation[hDirAC->dirac_estimator_idx] #endif ); @@ -3232,21 +3080,14 @@ void ivas_dirac_dec_render_sf( computeDiffuseness( hDirAC->buffer_intensity_real, hDirAC->buffer_energy, num_freq_bands, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD hDirAC->diffuseness_vector[md_idx] #else diffuseness_vector[slot_idx] -#endif -#else - hDirAC->diffuseness_vector[hDirAC->dirac_estimator_idx] #endif ); -#ifndef JBM_TSM_ON_TCS - hDirAC->dirac_estimator_idx = ( hDirAC->dirac_estimator_idx + 1 ) % hDirAC->dirac_md_buffer_length; -#endif } #ifdef DEBUG_MODE_DIRAC @@ -3368,34 +3209,6 @@ void ivas_dirac_dec_render_sf( } /*Compute PSDs*/ -#ifndef JBM_TSM_ON_TCS - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 2 ) - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - hDirAC, - p_Rmat, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - st_ivas->sba_analysis_order > 1 && - st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ); - } - else - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, - hDirAC, - 0, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - st_ivas->sba_analysis_order > 1 && - st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k - - ); - } -#else if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) { ivas_dirac_dec_output_synthesis_process_slot( reference_power, @@ -3442,7 +3255,6 @@ void ivas_dirac_dec_render_sf( md_idx, hodirac_flag ); } -#endif #ifdef FIX_393_459_460_SBA_MD if ( hDirAC->hConfig->dec_param_estim ) @@ -3457,21 +3269,8 @@ void ivas_dirac_dec_render_sf( v_add( reference_power, reference_power_smooth, reference_power_smooth, hDirAC->num_freq_bands ); } -#ifndef JBM_TSM_ON_TCS - if ( hDirAC->hConfig->dec_param_estim ) - { - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; - } -#endif } -#ifndef JBM_TSM_ON_TCS - if ( hDirAC->hConfig->dec_param_estim == 0 ) - { - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; - } -#endif -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec_output_synthesis_get_interpolator( &hDirAC->h_output_synthesis_psd_params, hDirAC->subframe_nbslots[subframe_idx] ); #ifndef FIX_393_459_460_SBA_MD @@ -3514,23 +3313,18 @@ void ivas_dirac_dec_render_sf( } #endif -#endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC, nchan_transport, -#ifdef JBM_TSM_ON_TCS hDirAC->subframe_nbslots[subframe_idx], -#endif p_onset_filter, #ifdef FIX_393_459_460_SBA_MD diffuseness_vector, #else -#ifdef JBM_TSM_ON_TCS md_idx, -#endif #endif hodirac_flag ); } @@ -3545,7 +3339,6 @@ void ivas_dirac_dec_render_sf( qualityBasedSmFactor *= qualityBasedSmFactor; } -#ifdef JBM_TSM_ON_TCS #ifndef FIX_393_459_460_SBA_MD /* Workaround for BE (should be gone when #393 is adressed) */ if ( hDirAC->hConfig->dec_param_estim == 1 ) @@ -3560,17 +3353,14 @@ void ivas_dirac_dec_render_sf( } #endif -#endif ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC, -#ifdef JBM_TSM_ON_TCS hDirAC->subframe_nbslots[subframe_idx], #ifdef FIX_393_459_460_SBA_MD diffuseness_vector, #else md_idx, -#endif #endif reference_power_smooth, qualityBasedSmFactor ); @@ -3580,20 +3370,14 @@ void ivas_dirac_dec_render_sf( * CLDFB synthesis (and binaural rendering) *-----------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS index_slot = slot_idx_start_cldfb_synth; -#else - index_slot = subframe_idx * hDirAC->subframe_nbslots; -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { /* Perform binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, -#ifdef JBM_TSM_ON_TCS hDirAC->subframe_nbslots[subframe_idx], -#endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, @@ -3606,29 +3390,17 @@ void ivas_dirac_dec_render_sf( float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; } -#ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); -#else - cldfbSynthesis( RealBuffer, - ImagBuffer, - &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots, - st_ivas->cldfbSynDec[ch] ); -#endif } } #ifdef SBA_MODE_CLEAN_UP @@ -3639,11 +3411,7 @@ void ivas_dirac_dec_render_sf( { for ( ch = 0; ch < hDirAC->hOutSetup.nchan_out_woLFE; ch++ ) { -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hDirAC->num_freq_bands ); mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hDirAC->num_freq_bands ); @@ -3675,11 +3443,7 @@ void ivas_dirac_dec_render_sf( float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; const int16_t subframe_start_sample = index_slot * hDirAC->num_freq_bands; -#ifdef JBM_TSM_ON_TCS const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx]; -#else - const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots; -#endif /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); @@ -3706,11 +3470,7 @@ void ivas_dirac_dec_render_sf( else { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; @@ -3736,20 +3496,12 @@ void ivas_dirac_dec_render_sf( { if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled ) { -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; } -#ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); -#else - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); -#endif } else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirAC->hOutSetup.separateChannelEnabled ) { @@ -3757,11 +3509,7 @@ void ivas_dirac_dec_render_sf( } else { -#ifdef JBM_TSM_ON_TCS set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); -#else - set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); -#endif } if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) @@ -3777,32 +3525,19 @@ void ivas_dirac_dec_render_sf( else { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } -#ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); -#else - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[idx_in] ); -#endif idx_in++; } } } } -#ifdef JBM_TSM_ON_TCS hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; hDirAC->subframes_rendered++; -#endif -#ifndef JBM_TSM_ON_TCS -} -#endif pop_wmops(); diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index ffe6fea382..cc08a6faca 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -105,22 +105,18 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); -#ifdef JBM_TSM_ON_TCS if ( ( h_dirac_output_synthesis_state->mixing_matrix[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); -#endif } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { h_dirac_output_synthesis_state->cx_old[idx] = NULL; h_dirac_output_synthesis_state->cy_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; -#ifdef JBM_TSM_ON_TCS h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; -#endif } for ( idx = 0; idx < num_param_bands_residual; idx++ ) @@ -131,20 +127,16 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); -#ifdef JBM_TSM_ON_TCS if ( ( h_dirac_output_synthesis_state->mixing_matrix_res[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); -#endif } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = NULL; -#ifdef JBM_TSM_ON_TCS h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; -#endif } /*-----------------------------------------------------------------* @@ -168,7 +160,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_get_interpolator() * @@ -189,7 +180,6 @@ void ivas_dirac_dec_output_synthesis_get_interpolator( return; } -#endif /*-------------------------------------------------------------------* @@ -215,17 +205,13 @@ void ivas_dirac_dec_output_synthesis_cov_init( set_zero( h_dirac_output_synthesis_state->cx_old[idx], nchan_in * nchan_in ); set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); -#ifdef JBM_TSM_ON_TCS set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); -#endif } for ( idx = 0; idx < n_param_bands_res; idx++ ) { set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); -#ifdef JBM_TSM_ON_TCS set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); -#endif } return; @@ -297,7 +283,6 @@ void ivas_dirac_dec_output_synthesis_cov_close( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = NULL; } -#ifdef JBM_TSM_ON_TCS if ( h_dirac_output_synthesis_state->mixing_matrix[idx] != NULL ) { free( h_dirac_output_synthesis_state->mixing_matrix[idx] ); @@ -309,7 +294,6 @@ void ivas_dirac_dec_output_synthesis_cov_close( free( h_dirac_output_synthesis_state->mixing_matrix_res[idx] ); h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; } -#endif } return; @@ -323,21 +307,12 @@ void ivas_dirac_dec_output_synthesis_cov_close( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( -#ifdef JBM_TSM_ON_TCS float *RealBuffer, /* i : input channel filter bank samples (real part) */ float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ -#else - float RealBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ - float ImagBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part */ -#endif float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ const int16_t nchan_in /* i : number of input channels */ -#ifndef JBM_TSM_ON_TCS - , - const int16_t idx_slot /* i : index of the slot to be added to the input covariance */ -#endif ) { int16_t param_band, band_idx, ch_idx; @@ -363,13 +338,8 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( int16_t band = brange[0] + band_idx; for ( ch_idx = 0; ch_idx < nchan_in; ch_idx++ ) { -#ifdef JBM_TSM_ON_TCS real_in_buffer[band_idx + num_bands * ch_idx] = RealBuffer[ch_idx * hParamMC->num_freq_bands + band]; imag_in_buffer[band_idx + num_bands * ch_idx] = ImagBuffer[ch_idx * hParamMC->num_freq_bands + band]; -#else - real_in_buffer[band_idx + num_bands * ch_idx] = RealBuffer[ch_idx][idx_slot][band]; - imag_in_buffer[band_idx + num_bands * ch_idx] = ImagBuffer[ch_idx][idx_slot][band]; -#endif } } @@ -392,22 +362,12 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( -#ifdef JBM_TSM_ON_TCS float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ -#else - float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ - float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ -#endif float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ -#ifdef JBM_TSM_ON_TCS float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : parameter band wise mixing matrices (direct part) */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : parameter band wise mixing matrices (residual part) */ -#endif const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ const int16_t nX, /* i : number of input channels */ @@ -497,13 +457,8 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( /* collect input signals, still in cldfb buffers */ for ( ch_idx = 0; ch_idx < nX; ch_idx++ ) { -#ifdef JBM_TSM_ON_TCS input_f_real[ch_idx] = Cldfb_RealBuffer_in[ch_idx * hParamMC->num_freq_bands + band]; input_f_imag[ch_idx] = Cldfb_ImagBuffer_in[ch_idx * hParamMC->num_freq_bands + band]; -#else - input_f_real[ch_idx] = Cldfb_RealBuffer_in[ch_idx][slot_idx_tot][band]; - input_f_imag[ch_idx] = Cldfb_ImagBuffer_in[ch_idx][slot_idx_tot][band]; -#endif } /* apply mixing matrix */ diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c index 33004c540c..7bdaea9d3c 100755 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -164,11 +164,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open( } /* buffer length and interpolator */ -#ifdef JBM_TSM_ON_TCS if ( ( dirac_output_synthesis_params->interpolator = (float *) malloc( JBM_CLDFB_SLOTS_IN_SUBFRAME * sizeof( float ) ) ) == NULL ) -#else - if ( ( dirac_output_synthesis_params->interpolator = (float *) malloc( hDirAC->subframe_nbslots * sizeof( float ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -287,17 +283,9 @@ ivas_error ivas_dirac_dec_output_synthesis_open( } /* compute interpolator */ -#ifdef JBM_TSM_ON_TCS for ( idx = 1; idx <= JBM_CLDFB_SLOTS_IN_SUBFRAME; ++idx ) -#else - for ( idx = 1; idx <= hDirAC->subframe_nbslots; ++idx ) -#endif { -#ifdef JBM_TSM_ON_TCS dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) JBM_CLDFB_SLOTS_IN_SUBFRAME; -#else - dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) hDirAC->subframe_nbslots; -#endif } /* prepare diffuse response function */ @@ -548,23 +536,17 @@ void ivas_dirac_dec_output_synthesis_close( void ivas_dirac_dec_output_synthesis_process_slot( const float *reference_power, /* i : Estimated power */ const float *onset, /* i : onset filter */ -#ifdef JBM_TSM_ON_TCS const int16_t *azimuth, const int16_t *elevation, const float *diffuseness, -#endif DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ -#ifdef JBM_TSM_ON_TCS const int16_t sh_rot_max_order, -#endif const float *p_Rmat, /* i : rotation matrix */ 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*/ -#if defined( JBM_TSM_ON_TCS ) , const int16_t md_idx -#endif , const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) @@ -574,15 +556,9 @@ void ivas_dirac_dec_output_synthesis_process_slot( int16_t ch_idx; float aux_buf[CLDFB_NO_CHANNELS_MAX]; int16_t diff_start_band; -#ifndef JBM_TSM_ON_TCS - const float *diffuseness; -#endif DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; -#ifndef JBM_TSM_ON_TCS - diffuseness = hDirAC->diffuseness_vector[hDirAC->dirac_read_idx]; -#endif h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); @@ -608,11 +584,9 @@ void ivas_dirac_dec_output_synthesis_process_slot( ivas_dirac_dec_compute_directional_responses( hDirAC, hVBAPdata, NULL, -#ifdef JBM_TSM_ON_TCS azimuth, elevation, md_idx, -#endif NULL, 2, p_Rmat, @@ -623,7 +597,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( { if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { -#ifdef JBM_TSM_ON_TCS v_multc( hDirAC->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); mvr2r( hDirAC->energy_ratio1[md_idx], @@ -641,41 +614,14 @@ void ivas_dirac_dec_output_synthesis_process_slot( mvr2r( aux_buf, &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], num_freq_bands ); -#else - v_multc( hDirAC->energy_ratio1[hDirAC->dirac_read_idx], -1.f, aux_buf, num_freq_bands ); - v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( hDirAC->energy_ratio1[hDirAC->dirac_read_idx], - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - mvr2r( aux_buf, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); - - v_multc( hDirAC->energy_ratio2[hDirAC->dirac_read_idx], -1.f, aux_buf, num_freq_bands ); - v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( hDirAC->energy_ratio2[hDirAC->dirac_read_idx], - &h_dirac_output_synthesis_state->direct_power_factor[hDirAC->num_freq_bands], - num_freq_bands ); - mvr2r( aux_buf, - &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], - num_freq_bands ); -#endif } else { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec_compute_gain_factors( num_freq_bands, hDirAC->diffuseness_vector[md_idx], h_dirac_output_synthesis_params->max_band_decorr, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor ); -#else - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); -#endif } } else // ( hDirAC->hConfig->dec_param_estim == TRUE ) @@ -683,7 +629,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( { /* compute direct responses */ -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec_compute_directional_responses( hDirAC, hVBAPdata, NULL, @@ -694,7 +639,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( sh_rot_max_order, p_Rmat, hodirac_flag ); -#endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { @@ -831,16 +775,12 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ -#ifdef JBM_TSM_ON_TCS const int16_t nbslots, /* i : number of slots to process */ -#endif const float *onset_filter, #ifdef FIX_393_459_460_SBA_MD float *diffuseness, #else -#ifdef JBM_TSM_ON_TCS const int16_t md_idx, -#endif #endif const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) @@ -881,11 +821,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( nchan_transport_foa = min( 4, nchan_transport ); #ifndef FIX_393_459_460_SBA_MD -#ifdef JBM_TSM_ON_TCS diffuseness = hDirAC->diffuseness_vector[md_idx]; -#else - diffuseness = hDirAC->diffuseness_vector[hDirAC->dirac_read_idx]; -#endif #endif /*-----------------------------------------------------------------* @@ -1087,11 +1023,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( * gain interpolation and output streams *-----------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS for ( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) -#else - for ( buf_idx = 0; buf_idx < hDirAC->subframe_nbslots; ++buf_idx ) -#endif { g1 = h_dirac_output_synthesis_params.interpolator[buf_idx]; g2 = 1.f - g1; @@ -1300,13 +1232,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ -#ifdef JBM_TSM_ON_TCS const int16_t nbslots, /* i : number of slots to process */ #ifdef FIX_393_459_460_SBA_MD float *diffuseness_vector, #else const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ -#endif #endif float *reference_power_smooth, float qualityBasedSmFactor ) @@ -1435,15 +1365,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /* Estimate the smoothness of the directions based on the diffuseness parameter */ /* TODO: check this, seems buggy in the case of parame estim on the decoder side, because the pointer here points already to the following subframe, ist this intended?*/ -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD instDirectionSmoothness = 1.0f - diffuseness_vector[l]; #else /* Workaround for BE */ instDirectionSmoothness = 1.0f - hDirAC->diffuseness_vector[diff_md_idx][l]; /* Currently, all subframes have same energy ratio value. */ -#endif -#else - instDirectionSmoothness = 1.0f - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx][l]; /* Currently, all subframes have same energy ratio value. */ #endif instDirectionSmoothness = min( max( instDirectionSmoothness, 0.0f ), 1.0f ); @@ -1588,11 +1514,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /*-----------------------------------------------------------------* * gain interpolation and output streams *-----------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS for ( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) -#else - for ( buf_idx = 0; buf_idx < hDirAC->subframe_nbslots; ++buf_idx ) -#endif { g1 = h_dirac_output_synthesis_params->interpolator[buf_idx]; g2 = 1.f - g1; @@ -1834,11 +1756,9 @@ 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 */ -#ifdef JBM_TSM_ON_TCS const int16_t *azimuth, const int16_t *elevation, const int16_t md_idx, -#endif const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ const float *p_Rmat /* i : rotation matrix */ @@ -1852,9 +1772,6 @@ void ivas_dirac_dec_compute_directional_responses( float direct_response_ls[MAX_OUTPUT_CHANNELS]; float direct_response_square[MAX_OUTPUT_CHANNELS]; float *direct_response; -#ifndef JBM_TSM_ON_TCS - const int16_t *azimuth, *elevation; -#endif const int16_t *azimuth2, *elevation2; float direct_response_dir2[MAX_OUTPUT_CHANNELS]; float directRatio[MASA_MAXIMUM_DIRECTIONS]; @@ -1875,21 +1792,11 @@ void ivas_dirac_dec_compute_directional_responses( } num_channels_dir = hDirAC->num_outputs_dir; -#ifdef JBM_TSM_ON_TCS if ( hDirAC->numSimultaneousDirections == 2 ) { azimuth2 = hDirAC->azimuth2[md_idx]; elevation2 = hDirAC->elevation2[md_idx]; } -#else - azimuth = hDirAC->azimuth[hDirAC->dirac_read_idx]; - elevation = hDirAC->elevation[hDirAC->dirac_read_idx]; - if ( hDirAC->numSimultaneousDirections == 2 ) - { - azimuth2 = hDirAC->azimuth2[hDirAC->dirac_read_idx]; - elevation2 = hDirAC->elevation2[hDirAC->dirac_read_idx]; - } -#endif codingBand = -1; assert( num_channels_dir <= MAX_OUTPUT_CHANNELS && "Number of channels is too high" ); @@ -1957,29 +1864,15 @@ void ivas_dirac_dec_compute_directional_responses( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { /* Synthesize the first direction */ -#ifdef JBM_TSM_ON_TCS spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#else - spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_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 JBM_TSM_ON_TCS spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#else - spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#endif /* Combine gains from the two directions */ -#ifdef JBM_TSM_ON_TCS totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; -#else - 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; -#endif for ( l = 0; l < num_channels_dir; l++ ) { direct_response_hoa[l] *= directRatio[0]; @@ -2027,33 +1920,19 @@ void ivas_dirac_dec_compute_directional_responses( else if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ { /* Synthesize the first direction */ -#ifdef JBM_TSM_ON_TCS spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); -#else - spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_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 JBM_TSM_ON_TCS spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); -#else - spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); -#endif normalizePanningGains( direct_response_dir2, num_channels_dir ); /* Combine gains from the two directions */ -#ifdef JBM_TSM_ON_TCS totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; -#else - 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; -#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 index 6faa3a3a49..d89f33e075 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -63,11 +63,9 @@ static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ int16_t *data /* o : flushed PCM samples */ -#endif ) { int16_t k, idx, num_bits_read; @@ -117,17 +115,10 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = nchan_ism; -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { @@ -201,11 +192,7 @@ ivas_error ivas_dec_setup( num_bits_read += MC_LS_SETUP_BITS; /* select MC format mode; reconfigure the MC format decoder */ -#ifdef JBM_TSM_ON_TCS ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, data ); -#else - ivas_mc_dec_config( st_ivas, idx ); -#endif } /*-------------------------------------------------------------------* @@ -696,9 +683,7 @@ ivas_error ivas_init_decoder( #endif int16_t sce_id, cpe_id; int16_t numCldfbAnalyses, numCldfbSyntheses; -#ifdef JBM_TSM_ON_TCS int16_t granularity, n_channels_transport_jbm; -#endif int32_t output_Fs, ivas_total_brate; int32_t binauralization_delay_ns; AUDIO_CONFIG output_config; @@ -1323,7 +1308,6 @@ ivas_error ivas_init_decoder( } } -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -1334,7 +1318,6 @@ ivas_error ivas_init_decoder( return error; } } -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -1368,7 +1351,6 @@ ivas_error ivas_init_decoder( st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -1379,7 +1361,6 @@ ivas_error ivas_init_decoder( return error; } } -#endif } if ( st_ivas->ivas_format == ISM_FORMAT && @@ -1475,7 +1456,6 @@ ivas_error ivas_init_decoder( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * Allocate and initialize JBM struct + buffer *-----------------------------------------------------------------*/ @@ -1499,7 +1479,6 @@ ivas_error ivas_init_decoder( return error; } } -#endif return error; } @@ -1722,9 +1701,7 @@ void ivas_initialize_handles_dec( st_ivas->hLsSetupCustom = NULL; st_ivas->hRenderConfig = NULL; -#ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer = NULL; -#endif return; } @@ -1803,9 +1780,7 @@ void ivas_destroy_dec( /* ISM renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) { -#ifdef JBM_TSM_ON_TCS free( st_ivas->hIsmRendererData->interpolator ); -#endif free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } @@ -1919,9 +1894,7 @@ void ivas_destroy_dec( st_ivas->hDecoderConfig = NULL; } -#ifdef JBM_TSM_ON_TCS ivas_jbm_dec_tc_buffer_close( &st_ivas->hTcBuffer ); -#endif /* main IVAS handle */ free( st_ivas ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index fe98ca0dcb..2974e9d137 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -32,9 +32,7 @@ #include #include "options.h" -#ifdef JBM_TSM_ON_TCS #include "prot.h" -#endif #include "ivas_prot.h" #include "ivas_prot_rend.h" #ifdef DEBUGGING @@ -52,18 +50,15 @@ 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 */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples rendered */ int16_t *data /* o : rendered samples */ -#endif ) { ivas_error error; int32_t element_brate_tmp[MAX_NUM_OBJECTS]; int16_t nSCE_old, nCPE_old; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old, ism_mode; -#ifdef JBM_TSM_ON_TCS TC_BUFFER_MODE tc_buffer_mode_new; int16_t tc_nchan_tc_new; int16_t tc_nchan_allocate_new; @@ -71,7 +66,6 @@ static ivas_error ivas_ism_bitrate_switching( AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; RENDERER_TYPE renderer_type_old; -#endif error = IVAS_ERR_OK; @@ -109,13 +103,11 @@ static ivas_error ivas_ism_bitrate_switching( return error; } -#ifdef JBM_TSM_ON_TCS /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; hIntSetupOld = st_ivas->hIntSetup; tc_granularity_new = 1; renderer_type_old = st_ivas->renderer_type; -#endif /*-----------------------------------------------------------------* * Initialize the needed renderer struct and destroy the unnecessary renderer struct @@ -129,7 +121,6 @@ static ivas_error ivas_ism_bitrate_switching( ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); } -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ @@ -162,7 +153,6 @@ static ivas_error ivas_ism_bitrate_switching( } } } -#endif if ( st_ivas->ism_mode != last_ism_mode ) { @@ -206,9 +196,7 @@ static ivas_error ivas_ism_bitrate_switching( /* close the ISM renderer and reinitialize */ if ( st_ivas->hIsmRendererData != NULL ) { -#ifdef JBM_TSM_ON_TCS free( st_ivas->hIsmRendererData->interpolator ); -#endif free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } @@ -292,9 +280,7 @@ static ivas_error ivas_ism_bitrate_switching( /* Close the ISM renderer */ if ( st_ivas->hIsmRendererData != NULL ) { -#ifdef JBM_TSM_ON_TCS free( st_ivas->hIsmRendererData->interpolator ); -#endif free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } @@ -327,7 +313,6 @@ static ivas_error ivas_ism_bitrate_switching( return error; } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * Reconfigure TC buffer *-----------------------------------------------------------------*/ @@ -375,7 +360,6 @@ static ivas_error ivas_ism_bitrate_switching( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } -#endif return error; } @@ -392,11 +376,9 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ , const ISM_MODE last_ism_mode /* i/o: last ISM mode */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ int16_t *data -#endif ) { int32_t ivas_total_brate; @@ -437,11 +419,7 @@ ivas_error ivas_ism_dec_config( { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -464,11 +442,7 @@ ivas_error ivas_ism_dec_config( /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 054603a15e..1c48050bee 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -95,11 +95,7 @@ ivas_error ivas_ism_dtx_dec( st_ivas->ism_mode = ism_mode_bstr; } -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, NULL, NULL ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 086e8a36a8..3a9d7f625c 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -158,7 +158,6 @@ static void ivas_ism_get_proto_matrix( } -#ifdef JBM_TSM_ON_TCS static void ivas_param_ism_collect_slot( DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ float *Cldfb_RealBuffer_in, @@ -286,129 +285,8 @@ static void ivas_param_ism_compute_mixing_matrix( return; } -#else -static void ivas_param_ism_compute_mixing_matrix( - 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], - float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN], - const int16_t nchan_transport, - const int16_t nchan_out_woLFE, - const int16_t slot_idx_start, - const int16_t slot_idx_stop, - float mixing_matrix[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX] ) -{ - int16_t slot_idx, band_idx, ch, bin_idx; - int16_t i, w, obj_indx; - float tmp, ref_power; - int16_t brange[2]; - float cx_diag[PARAM_ISM_MAX_DMX]; - float direct_power[MAX_NUM_OBJECTS]; - float cy_diag[PARAM_ISM_MAX_CHAN]; - float cy_diag_tmp[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN]; - float *dir_res_ptr; - float *proto_matrix; - float response_matrix[PARAM_ISM_MAX_CHAN * MAX_NUM_OBJECTS]; - int16_t num_wave; - - proto_matrix = hDirAC->hParamIsmRendering->proto_matrix; - - assert( ( nchan_ism == 3 ) || ( nchan_ism == 4 ) ); - assert( nchan_transport == 2 ); - - if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) - { - num_wave = nchan_ism; - } - else - { - num_wave = MAX_PARAM_ISM_WAVE; - } - - set_zero( response_matrix, PARAM_ISM_MAX_CHAN * MAX_NUM_OBJECTS ); - - /* loop over parameter bands to compute the mixing matrix */ - for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) - { - brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; - brange[1] = hDirAC->hParamIsm->band_grouping[band_idx + 1]; - - /* Compute covaraince matrix from direct response*/ - for ( w = 0; w < num_wave; w++ ) - { - set_zero( cy_diag_tmp[w], nchan_out_woLFE ); - if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) - { - dir_res_ptr = direct_response[w]; - } - else - { - obj_indx = hDirAC->hParamIsm->obj_indices[band_idx][0][w]; - dir_res_ptr = direct_response[obj_indx]; - } - mvr2r( dir_res_ptr, response_matrix + w * nchan_out_woLFE, nchan_out_woLFE ); - /* we only need the diagonal of Cy*/ - matrix_product_diag( dir_res_ptr, nchan_out_woLFE, 1, 0, dir_res_ptr, 1, nchan_out_woLFE, 0, cy_diag_tmp[w] ); - } - for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) - { - /* compute input matrix for covariance rendering */ - set_f( cx_diag, 0.0f, nchan_transport ); - for ( ch = 0; ch < nchan_transport; ch++ ) - { - tmp = 0.0f; - for ( slot_idx = slot_idx_start; slot_idx < slot_idx_stop; slot_idx++ ) - { - tmp += ( Cldfb_RealBuffer_in[ch][slot_idx][bin_idx] * Cldfb_RealBuffer_in[ch][slot_idx][bin_idx] ); - tmp += ( Cldfb_ImagBuffer_in[ch][slot_idx][bin_idx] * Cldfb_ImagBuffer_in[ch][slot_idx][bin_idx] ); - } - - cx_diag[ch] = tmp; - } - - ref_power = 0.0f; - for ( slot_idx = slot_idx_start; slot_idx < slot_idx_stop; slot_idx++ ) - { - ref_power += ( Cldfb_RealBuffer_in[0][slot_idx][bin_idx] * Cldfb_RealBuffer_in[0][slot_idx][bin_idx] ) + ( Cldfb_ImagBuffer_in[0][slot_idx][bin_idx] * Cldfb_ImagBuffer_in[0][slot_idx][bin_idx] ); - ref_power += ( Cldfb_RealBuffer_in[1][slot_idx][bin_idx] * Cldfb_RealBuffer_in[1][slot_idx][bin_idx] ) + ( Cldfb_ImagBuffer_in[1][slot_idx][bin_idx] * Cldfb_ImagBuffer_in[1][slot_idx][bin_idx] ); - } - set_zero( cy_diag, nchan_out_woLFE ); - for ( w = 0; w < num_wave; w++ ) - { - if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) - { - direct_power[w] = ( 1.0f / nchan_ism ) * ref_power; - } - else - { - direct_power[w] = hDirAC->power_ratios[band_idx][0][w] * ref_power; - } - - if ( direct_power[w] != 0.f ) - { - for ( i = 0; i < nchan_out_woLFE; i++ ) - { - cy_diag[i] += direct_power[w] * cy_diag_tmp[w][i]; - } - } - direct_power[w] = sqrtf( direct_power[w] ); - } - /* Compute mixing matrix */ - computeMixingMatricesISM( nchan_transport, num_wave, nchan_out_woLFE, response_matrix, direct_power, cx_diag, cy_diag, proto_matrix, 1, - PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix[bin_idx] ); - } - } - - return; -} -#endif - - -#ifdef JBM_TSM_ON_TCS static void ivas_param_ism_render_slot( DIRAC_DEC_HANDLE hDirAC, float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX], @@ -444,7 +322,6 @@ static void ivas_param_ism_render_slot( return; } -#endif static void ivas_param_ism_rendering( @@ -603,7 +480,6 @@ ivas_error ivas_param_ism_dec_open( *-----------------------------------------------------------------*/ hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); -#ifdef JBM_TSM_ON_TCS hDirAC->hConfig = NULL; set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); @@ -611,11 +487,6 @@ ivas_error ivas_param_ism_dec_open( hDirAC->subframes_rendered = 0; hDirAC->slots_rendered = 0; hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; -#else - hDirAC->subframe_nbslots = (int16_t) ( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); - hDirAC->nb_subframes = CLDFB_NO_COL_MAX / hDirAC->subframe_nbslots; - assert( hDirAC->nb_subframes <= MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -647,7 +518,6 @@ ivas_error ivas_param_ism_dec_open( if ( !( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) { /* Initialize Param ISM Rendering handle */ -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { if ( ( error = ivas_param_ism_rendering_init( hDirAC->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, MAX_JBM_CLDFB_TIMESLOTS, output_config ) ) != IVAS_ERR_OK ) @@ -657,14 +527,11 @@ ivas_error ivas_param_ism_dec_open( } else { -#endif if ( ( error = ivas_param_ism_rendering_init( hDirAC->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, CLDFB_NO_COL_MAX, output_config ) ) != IVAS_ERR_OK ) { return error; } -#ifdef JBM_TSM_ON_TCS } -#endif } if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM || output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) @@ -680,20 +547,13 @@ ivas_error ivas_param_ism_dec_open( set_zero( hDirAC->azimuth_values, MAX_NUM_OBJECTS ); set_zero( hDirAC->elevation_values, MAX_NUM_OBJECTS ); -#ifdef JBM_TSM_ON_TCS hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; -#else - hDirAC->dirac_md_buffer_length = 0; -#endif hDirAC->dirac_bs_md_write_idx = 0; hDirAC->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; if ( ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { -#ifndef JBM_TSM_ON_TCS - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; -#endif if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 1 ) ) != IVAS_ERR_OK ) { return error; @@ -709,7 +569,6 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hDirAC = hDirAC; -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) @@ -763,7 +622,6 @@ ivas_error ivas_param_ism_dec_open( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; } -#endif pop_wmops(); return error; @@ -818,7 +676,6 @@ void ivas_param_ism_dec_close( } } -#ifdef JBM_TSM_ON_TCS if ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc != NULL ) { free( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc ); @@ -829,7 +686,6 @@ void ivas_param_ism_dec_close( free( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc ); hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; } -#endif if ( hDirAC->hParamIsmRendering != NULL ) { @@ -858,10 +714,8 @@ void ivas_param_ism_dec( int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; int16_t subframe_idx, slot_idx, index_slot, bin_idx; int32_t ivas_total_brate; -#ifdef JBM_TSM_ON_TCS float ref_power[CLDFB_NO_CHANNELS_MAX]; float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; -#endif /* CLDFB Input Buffers */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -903,14 +757,12 @@ void ivas_param_ism_dec( push_wmops( "ivas_param_ism_dec" ); -#ifdef JBM_TSM_ON_TCS /* set buffers to zero */ for ( bin_idx = 0; bin_idx < CLDFB_NO_CHANNELS_MAX; bin_idx++ ) { set_zero( cx_diag[bin_idx], PARAM_ISM_MAX_DMX ); } set_zero( ref_power, CLDFB_NO_CHANNELS_MAX ); -#endif /* Frame-level Processing */ /* De-quantization */ @@ -977,9 +829,7 @@ void ivas_param_ism_dec( { cldfbAnalysis_ts( &( output_f[ch][hDirAC->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); -#ifdef JBM_TSM_ON_TCS ivas_param_ism_collect_slot( hDirAC, Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], ch, ref_power, cx_diag ); -#endif } } @@ -990,41 +840,25 @@ void ivas_param_ism_dec( } /* Compute mixing matrix */ -#ifdef JBM_TSM_ON_TCS ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, mixing_matrix ); -#else - 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 ); -#endif /* subframe loop for synthesis*/ for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) { -#ifdef JBM_TSM_ON_TCS uint16_t slot_idx_start = subframe_idx * hDirAC->subframe_nbslots[subframe_idx]; -#else - uint16_t slot_idx_start = subframe_idx * hDirAC->subframe_nbslots; -#endif uint16_t idx_in; uint16_t idx_lfe; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); } } -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { index_slot = slot_idx_start + slot_idx; @@ -1042,11 +876,7 @@ void ivas_param_ism_dec( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { -#ifdef JBM_TSM_ON_TCS set_zero( &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); -#else - set_zero( &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); -#endif if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -1058,23 +888,14 @@ void ivas_param_ism_dec( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < hDirAC->subframe_nbslots; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } -#ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); -#else - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[ch] ); -#endif idx_in++; } @@ -1105,7 +926,6 @@ void ivas_param_ism_dec( return; } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------------* * ivas_ism_dec_digest_tc() @@ -1534,7 +1354,6 @@ void ivas_param_ism_dec_render( return; } -#endif /*-------------------------------------------------------------------------* diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 031c6cf18f..32f0393c0e 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -58,9 +58,7 @@ ivas_error ivas_ism_renderer_open( { int16_t i; uint16_t interpolator_length; -#ifdef JBM_TSM_ON_TCS uint16_t init_interpolator_length; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -81,12 +79,9 @@ ivas_error ivas_ism_renderer_open( for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); -#ifdef JBM_TSM_ON_TCS set_f( st_ivas->hIsmRendererData->gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); -#endif } -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { init_interpolator_length = NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_CLDFB_TIMESLOTS * CLDFB_SLOT_NS ); @@ -102,13 +97,6 @@ ivas_error ivas_ism_renderer_open( { st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); } -#else - interpolator_length = (uint16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - for ( i = 0; i < interpolator_length; i++ ) - { - st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); - } -#endif return error; } @@ -122,11 +110,7 @@ ivas_error ivas_ism_renderer_open( void ivas_ism_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: core-coder transport channels/object output */ -#else - float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ -#endif const int16_t output_frame /* i : output frame length per channel */ ) { @@ -229,7 +213,6 @@ void ivas_ism_render( return; } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------------* * ivas_ism_render_sf() * @@ -320,7 +303,6 @@ void ivas_ism_render_sf( return; } -#endif /*-------------------------------------------------------------------------* diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 04ae490414..dc54aa9734 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -46,7 +46,6 @@ #include "wmc_auto.h" -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------------* * Local function prototypes @@ -1864,4 +1863,3 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( return buffer_mode; } -#endif diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index d284d3f7d9..a33c48b85b 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -405,7 +405,6 @@ ivas_error ivas_masa_dec_open( st_ivas->hMasa = hMasa; -#ifdef JBM_TSM_ON_TCS /* allocate transport channels*/ if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { @@ -424,7 +423,6 @@ ivas_error ivas_masa_dec_open( return error; } } -#endif /* JBM_TMS_ON_TCS*/ return error; } @@ -1118,7 +1116,6 @@ ivas_error ivas_masa_dec_reconfigure( ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active == 1 ) { int16_t tc_nchan_to_allocate; @@ -1142,14 +1139,11 @@ ivas_error ivas_masa_dec_reconfigure( } } } -#endif return error; } -#ifdef JBM_TSM_ON_TCS -#endif void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ @@ -1174,11 +1168,9 @@ void ivas_spar_param_to_masa_param_mapping( float foaCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; float Iy, Iz, Ix, E, azi, ele, I, ratio; float diffuseGainX, diffuseGainY, diffuseGainZ, diffuseGainSum; -#ifdef JBM_TSM_ON_TCS int16_t slot_idx, slot_idx_start, sf; SPAR_DEC_HANDLE hSpar; float slot_fac; -#endif /* Set values */ hDirAC = st_ivas->hDirAC; @@ -1186,12 +1178,8 @@ void ivas_spar_param_to_masa_param_mapping( hDiffuseDist = st_ivas->hDirAC->hDiffuseDist; nchan_transport = st_ivas->nchan_transport; band_grouping = hDirAC->band_grouping; -#ifdef JBM_TSM_ON_TCS hSpar = st_ivas->hSpar; dirac_write_idx = hDirAC->render_to_md_map[subframe]; -#else - dirac_write_idx = hDirAC->dirac_read_idx; /* Mixing matrices, from which MASA meta is determined, already have the delay compensation */ -#endif /* Init arrays */ for ( i = 0; i < FOA_CHANNELS; i++ ) @@ -1200,61 +1188,41 @@ void ivas_spar_param_to_masa_param_mapping( } /* Delay the SPAR mixing matrices to have them synced with the audio */ -#ifdef JBM_TSM_ON_TCS slot_idx_start = hSpar->slots_rendered; slot_fac = 1.0f / (float) hSpar->subframe_nbslots[subframe]; for ( slot_idx = 0; slot_idx < hSpar->subframe_nbslots[subframe]; slot_idx++ ) { sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME; -#endif if ( subframe < SPAR_META_DELAY_SUBFRAMES ) { -#ifdef JBM_TSM_ON_TCS mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; -#else - mixer_mat_index = subframe + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; -#endif for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) { for ( i = 0; i < FOA_CHANNELS; i++ ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { -#ifdef JBM_TSM_ON_TCS mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; -#else - mixer_mat_sf_bands_real[band][i][j] = st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; -#endif } } } } else { -#ifdef JBM_TSM_ON_TCS mixer_mat_index = sf - SPAR_META_DELAY_SUBFRAMES; -#else - mixer_mat_index = subframe - SPAR_META_DELAY_SUBFRAMES; -#endif for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) { for ( i = 0; i < FOA_CHANNELS; i++ ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { -#ifdef JBM_TSM_ON_TCS mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; -#else - mixer_mat_sf_bands_real[band][i][j] = st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; -#endif } } } } -#ifdef JBM_TSM_ON_TCS } -#endif /* Map the mixing matrices from the frequency bands to frequency bins */ bin = 0; @@ -1283,11 +1251,7 @@ void ivas_spar_param_to_masa_param_mapping( set_zero( transportSignalEnergies[1], nBins ); set_zero( transportSignalCrossCorrelation, nBins ); -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) -#else - for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) -#endif { for ( bin = 0; bin < nBins; bin++ ) { @@ -1305,15 +1269,9 @@ void ivas_spar_param_to_masa_param_mapping( if ( hDiffuseDist != NULL ) { -#ifdef JBM_TSM_ON_TCS set_zero( hDiffuseDist->diffuseRatioX, CLDFB_NO_CHANNELS_MAX ); set_zero( hDiffuseDist->diffuseRatioY, CLDFB_NO_CHANNELS_MAX ); set_zero( hDiffuseDist->diffuseRatioZ, CLDFB_NO_CHANNELS_MAX ); -#else - set_zero( hDiffuseDist->diffuseRatioX[subframe], CLDFB_NO_CHANNELS_MAX ); - set_zero( hDiffuseDist->diffuseRatioY[subframe], CLDFB_NO_CHANNELS_MAX ); - set_zero( hDiffuseDist->diffuseRatioZ[subframe], CLDFB_NO_CHANNELS_MAX ); -#endif } for ( bin = 0; bin < nBins; bin++ ) @@ -1385,7 +1343,6 @@ void ivas_spar_param_to_masa_param_mapping( diffuseGainSum = diffuseGainY + diffuseGainX + diffuseGainZ; -#ifdef JBM_TSM_ON_TCS if ( diffuseGainSum == 0.0f ) { hDiffuseDist->diffuseRatioX[bin] = 1.0f / 3.0f; @@ -1398,20 +1355,6 @@ void ivas_spar_param_to_masa_param_mapping( hDiffuseDist->diffuseRatioY[bin] = diffuseGainY / ( diffuseGainSum + EPSILON ); hDiffuseDist->diffuseRatioZ[bin] = diffuseGainZ / ( diffuseGainSum + EPSILON ); } -#else - if ( diffuseGainSum == 0.0f ) - { - hDiffuseDist->diffuseRatioX[subframe][bin] = 1.0f / 3.0f; - hDiffuseDist->diffuseRatioY[subframe][bin] = 1.0f / 3.0f; - hDiffuseDist->diffuseRatioZ[subframe][bin] = 1.0f / 3.0f; - } - else - { - hDiffuseDist->diffuseRatioX[subframe][bin] = diffuseGainX / ( diffuseGainSum + EPSILON ); - hDiffuseDist->diffuseRatioY[subframe][bin] = diffuseGainY / ( diffuseGainSum + EPSILON ); - hDiffuseDist->diffuseRatioZ[subframe][bin] = diffuseGainZ / ( diffuseGainSum + EPSILON ); - } -#endif } } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 4be35d188e..32c332ec53 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -76,11 +76,7 @@ typedef struct parameter_band_mapping_struct static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, const int16_t nchan_in, const int16_t nchan_out ); -#ifdef JBM_TSM_ON_TCS static void param_mc_protoSignalComputation( float *RealBuffer, float *ImagBuffer, float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands ); -#else -static void param_mc_protoSignalComputation( float RealBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t slot_index, const int16_t num_freq_bands ); -#endif static void ivas_param_mc_dec_copy_diffuse_proto( PARAM_MC_DEC_HANDLE hParamMC, float Cldfb_buffer_real[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Cldfb_buffer_imag[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nY, const int16_t slot_idx ); @@ -90,21 +86,11 @@ static int16_t ivas_param_mc_uniform_decoder( float *seq, const int16_t sz_seq, static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hDirAC, float *ild_q, float *icc_q, const int16_t param_band_index, const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nY, const int16_t nX, float *Cx_state, float *Cproto, float *Cy_state ); -#ifdef JBM_TSM_ON_TCS static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); -#else -static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); - -static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); -#endif -#ifdef JBM_TSM_ON_TCS static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float *mixing_matrix[], float *mixing_matrix_res[], const uint16_t nX, const uint16_t nY ); -#else -static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const uint16_t nX, const uint16_t nY ); -#endif static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, const uint16_t attackPos, const uint16_t interp_length, float *interpolator ); @@ -238,13 +224,9 @@ ivas_error ivas_param_mc_dec_open( *-----------------------------------------------------------------*/ hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; -#ifdef JBM_TSM_ON_TCS set_s( hParamMC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hParamMC->subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); hParamMC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; -#else - hParamMC->subframe_nbslots = CLDFB_NO_COL_MAX / PARAM_MC_NSUBFRAMES_DEC; -#endif hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; @@ -440,9 +422,7 @@ ivas_error ivas_param_mc_dec_open( return error; } -#ifdef JBM_TSM_ON_TCS ivas_param_mc_dec_compute_interpolator( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator ); -#endif /* Head rotation */ if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && st_ivas->hDecoderConfig->Opt_Headrotation ) @@ -478,7 +458,6 @@ ivas_error ivas_param_mc_dec_open( ivas_param_mc_dec_init( hParamMC, nchan_transport, nchan_out_cov ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active && hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) { if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) @@ -509,7 +488,6 @@ ivas_error ivas_param_mc_dec_open( hParamMC->subframes_rendered = 0; hParamMC->slots_rendered = 0; -#endif st_ivas->hParamMC = hParamMC; @@ -657,10 +635,6 @@ ivas_error ivas_param_mc_dec_reconfig( * set input parameters *-----------------------------------------------------------------*/ -#ifndef JBM_TSM_ON_TCS - hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; - hParamMC->subframe_nbslots = CLDFB_NO_COL_MAX / PARAM_MC_NSUBFRAMES_DEC; -#endif hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; @@ -971,9 +945,7 @@ ivas_error ivas_param_mc_dec_reconfig( return error; } -#ifdef JBM_TSM_ON_TCS ivas_param_mc_dec_compute_interpolator( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator ); -#endif ivas_dirac_dec_output_synthesis_cov_init( &( hParamMC->h_output_synthesis_cov_state ), nchan_transport, nchan_out_cov, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual ); @@ -1185,7 +1157,6 @@ void ivas_param_mc_dec_close( hParamMC->hoa_encoder = NULL; } -#ifdef JBM_TSM_ON_TCS if ( hParamMC->Cldfb_RealBuffer_tc != NULL ) { free( hParamMC->Cldfb_RealBuffer_tc ); @@ -1196,7 +1167,6 @@ void ivas_param_mc_dec_close( free( hParamMC->Cldfb_ImagBuffer_tc ); hParamMC->Cldfb_ImagBuffer_tc = NULL; } -#endif free( *hParamMC_out ); *hParamMC_out = NULL; @@ -1315,9 +1285,6 @@ void ivas_param_mc_dec_read_BS( num_lfe_bands = 0; } -#ifndef JBM_TSM_ON_TCS - ivas_param_mc_dec_compute_interpolator( hMetadataPMC->bAttackPresent, hMetadataPMC->attackIndex, PARAM_MC_MAX_NSLOTS, hParamMC->h_output_synthesis_params.interpolator ); -#endif if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) { @@ -1404,9 +1371,6 @@ void ivas_param_mc_dec_read_BS( /* for PLC, use the saved ILDs and ICCs from the past and set the transient flag and transient position to zero */ hMetadataPMC->bAttackPresent = 0; hMetadataPMC->attackIndex = 0; -#ifndef JBM_TSM_ON_TCS - ivas_param_mc_dec_compute_interpolator( hMetadataPMC->bAttackPresent, hMetadataPMC->attackIndex, PARAM_MC_MAX_NSLOTS, hParamMC->h_output_synthesis_params.interpolator ); -#endif } pop_wmops(); @@ -1415,7 +1379,6 @@ void ivas_param_mc_dec_read_BS( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------------- * ivas_param_mc_dec_digest_tc() * @@ -1845,7 +1808,6 @@ void ivas_param_mc_dec_render( return; } -#endif /*------------------------------------------------------------------------- @@ -1854,7 +1816,6 @@ void ivas_param_mc_dec_render( * Parametric MC decoding process *------------------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS void ivas_param_mc_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ @@ -1888,330 +1849,6 @@ void ivas_param_mc_dec( pop_wmops(); return; } -#else -void ivas_param_mc_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -) -{ - PARAM_MC_DEC_HANDLE hParamMC; - int16_t i, ch; - int16_t subframe_idx; - int16_t nb_subframes; - int16_t slot_idx, param_band_idx, slot_idx_start; - int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; - int16_t nchan_out_cov; - /*CLDFB*/ - float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - float real_part, imag_part; - /*Decorrelator*/ - float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; - /* format converter */ - int16_t channel_active[MAX_OUTPUT_CHANNELS]; - uint16_t nband_synth, nbands_to_zero; - uint16_t nchan_out_init; - IVAS_OUTPUT_SETUP *hSynthesisOutputSetup; - - hParamMC = st_ivas->hParamMC; - assert( hParamMC ); - - push_wmops( "param_mc_dec" ); - - set_s( channel_active, 0, MAX_CICP_CHANNELS ); - nchan_transport = st_ivas->nchan_transport; - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - nchan_out_init = nchan_out_transport; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - nchan_out_cldfb = BINAURAL_CHANNELS; - set_s( channel_active, 1, nchan_out_cldfb ); - if ( st_ivas->hHeadTrackData ) - { - nchan_out_init = MAX_INTERN_CHANNELS; - } - nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) - { - nchan_out_cov = nchan_out_transport; - nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - nchan_out_cldfb = nchan_out_cov; - set_s( channel_active, 1, nchan_out_cov ); - hSynthesisOutputSetup = &st_ivas->hOutSetup; - } - else - { - nchan_out_cov = nchan_out_transport; - nchan_out_cldfb = nchan_out_transport; - set_s( channel_active, 1, nchan_out_cov ); - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - - /* set everything to zero that will not be decoded */ - nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; - nbands_to_zero = hParamMC->num_freq_bands - nband_synth; - for ( ch = 0; ch < nchan_out_init; ch++ ) - { - for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots; slot_idx++ ) - { - set_zero( &( Cldfb_RealBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); - set_zero( &( Cldfb_ImagBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); - } - } - - for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ ) - { - set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - set_zero( cx_imag[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - } - - /* slot loop for gathering the input data */ - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) - { - float RealBuffer[CLDFB_NO_CHANNELS_MAX]; - float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts( &( output_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - - mvr2r( RealBuffer, Cldfb_RealBuffer_in[ch][slot_idx], hParamMC->num_freq_bands ); - mvr2r( ImagBuffer, Cldfb_ImagBuffer_in[ch][slot_idx], hParamMC->num_freq_bands ); - } - - if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) - { - ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, cx, cx_imag, hParamMC, nchan_transport, slot_idx ); - } - } - - /* map from complex input covariance to real values */ - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) - { - /* Cx for transport channels */ - for ( i = 0; i < nchan_transport * nchan_transport; i++ ) - { - real_part = cx[param_band_idx][i]; - imag_part = cx_imag[param_band_idx][i]; - - /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ - if ( param_band_idx < hParamMC->max_param_band_abs_cov ) - { - cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part ); - } - else - { - cx[param_band_idx][i] = real_part; - } - } - } - - /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/ - if ( hParamMC->hMetadataPMC->bAttackPresent && ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) ) - { - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 ) - { - v_add( cx[param_band_idx], cx[param_band_idx + 1], cx[param_band_idx], nchan_transport * nchan_transport ); - mvr2r( cx[param_band_idx], cx[param_band_idx + 1], nchan_transport * nchan_transport ); - } - } - - - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, cx, mixing_matrix, mixing_matrix_res, nchan_out_transport, nchan_transport, nchan_out_cov ); - } - else - { - /* generate mixing matrices */ - ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, mixing_matrix, mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); - } - - /*** split here... ***/ - - /* subframe loop for synthesis*/ - nb_subframes = CLDFB_NO_COL_MAX / hParamMC->subframe_nbslots; - for ( subframe_idx = 0; subframe_idx < nb_subframes; subframe_idx++ ) - { - slot_idx_start = subframe_idx * hParamMC->subframe_nbslots; - for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots; slot_idx++ ) - { - - if ( hParamMC->max_band_decorr > 0 ) - { - /*-----------------------------------------------------------------* - * protoype signal computation - *-----------------------------------------------------------------*/ - - param_mc_protoSignalComputation( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, - hParamMC->proto_frame_f, hParamMC->diff_proto_info, - slot_idx + slot_idx_start, hParamMC->num_freq_bands ); - - /*-----------------------------------------------------------------* - * frequency domain decorrelation - *-----------------------------------------------------------------*/ - - /* decorrelate prototype frame */ - ivas_dirac_dec_decorr_process( hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - nchan_transport, - hParamMC->proto_frame_f, - hParamMC->diff_proto_info->num_protos_diff, - hParamMC->diff_proto_info->proto_index_diff, - hParamMC->proto_frame_dec_f, - onset_filter, - hParamMC->h_freq_domain_decorr_ap_params, - hParamMC->h_freq_domain_decorr_ap_state ); - - /* copy decorrelated frame directly to output CLDFB buffer, acts also as intermediate */ - /* memory for the decorrelated signal */ - ivas_param_mc_dec_copy_diffuse_proto( hParamMC, Cldfb_RealBuffer, Cldfb_ImagBuffer, nchan_out_cov, slot_idx ); - } - - /*-----------------------------------------------------------------* - * output synthesis - *-----------------------------------------------------------------*/ - - ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, - mixing_matrix, mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, - nchan_transport, nchan_out_cov, hParamMC ); - - if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) - { - if ( st_ivas->hHeadTrackData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) - { - ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE ); - } - else - { - /* remove LFE */ - uint16_t idx_out; - uint16_t idx_lfe; - IVAS_OUTPUT_SETUP hLsSetup; - - hLsSetup = st_ivas->hTransSetup; - - /* If LFE should be rendered, add it to other channels before removing */ - if ( st_ivas->hBinRenderer->render_lfe ) - { - for ( idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++ ) - { - /* Copy just the first band of LFE*/ - v_multc( Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); - v_multc( Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); - - for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) - { - if ( hLsSetup.index_lfe[idx_lfe] != ch ) - { - v_add( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer[ch][slot_idx], 1 ); - v_add( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], 1 ); - } - } - } - } - - idx_out = 0; - idx_lfe = 0; - - for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) - { - if ( ( hLsSetup.num_lfe > 0 ) && ( hLsSetup.index_lfe[idx_lfe] == ch ) ) - { - if ( idx_lfe < ( hLsSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ch != idx_out ) - { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[idx_out][slot_idx], nband_synth ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[idx_out][slot_idx], nband_synth ); - idx_out++; - } - else - { - idx_out++; - } - } - } - } - } - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) - { - /* format conversion*/ - ivas_lssetupconversion_process_param_mc( st_ivas, Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active ); - } - - /* CLDFB synthesis */ - for ( ch = 0; ch < nchan_out_cldfb; ch++ ) - { - float *RealBuffer[16]; - float *ImagBuffer[16]; - - if ( channel_active[ch] ) - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hParamMC->subframe_nbslots; i++ ) - { - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; - } - else - { - RealBuffer[i] = Cldfb_RealBuffer[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[ch][i]; - } - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hParamMC->num_freq_bands] ), - hParamMC->num_freq_bands * hParamMC->subframe_nbslots, st_ivas->cldfbSynDec[ch] ); - } - else - { - set_f( &( output_f[ch][slot_idx_start * hParamMC->num_freq_bands] ), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots ); - } - } - } - - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) - { - ivas_mc2sba( st_ivas->hIntSetup, output_f, hParamMC->num_freq_bands * PARAM_MC_MAX_NSLOTS, st_ivas->hOutSetup.ambisonics_order, 0.f ); - } - - /* update */ - hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; - param_mc_update_mixing_matrices( hParamMC, mixing_matrix, mixing_matrix_res, nchan_transport, nchan_out_cov ); - pop_wmops(); - - return; -} -#endif /*------------------------------------------------------------------------- @@ -2286,18 +1923,10 @@ static void ivas_param_mc_dec_init( *------------------------------------------------------------------------*/ static void param_mc_protoSignalComputation( -#ifdef JBM_TSM_ON_TCS float *RealBuffer, /* i : CLDFB samples of the transport channels (real part) */ float *ImagBuffer, /* i : CLDFB samples of the transport channels (imaginary part) */ -#else - float RealBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ - float ImagBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ -#endif float *proto_frame_f, /* o : interleaved complex prototype CLDFB samples */ const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, /* i : prototype generation information */ -#ifndef JBM_TSM_ON_TCS - const int16_t slot_index, /* i : current slot index */ -#endif const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ ) { @@ -2319,13 +1948,8 @@ static void param_mc_protoSignalComputation( int16_t source_ch_idx = diff_proto_info->source_chan_idx[proto_ch_idx][source_ch_cnt]; p_proto_frame = &proto_frame_f[proto_ch_idx * num_freq_bands * 2]; -#ifdef JBM_TSM_ON_TCS p_real_buffer = &RealBuffer[source_ch_idx * num_freq_bands]; p_imag_buffer = &ImagBuffer[source_ch_idx * num_freq_bands]; -#else - p_real_buffer = &RealBuffer[source_ch_idx][slot_index][0]; - p_imag_buffer = &ImagBuffer[source_ch_idx][slot_index][0]; -#endif for ( band = 0; band < num_freq_bands; band++ ) { @@ -2504,11 +2128,7 @@ static void ivas_param_mc_dec_compute_interpolator( float *interpolator /* o : interpolator */ ) { -#ifdef JBM_TSM_ON_TCS int16_t idx; -#else - uint16_t idx; -#endif if ( bAttackPresent ) { @@ -2523,14 +2143,7 @@ static void ivas_param_mc_dec_compute_interpolator( } else { -#ifdef JBM_TSM_ON_TCS ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, interp_length, interpolator ); -#else - for ( idx = 1; idx <= interp_length; ++idx ) - { - interpolator[idx - 1] = (float) idx / (float) interp_length; - } -#endif } return; @@ -2590,13 +2203,8 @@ static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ -#ifdef JBM_TSM_ON_TCS float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : direct mixing matrices for all parameter bands */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* o : residual mixing matrices for all parameter bands */ -#endif const int16_t nY_intern, /* i : number of channels in the transported format */ const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ const int16_t nX, /* i : number of transport channels */ @@ -2849,13 +2457,8 @@ static void ivas_param_mc_get_mixing_matrices( static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : transport channel covariance for all parameter bands */ -#ifdef JBM_TSM_ON_TCS float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : direct mixing matrix */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* o : residual mixing matrix (set to zero) */ -#endif const int16_t nY_intern, /* i : number of channels of the transport format */ const int16_t nX, /* i : number of transport channels */ const int16_t nY_cov ) /* i : number of output channels */ @@ -2974,13 +2577,8 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: Parametric MC handle */ -#ifdef JBM_TSM_ON_TCS float *mixing_matrix[], /* i : direct mixing matrices for the frame just processed */ float *mixing_matrix_res[], /* i : residual mixing matrices for the frame just processed */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : direct mixing matrices for the frame just processed */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : residual mixing matrices for the frame just processed */ -#endif const uint16_t nX, /* i : number of transport channels */ const uint16_t nY ) /* i : number of synthesis channels */ { diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 46c4343800..a3a03f9ead 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -54,11 +54,7 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, int16_t *data ); -#else -static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas ); -#endif /*--------------------------------------------------------------------------* * ivas_mct_dec() @@ -625,11 +621,9 @@ void ivas_mct_dec_close( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ -#endif ) { AUDIO_CONFIG signaled_config; @@ -659,11 +653,7 @@ ivas_error ivas_mc_dec_config( { if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) { -#ifdef JBM_TSM_ON_TCS ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ); -#else - ivas_mc_dec_reconfig( st_ivas ); -#endif } } @@ -682,11 +672,9 @@ ivas_error ivas_mc_dec_config( static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ -#endif ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; @@ -696,14 +684,12 @@ static ivas_error ivas_mc_dec_reconfig( Decoder_State *st; ivas_error error; MC_MODE mc_mode, last_mc_mode; -#ifdef JBM_TSM_ON_TCS TC_BUFFER_MODE tc_buffer_mode_new; int16_t tc_nchan_tc_new; int16_t tc_nchan_allocate_new; int16_t tc_granularity_new; AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; -#endif error = IVAS_ERR_OK; @@ -734,12 +720,10 @@ static ivas_error ivas_mc_dec_reconfig( } st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#ifdef JBM_TSM_ON_TCS /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; hIntSetupOld = st_ivas->hIntSetup; tc_granularity_new = 1; -#endif /* renderer might have changed, reselect */ renderer_type_old = st_ivas->renderer_type; @@ -749,7 +733,6 @@ static ivas_error ivas_mc_dec_reconfig( /* side effect of the renderer selection can be a changed internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ @@ -788,7 +771,6 @@ static ivas_error ivas_mc_dec_reconfig( } } } -#endif if ( st_ivas->mc_mode == MC_MODE_MCT ) @@ -817,13 +799,11 @@ static ivas_error ivas_mc_dec_reconfig( ivas_masa_dec_close( &( st_ivas->hMasa ) ); ivas_qmetadata_close( &st_ivas->hQMetaData ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDirAC != NULL ) { ivas_dirac_dec_close( &st_ivas->hDirAC ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } -#endif /* init LS conversion if the renderer type asks for it */ if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL ) @@ -902,14 +882,12 @@ static ivas_error ivas_mc_dec_reconfig( ivas_masa_dec_close( &( st_ivas->hMasa ) ); ivas_qmetadata_close( &st_ivas->hQMetaData ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDirAC != NULL ) { ivas_dirac_dec_close( &st_ivas->hDirAC ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } -#endif if ( last_mc_mode == MC_MODE_MCT ) { @@ -1140,9 +1118,7 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); -#ifdef JBM_TSM_ON_TCS vbap_free_data( &( st_ivas->hVBAPdata ) ); -#endif } } @@ -1290,7 +1266,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * Reconfigure TC buffer *-----------------------------------------------------------------*/ @@ -1344,7 +1319,6 @@ static ivas_error ivas_mc_dec_reconfig( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } -#endif return error; } diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index c023c14f79..363fedaca2 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -67,11 +67,7 @@ ivas_error ivas_td_binaural_open( ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: SCE channels / Binaural synthesis */ -#else - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ -#endif const int16_t output_frame /* i : output frame length */ ) { @@ -94,7 +90,6 @@ ivas_error ivas_td_binaural_renderer( } -#ifdef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_sf() * @@ -223,4 +218,3 @@ ivas_error ivas_td_binaural_renderer_sf( return IVAS_ERR_OK; } -#endif diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 7d14ee5041..ae113204aa 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -498,12 +498,8 @@ void ivas_ls_setup_conversion( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ const int16_t input_chans, /* i : number of input channels to the renderer */ const int16_t output_frame, /* i : frame length */ -#ifdef JBM_TSM_ON_TCS float *input[], /* i : LS input/output synthesis signal */ float *output[] /* i/o: LS input/output synthesis signal */ -#else - float output[][L_FRAME48k] /* i/o: LS input/output synthesis signal */ -#endif ) { int16_t chInIdx, chOutIdx, idx; @@ -530,22 +526,14 @@ void ivas_ls_setup_conversion( { for ( idx = 0; idx < output_frame; idx++ ) { -#ifdef JBM_TSM_ON_TCS output_tmp[chOutIdx][idx] += input[chInIdx][idx]; -#else - output_tmp[chOutIdx][idx] += output[chInIdx][idx]; -#endif } } else { for ( idx = 0; idx < output_frame; idx++ ) { -#ifdef JBM_TSM_ON_TCS tmpVal = dmxCoeff * input[chInIdx][idx]; -#else - tmpVal = dmxCoeff * output[chInIdx][idx]; -#endif output_tmp[chOutIdx][idx] += tmpVal; } } @@ -1144,9 +1132,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( void ivas_lssetupconversion_process_param_mc( Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ -#ifdef JBM_TSM_ON_TCS const int16_t num_timeslots, -#endif float Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ float Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ int16_t channel_active[MAX_CICP_CHANNELS] /* i : bitmap indicating which output channels are active */ @@ -1174,11 +1160,7 @@ void ivas_lssetupconversion_process_param_mc( set_s( channel_active, 0, outChannels ); /* Loop over each time slots and compute dmx for each time slot */ -#ifdef JBM_TSM_ON_TCS for ( slotIdx = 0; slotIdx < num_timeslots; slotIdx++ ) -#else - for ( slotIdx = 0; slotIdx < st_ivas->hParamMC->subframe_nbslots; slotIdx++ ) -#endif { /* copy buffers */ for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 478749ddc0..bddabbc822 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -139,7 +139,6 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); -#ifdef JBM_TSM_ON_TCS /* save old */ if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) { @@ -157,7 +156,6 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } -#endif /*-----------------------------------------------------------------* * Allocate, initialize, and configure SBA handles @@ -200,14 +198,12 @@ ivas_error ivas_sba_dec_reconfigure( hSpar = st_ivas->hSpar; st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#ifdef JBM_TSM_ON_TCS /* synchronize subframe info */ st_ivas->hSpar->num_slots = st_ivas->hTcBuffer->num_slots; st_ivas->hSpar->nb_subframes = st_ivas->hTcBuffer->nb_subframes; st_ivas->hSpar->slots_rendered = st_ivas->hTcBuffer->slots_rendered; st_ivas->hSpar->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpar->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#endif if ( st_ivas->nchan_transport == 1 ) { @@ -288,14 +284,12 @@ ivas_error ivas_sba_dec_reconfigure( return error; } -#ifdef JBM_TSM_ON_TCS /* synchronize subframe info */ st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#endif } if ( ( error = ivas_dirac_sba_config( @@ -372,7 +366,6 @@ ivas_error ivas_sba_dec_reconfigure( return error; } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * JBM TC buffer *-----------------------------------------------------------------*/ @@ -421,12 +414,10 @@ ivas_error ivas_sba_dec_reconfigure( } } } -#endif return error; } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_sba_dec_digest_tc() * @@ -597,4 +588,3 @@ void ivas_sba_dec_render( return; } -#endif diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index dd4af01ccf..b683262a6e 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -65,9 +65,7 @@ void ivas_sba2mc_cldfb( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ const int16_t nb_channels_out, /* i : nb of output channels */ const int16_t nb_bands, /* i : nb of CLDFB bands to process */ -#ifdef JBM_TSM_ON_TCS const int16_t nb_timeslots, /* i : number of time slots to process */ -#endif const float *hoa_dec_mtx /* i : HOA decoding mtx */ ) { @@ -93,11 +91,7 @@ void ivas_sba2mc_cldfb( p_realOut = realOut[n]; p_imagOut = imagOut[n]; -#ifdef JBM_TSM_ON_TCS for ( iBlock = 0; iBlock < nb_timeslots; iBlock++ ) -#else - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) -#endif { p_real = RealBuffer[m][iBlock]; p_imag = ImagBuffer[m][iBlock]; @@ -117,11 +111,7 @@ void ivas_sba2mc_cldfb( p_realOut = realOut[n]; p_imagOut = imagOut[n]; -#ifdef JBM_TSM_ON_TCS for ( iBlock = 0; iBlock < nb_timeslots; iBlock++ ) -#else - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) -#endif { p_real = RealBuffer[n][iBlock]; p_imag = ImagBuffer[n][iBlock]; @@ -147,12 +137,8 @@ void ivas_sba2mc_cldfb( void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ -#ifdef JBM_TSM_ON_TCS float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ float *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ -#else - float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ -#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order, /* i : Ambisonic (SBA) order */ const float gain_lfe /* i : gain for LFE, 0 = ignore LFE */ @@ -186,11 +172,7 @@ void ivas_mc2sba( /* Add LFE to omni W with gain*/ for ( k = 0; k < output_frame; k++ ) { -#ifdef JBM_TSM_ON_TCS buffer_tmp[0][k] += gain_lfe * in_buffer_td[i][k]; -#else - buffer_tmp[0][k] += gain_lfe * buffer_td[i][k]; -#endif } } @@ -216,11 +198,7 @@ void ivas_mc2sba( { for ( k = 0; k < output_frame; k++ ) { -#ifdef JBM_TSM_ON_TCS buffer_tmp[j][k] += gains[j] * in_buffer_td[i][k]; -#else - buffer_tmp[j][k] += gains[j] * buffer_td[i][k]; -#endif } } } @@ -312,11 +290,7 @@ int16_t ivas_sba_remapTCs( *-------------------------------------------------------------------------*/ void ivas_ism2sba( -#ifdef JBM_TSM_ON_TCS float *buffer_td[], /* i/o: TD signal buffers */ -#else - float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ -#endif ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ const int16_t nchan_ism, /* i : number of objects */ @@ -372,7 +346,6 @@ void ivas_ism2sba( return; } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------------* * ivas_ism2sba() * @@ -424,7 +397,6 @@ void ivas_ism2sba_sf( return; } -#endif /*-------------------------------------------------------------------* * ivas_sba_upmixer_renderer() @@ -439,35 +411,18 @@ void ivas_sba_upmixer_renderer( ) { int16_t nchan_internal; -#ifndef JBM_TSM_ON_TCS - int16_t i; - float temp; -#endif push_wmops( "ivas_sba_upmixer_renderer" ); nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); -#ifndef JBM_TSM_ON_TCS - if ( st_ivas->nchan_transport >= 3 ) - { - /*convert WYZX downmix to WYXZ*/ - for ( i = 0; i < output_frame; i++ ) - { - temp = output[2][i]; - output[2][i] = output[3][i]; - output[3][i] = temp; - } - } -#endif /* Upmixer + Renderer */ ivas_spar_dec_upmixer( st_ivas, output, nchan_internal, output_frame ); if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { -#ifdef JBM_TSM_ON_TCS float *output_f[MAX_OUTPUT_CHANNELS]; int16_t ch; @@ -477,9 +432,6 @@ void ivas_sba_upmixer_renderer( } ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); -#else - ivas_sba_linear_renderer( output, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); -#endif } pop_wmops(); @@ -494,11 +446,7 @@ void ivas_sba_upmixer_renderer( *-------------------------------------------------------------------*/ static void ivas_sba_mtx_mult( -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: synthesized core-corder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-corder transport channels/DirAC output */ -#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : Number of ambisonic channels */ const IVAS_OUTPUT_SETUP output_setup, /* i : Output configuration */ @@ -558,11 +506,7 @@ static void ivas_sba_mtx_mult( *-------------------------------------------------------------------*/ ivas_error ivas_sba_linear_renderer( -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : number of input ambisonics channels */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index f3fd5ed04c..a03018e58d 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -209,7 +209,6 @@ ivas_error ivas_spar_dec_open( ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); -#ifdef JBM_TSM_ON_TCS set_s( hSpar->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hSpar->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); hSpar->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; @@ -252,7 +251,6 @@ ivas_error ivas_spar_dec_open( return error; } } -#endif st_ivas->hSpar = hSpar; @@ -1098,7 +1096,6 @@ static void ivas_spar_calc_smooth_facs( } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_spar_dec_agc_pca() * @@ -1422,10 +1419,8 @@ void ivas_spar_dec_upmixer( return; } -#endif -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_spar_dec_upmixer_sf() * @@ -1437,15 +1432,6 @@ void ivas_spar_dec_upmixer_sf( float *output[], /* o : output audio channels */ const int16_t nchan_internal /* i : number of internal channels */ ) -#else -void ivas_spar_dec_upmixer( - - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output[][L_FRAME48k], /* i/o: input/output audio channels */ - const int16_t nchan_internal, /* i : number of internal channels */ - const int16_t output_frame /* i : output frame length */ -) -#endif { int16_t cldfb_band, num_cldfb_bands, numch_in, numch_out; float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX]; @@ -1453,37 +1439,21 @@ void ivas_spar_dec_upmixer( int16_t i, b, ts, out_ch, in_ch; int16_t num_spar_bands, spar_band, nchan_transport; int16_t num_in_ingest, split_band; -#ifdef JBM_TSM_ON_TCS int16_t slot_size, slot_idx_start; float *p_tc[MAX_OUTPUT_CHANNELS]; int16_t md_idx; -#endif float Pcm_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; int16_t numch_out_dirac; -#ifndef JBM_TSM_ON_TCS - float *pPcm_tmp[MAX_OUTPUT_CHANNELS]; - int16_t num_bands_out; -#endif float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; int16_t b_skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; DECODER_CONFIG_HANDLE hDecoderConfig; SPAR_DEC_HANDLE hSpar; int16_t num_md_sub_frames; -#ifndef JBM_TSM_ON_TCS - int16_t md_sf_idx; -#endif -#ifdef JBM_TSM_ON_TCS push_wmops( "ivas_spar_dec_upmixer_sf" ); -#else - push_wmops( "ivas_spar_dec_upmixer" ); -#endif hSpar = st_ivas->hSpar; hDecoderConfig = st_ivas->hDecoderConfig; -#ifndef JBM_TSM_ON_TCS - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; -#endif nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; @@ -1492,14 +1462,12 @@ void ivas_spar_dec_upmixer( num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate ); -#ifdef JBM_TSM_ON_TCS slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); slot_idx_start = hSpar->slots_rendered; for ( i = 0; i < nchan_internal; i++ ) { p_tc[i] = st_ivas->hTcBuffer->tc[i] + slot_idx_start * slot_size; } -#endif #ifdef DEBUG_SPAR_BYPASS_EVS_CODEC /* by-pass core-coder */ @@ -1538,19 +1506,6 @@ void ivas_spar_dec_upmixer( } #endif -#ifndef JBM_TSM_ON_TCS - /*---------------------------------------------------------------------* - * AGC - *---------------------------------------------------------------------*/ - - ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); - - -#ifdef DEBUG_SBA_AUDIO_DUMP - /* Dump audio signal after ivas_agc_dec_process */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[1], "ivas_agc_dec_process()" ); -#endif -#endif /*---------------------------------------------------------------------* * TD Decorr and pcm ingest *---------------------------------------------------------------------*/ @@ -1564,12 +1519,6 @@ void ivas_spar_dec_upmixer( num_in_ingest = nchan_transport; } -#ifndef JBM_TSM_ON_TCS - for ( i = 0; i < nchan_internal; i++ ) - { - pPcm_tmp[i] = Pcm_tmp[i]; - } -#endif /*---------------------------------------------------------------------* * PCA decoder *---------------------------------------------------------------------*/ @@ -1577,46 +1526,7 @@ void ivas_spar_dec_upmixer( hSpar->pca_ingest_channels = num_in_ingest; #endif -#ifndef JBM_TSM_ON_TCS /* will already happen in the TC decoding */ - if ( hSpar->hPCA != NULL ) - { - ivas_pca_dec( hSpar->hPCA, output_frame, num_in_ingest, hDecoderConfig->ivas_total_brate, hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); -#ifdef DEBUG_SBA_AUDIO_DUMP - /* Dump audio signal after ivas_pca_dec */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, num_in_ingest, spar_foa_dec_wav[2], "ivas_pca_dec()" ); -#endif - } -#endif - -#ifndef JBM_TSM_ON_TCS - /*---------------------------------------------------------------------* - * TD decorrelation - *---------------------------------------------------------------------*/ - - if ( hSpar->hMdDec->td_decorr_flag ) - { - ivas_td_decorr_process( hSpar->hTdDecorr, output, pPcm_tmp, output_frame ); - if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) - { - for ( i = 0; i < nchan_internal - nchan_transport; i++ ) - { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); - } - } - else - { - for ( i = 0; i < nchan_internal - nchan_transport; i++ ) - { - set_zero( output[nchan_internal - 1 - i], output_frame ); - } - for ( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) - { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); - } - } - } -#endif hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; @@ -1649,14 +1559,6 @@ void ivas_spar_dec_upmixer( } } -#ifndef JBM_TSM_ON_TCS - /*---------------------------------------------------------------------* - * Gen umx mat - *---------------------------------------------------------------------*/ - - ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi, - num_md_sub_frames ); -#endif /*---------------------------------------------------------------------* * CLDFB Processing and Synthesis @@ -1673,32 +1575,16 @@ void ivas_spar_dec_upmixer( #ifdef DEBUG_SBA_AUDIO_DUMP /* Dump audio signal after ivas_agc_dec_process */ -#ifdef JBM_TSM_ON_TCS ivas_spar_dump_signal_wav( output_frame, p_tc, NULL, numch_in, spar_foa_dec_wav[4], "ivas_spar_upmixer()" ); -#else - ivas_spar_dump_signal_wav( output_frame, NULL, output, numch_in, spar_foa_dec_wav[4], "ivas_spar_upmixer()" ); -#endif #endif -#ifndef JBM_TSM_ON_TCS - for ( int16_t i_sf = 0; i_sf < MAX_PARAM_SPATIAL_SUBFRAMES; i_sf++ ) - { -#endif /* CLDFB analysis of incoming frame */ for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { -#ifdef JBM_TSM_ON_TCS for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) -#endif { cldfbAnalysis_ts( -#ifdef JBM_TSM_ON_TCS &p_tc[in_ch][ts * num_cldfb_bands], -#else - &output[in_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], -#endif cldfb_in_ts_re[in_ch][ts], cldfb_in_ts_im[in_ch][ts], num_cldfb_bands, @@ -1711,19 +1597,10 @@ void ivas_spar_dec_upmixer( ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf ); } -#ifdef JBM_TSM_ON_TCS for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) -#endif { -#ifdef JBM_TSM_ON_TCS md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); -#else - /* determine SPAR parameters for this time slots */ - ivas_spar_get_parameters( hSpar, hDecoderConfig, ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES, numch_out, numch_in, num_spar_bands, mixer_mat ); -#endif if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) { for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) @@ -1784,7 +1661,6 @@ void ivas_spar_dec_upmixer( } } -#ifdef JBM_TSM_ON_TCS if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) { /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ @@ -1812,16 +1688,11 @@ void ivas_spar_dec_upmixer( hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); } } -#endif } if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); -#else - ivas_dirac_dec( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im, i_sf ); -#endif } if ( st_ivas->hDirAC != NULL ) @@ -1835,11 +1706,7 @@ void ivas_spar_dec_upmixer( { if ( ( st_ivas->hOutSetup.num_lfe > 0 ) && ( st_ivas->hOutSetup.index_lfe[idx_lfe] == ch ) ) { -#ifdef JBM_TSM_ON_TCS set_zero( output[ch], hSpar->subframe_nbslots[hSpar->subframes_rendered] * num_cldfb_bands ); -#else - set_zero( &( output[ch][i_sf * MAX_PARAM_SPATIAL_SUBFRAMES * num_cldfb_bands] ), MAX_PARAM_SPATIAL_SUBFRAMES * num_cldfb_bands ); -#endif if ( idx_lfe < ( st_ivas->hDirAC->hOutSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -1849,20 +1716,12 @@ void ivas_spar_dec_upmixer( { if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { -#ifdef JBM_TSM_ON_TCS for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) -#endif { cldfbSynthesis( &cldfb_in_ts_re[idx_in][ts], &cldfb_in_ts_im[idx_in][ts], -#ifdef JBM_TSM_ON_TCS &output[ch][ts * num_cldfb_bands], -#else - &output[ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], -#endif num_cldfb_bands, st_ivas->cldfbSynDec[idx_in] ); } @@ -1879,20 +1738,12 @@ void ivas_spar_dec_upmixer( /* CLDFB to time synthesis (overwrite mixer output) */ for ( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { -#ifdef JBM_TSM_ON_TCS for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) -#endif { cldfbSynthesis( &cldfb_in_ts_re[out_ch][ts], &cldfb_in_ts_im[out_ch][ts], -#ifdef JBM_TSM_ON_TCS &output[out_ch][ts * num_cldfb_bands], -#else - &output[out_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], -#endif num_cldfb_bands, st_ivas->cldfbSynDec[out_ch] ); } @@ -1907,38 +1758,9 @@ void ivas_spar_dec_upmixer( #endif -#ifndef JBM_TSM_ON_TCS - md_sf_idx = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? i_sf : 0; - split_band = SPAR_DIRAC_SPLIT_START_BAND; - if ( split_band < IVAS_MAX_NUM_BANDS ) - { - hSpar->i_subframe++; - hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) - { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( b = 0; b < num_spar_bands; b++ ) - { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf_idx * IVAS_MAX_NUM_BANDS]; - } - } - } - } -#endif -#ifndef JBM_TSM_ON_TCS - } -#endif -#ifdef JBM_TSM_ON_TCS hSpar->slots_rendered += hSpar->subframe_nbslots[hSpar->subframes_rendered]; hSpar->subframes_rendered++; -#endif pop_wmops(); diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 86fcaa1faf..dc76babe9c 100755 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -3032,11 +3032,7 @@ void ivas_spar_to_dirac( qmf_band_start = band_grouping[band]; qmf_band_end = band_grouping[band + 1]; -#ifdef JBM_TSM_ON_TCS for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#else - for ( block = 0; block < hDirAC->nb_subframes; block++ ) -#endif { int16_t ts_start, ts_end, ts; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index f92781d6d8..3a48913566 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -435,11 +435,9 @@ typedef struct param_ism_rendering float *proto_matrix; float *interpolator; float mixing_matrix_lin_old[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; -#ifdef JBM_TSM_ON_TCS float mixing_matrix_lin[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; float *Cldfb_RealBuffer_tc; float *Cldfb_ImagBuffer_tc; -#endif } PARAM_ISM_RENDERING_DATA, *PARAM_ISM_RENDERING_HANDLE; @@ -576,10 +574,8 @@ typedef struct dirac_output_synthesis_cov_state_structure float *cy_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res_old[CLDFB_NO_CHANNELS_MAX]; -#ifdef JBM_TSM_ON_TCS float *mixing_matrix[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res[CLDFB_NO_CHANNELS_MAX]; -#endif } DIRAC_OUTPUT_SYNTHESIS_COV_STATE; @@ -620,15 +616,9 @@ typedef struct /* Diffuse sound directional distribution data structure */ typedef struct ivas_diffuse_distribution_data_structure { -#ifdef JBM_TSM_ON_TCS float diffuseRatioX[CLDFB_NO_CHANNELS_MAX]; float diffuseRatioY[CLDFB_NO_CHANNELS_MAX]; float diffuseRatioZ[CLDFB_NO_CHANNELS_MAX]; -#else - float diffuseRatioX[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float diffuseRatioY[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float diffuseRatioZ[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif } DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; @@ -640,15 +630,11 @@ typedef struct ivas_dirac_dec_data_structure IVAS_OUTPUT_SETUP hOutSetup; int16_t slot_size; -#ifdef JBM_TSM_ON_TCS int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t subframes_rendered; int16_t slots_rendered; int16_t num_slots; int16_t render_to_md_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME]; -#else - int16_t subframe_nbslots; -#endif int16_t nb_subframes; int16_t num_freq_bands; @@ -759,7 +745,6 @@ typedef struct ivas_param_mc_dec_data_structure { int16_t slot_size; -#ifdef JBM_TSM_ON_TCS float *Cldfb_RealBuffer_tc; float *Cldfb_ImagBuffer_tc; int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; @@ -767,9 +752,6 @@ typedef struct ivas_param_mc_dec_data_structure int16_t subframes_rendered; int16_t slots_rendered; int16_t num_slots; -#else - int16_t subframe_nbslots; -#endif int16_t num_freq_bands; int16_t num_param_bands_synth; @@ -915,14 +897,12 @@ typedef struct ivas_spar_dec_lib_t int16_t numOutChannels; int16_t pca_ingest_channels; #endif -#ifdef JBM_TSM_ON_TCS int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t render_to_md_map[MAX_JBM_CLDFB_TIMESLOTS]; int16_t nb_subframes; int16_t subframes_rendered; int16_t slots_rendered; int16_t num_slots; -#endif } SPAR_DEC_DATA, *SPAR_DEC_HANDLE; @@ -1092,12 +1072,8 @@ typedef struct vbap_data_structure typedef struct renderer_struct { float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; -#ifdef JBM_TSM_ON_TCS float *interpolator; float gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; -#else - float interpolator[L_FRAME48k]; -#endif } ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; @@ -1219,14 +1195,11 @@ typedef struct decoder_config_structure #ifdef DEBUGGING int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ #endif -#ifdef JBM_TSM_ON_TCS int16_t voip_active; -#endif int16_t Opt_delay_comp; /* flag indicating delay compensation active */ } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; -#ifdef JBM_TSM_ON_TCS typedef struct decoder_tc_buffer_structure { float *tc_buffer; /* the buffer itself */ @@ -1248,7 +1221,6 @@ typedef struct decoder_tc_buffer_structure int16_t n_samples_discard; /* number of samples to discard from the beginning of the output */ } DECODER_TC_BUFFER, *DECODER_TC_BUFFER_HANDLE; -#endif /*----------------------------------------------------------------------------------* @@ -1340,10 +1312,8 @@ typedef struct Decoder_Struct RENDER_CONFIG_DATA *hRenderConfig; /* Renderer config pointer */ int32_t binaural_latency_ns; /* Binauralization latency in ns */ -#ifdef JBM_TSM_ON_TCS /* JBM module */ DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */ -#endif #ifdef DEBUGGING int32_t noClipping; /* number of clipped samples */ diff --git a/lib_dec/jbm_jb4sb.h b/lib_dec/jbm_jb4sb.h index 7954358595..00f5ccbb40 100644 --- a/lib_dec/jbm_jb4sb.h +++ b/lib_dec/jbm_jb4sb.h @@ -78,13 +78,11 @@ struct JB4_DATAUNIT int16_t nextCoderType; }; -#ifdef JBM_TSM_ON_TCS typedef enum { JBM_RENDERER_NONE, JBM_RENDERER_IVAS, } JBM_RENDERER_TYPE; -#endif typedef struct JB4_DATAUNIT *JB4_DATAUNIT_HANDLE; diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 9742a01183..89d6cb3e59 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -66,12 +66,8 @@ struct apa_state_t { /* output buffer */ -#ifdef JBM_TSM_ON_TCS bool evs_compat_mode; float *buf_out; -#else - int16_t *buf_out; -#endif uint16_t buf_out_capacity; uint16_t l_buf_out; @@ -91,13 +87,11 @@ struct apa_state_t /* total number of processed input samples since apa_reset() */ uint32_t l_in_total; -#ifdef JBM_TSM_ON_TCS /* time resolution in samples of the IVAS renderer*/ uint16_t l_ts; /* samples already available in the renderer buffer */ uint16_t l_r_buf; -#endif /* sum of inserted/removed samples since last apa_set_scale() */ int32_t diffSinceSetScale; @@ -136,7 +130,6 @@ static float apa_corrEnergy2dB( float energy, uint16_t corr_len ); static float apa_getQualityIncreaseForLowEnergy( float energydB ); -#ifdef JBM_TSM_ON_TCS static bool logarithmic_search( const apa_state_t *ps, const float *signal, int16_t s_start, uint16_t inlen, uint16_t offset, uint16_t fixed_pos, uint16_t corr_len, uint16_t wss, uint16_t css, int16_t *synchpos ); static bool find_synch( apa_state_t *ps, const float *in, uint16_t l_in, int16_t s_start, uint16_t s_len, int16_t fixed_pos, uint16_t corr_len, uint16_t offset, float *energy, float *quality, int16_t *synch_pos ); @@ -146,17 +139,6 @@ static bool copy_frm( apa_state_t *ps, const float frm_in[], float frm_out[], ui static bool shrink_frm( apa_state_t *ps, const float frm_in[], uint16_t maxScaling, float frm_out[], uint16_t *l_frm_out ); static bool extend_frm( apa_state_t *ps, const float frm_in[], float frm_out[], uint16_t *l_frm_out ); -#else -static bool logarithmic_search( const apa_state_t *ps, const int16_t *signal, int16_t s_start, uint16_t inlen, uint16_t offset, uint16_t fixed_pos, uint16_t corr_len, uint16_t wss, uint16_t css, int16_t *synchpos ); - -static bool find_synch( apa_state_t *ps, const int16_t *in, uint16_t l_in, int16_t s_start, uint16_t s_len, int16_t fixed_pos, uint16_t corr_len, uint16_t offset, float *energy, float *quality, int16_t *synch_pos ); - -static bool copy_frm( apa_state_t *ps, const int16_t frm_in[], int16_t frm_out[], uint16_t *l_frm_out ); - -static bool shrink_frm( apa_state_t *ps, const int16_t frm_in[], uint16_t maxScaling, int16_t frm_out[], uint16_t *l_frm_out ); - -static bool extend_frm( apa_state_t *ps, const int16_t frm_in[], int16_t frm_out[], uint16_t *l_frm_out ); -#endif /*---------------------------------------------------------------------* * Public functions @@ -188,9 +170,7 @@ ivas_error apa_init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); } -#ifdef JBM_TSM_ON_TCS ps->evs_compat_mode = false; -#endif apa_reset( ps ); *pps = ps; @@ -224,14 +204,11 @@ void apa_reset( ps->bad_frame_count = 0; ps->good_frame_count = 0; -#ifdef JBM_TSM_ON_TCS ps->l_ts = 1; ps->l_r_buf = 0; -#endif return; } -#ifdef JBM_TSM_ON_TCS uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, @@ -275,7 +252,6 @@ uint8_t apa_reconfigure( return 0; } -#endif /* Sets the audio configuration. */ bool apa_set_rate( @@ -379,7 +355,6 @@ bool apa_set_scale( return 0; } -#ifdef JBM_TSM_ON_TCS bool apa_set_renderer_granularity( apa_state_t *ps, uint16_t l_ts ) @@ -426,7 +401,6 @@ bool apa_set_evs_compat_mode( return 0; } -#endif /* ******************************************************************************** @@ -580,27 +554,15 @@ bool apa_exit( */ uint8_t apa_exec( apa_state_t *ps, /* i/o: state struct */ -#ifdef JBM_TSM_ON_TCS const float a_in[], /* i : input samples */ -#else - const int16_t a_in[], /* i : input samples */ -#endif uint16_t l_in, /* i : number of input samples */ uint16_t maxScaling, /* i : allowed number of inserted/removed samples */ -#ifdef JBM_TSM_ON_TCS float a_out[], /* o : output samples */ -#else - int16_t a_out[], /* o : output samples */ -#endif uint16_t *l_out /* o : number of output samples */ ) { uint16_t i; -#ifdef JBM_TSM_ON_TCS float frm_in[APA_BUF]; /* TODO(mcjbm): this buffer could be smaller - always allocates space for 16 channels */ -#else - int16_t frm_in[APA_BUF]; /* TODO(mcjbm): this buffer could be smaller - always allocates space for 16 channels */ -#endif uint16_t l_frm_out; int16_t l_rem; int32_t dl_scaled, dl_copied, l_frm_out_target; @@ -662,13 +624,8 @@ uint8_t apa_exec( } else { -#ifdef JBM_TSM_ON_TCS float *buf_out_ptr = &( ps->buf_out[ps->l_buf_out - ps->l_frm] ); float *frm_in_ptr = &( frm_in[ps->l_frm] ); -#else - int16_t *buf_out_ptr = &( ps->buf_out[ps->l_buf_out - ps->l_frm] ); - int16_t *frm_in_ptr = &( frm_in[ps->l_frm] ); -#endif /* fill input frame */ /* 1st input frame: previous output samples */ @@ -723,13 +680,8 @@ uint8_t apa_exec( /* discard old samples; always keep at least most recent l_frm samples */ if ( ( ps->l_buf_out + l_frm_out ) > ps->buf_out_capacity ) { -#ifdef JBM_TSM_ON_TCS float *buf_out_ptr1 = ps->buf_out; float *buf_out_ptr2; -#else - int16_t *buf_out_ptr1 = ps->buf_out; - int16_t *buf_out_ptr2; -#endif l_rem = ( ps->l_frm - l_frm_out ); if ( l_rem < 0 ) @@ -749,11 +701,7 @@ uint8_t apa_exec( return 5; } { -#ifdef JBM_TSM_ON_TCS float *buf_out_ptr = &( ps->buf_out[ps->l_buf_out] ); -#else - int16_t *buf_out_ptr = &( ps->buf_out[ps->l_buf_out] ); -#endif for ( i = 0; i < l_frm_out; i++ ) { buf_out_ptr[i] = a_out[i]; @@ -811,11 +759,7 @@ uint8_t apa_exec( */ static void get_scaling_quality( const apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t s_len, uint16_t offset, uint16_t corr_len, @@ -968,11 +912,7 @@ static float apa_getQualityIncreaseForLowEnergy( */ static bool logarithmic_search( const apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif int16_t s_start, uint16_t inlen, uint16_t offset, @@ -1085,11 +1025,7 @@ static bool logarithmic_search( */ static bool find_synch( apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float *in, -#else - const int16_t *in, -#endif uint16_t l_in, int16_t s_start, uint16_t s_len, @@ -1144,13 +1080,8 @@ static bool find_synch( */ static bool copy_frm( apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float frm_in[], float frm_out[], -#else - const int16_t frm_in[], - int16_t frm_out[], -#endif uint16_t *l_frm_out ) { uint16_t i; @@ -1197,17 +1128,9 @@ static bool copy_frm( */ static bool shrink_frm( apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float frm_in[], -#else - const int16_t frm_in[], -#endif uint16_t maxScaling, -#ifdef JBM_TSM_ON_TCS float frm_out[], -#else - int16_t frm_out[], -#endif uint16_t *l_frm_out ) { bool findSynchResult = 0; @@ -1238,7 +1161,6 @@ static bool shrink_frm( /* maximum scaling */ energy = -65; quality = 5; -#ifdef JBM_TSM_ON_TCS if ( ps->evs_compat_mode == false ) { @@ -1258,7 +1180,6 @@ static bool shrink_frm( } } else -#endif if ( maxScaling != 0U && s_end > maxScaling + 1 ) { xtract = maxScaling; @@ -1315,18 +1236,14 @@ static bool shrink_frm( { return 1; } -#ifdef JBM_TSM_ON_TCS if ( ps->evs_compat_mode == true ) { overlapAddEvs( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); } else { -#endif overlapAdd( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); -#ifdef JBM_TSM_ON_TCS } -#endif } else { @@ -1373,13 +1290,8 @@ static bool shrink_frm( */ static bool extend_frm( apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float frm_in[], float frm_out[], -#else - const int16_t frm_in[], - int16_t frm_out[], -#endif uint16_t *l_frm_out ) { bool findSynchResult = 0; @@ -1393,13 +1305,8 @@ static bool extend_frm( int16_t s_start = 0; float energy, quality = 0.0f; uint16_t l_frm, l_seg; -#ifdef JBM_TSM_ON_TCS const float *fadeOut, *fadeIn; float *out; -#else - const int16_t *fadeOut, *fadeIn; - int16_t *out; -#endif l_frm = ps->l_frm; @@ -1490,7 +1397,6 @@ static bool extend_frm( energy = -65; quality = 5; xtract[n] = s_start + ps->num_channels; -#ifdef JBM_TSM_ON_TCS if ( ps->evs_compat_mode == false ) { /* take renderer buffer samples into accout */ @@ -1498,7 +1404,6 @@ static bool extend_frm( /* snap to next renderer time slot border to resynchronize */ xtract[n] -= ( ( N - 1 ) * l_seg - xtract[n] + ps->l_r_buf ) % ps->l_ts; } -#endif } else { @@ -1555,29 +1460,20 @@ static bool extend_frm( fadeOut = frm_in + l_frm + xtract[n - 1] + l_seg; fadeIn = frm_in + l_frm + xtract[n]; out = frm_out + ( n - 2 ) * l_seg; -#ifdef JBM_TSM_ON_TCS if ( ps->evs_compat_mode == true ) { overlapAddEvs( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); } else { -#endif overlapAdd( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); -#ifdef JBM_TSM_ON_TCS } -#endif } else { /* just copy down 1st half of current segment (= 2nd half of previous segment) */ -#ifdef JBM_TSM_ON_TCS float *frm_out_ptr; const float *frm_in_ptr; -#else - int16_t *frm_out_ptr; - const int16_t *frm_in_ptr; -#endif frm_out_ptr = &( frm_out[( n - 2 ) * l_seg] ); frm_in_ptr = &( frm_in[l_frm + xtract[n]] ); for ( i = 0; i < l_seg; i++ ) diff --git a/lib_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index a5e7cb7d61..74e6b59c6b 100644 --- a/lib_dec/jbm_pcmdsp_apa.h +++ b/lib_dec/jbm_pcmdsp_apa.h @@ -114,7 +114,6 @@ bool apa_set_rate( apa_state_t *ps, const int32_t output_Fs ); * @return 0 on success, 1 on failure */ bool apa_set_scale( apa_state_t *s, uint16_t scale ); -#ifdef JBM_TSM_ON_TCS bool apa_set_renderer_granularity( apa_state_t *ps, uint16_t l_ts ); bool apa_set_renderer_residual_samples( apa_state_t *ps, uint16_t l_r_buf ); @@ -122,7 +121,6 @@ bool apa_set_renderer_residual_samples( apa_state_t *ps, uint16_t l_r_buf ); bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode ); uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, uint16_t l_ts ); -#endif bool apa_set_complexity_options( apa_state_t *s, uint16_t wss, uint16_t css ); @@ -130,10 +128,6 @@ bool apa_set_quality( apa_state_t *s, float quality, uint16_t qualityred, uint16 bool apa_exit( apa_state_t **s ); -#ifdef JBM_TSM_ON_TCS uint8_t apa_exec( apa_state_t *s, const float a_in[], uint16_t l_in, uint16_t maxScaling, float a_out[], uint16_t *l_out ); -#else -uint8_t apa_exec( apa_state_t *s, const int16_t a_in[], uint16_t l_in, uint16_t maxScaling, int16_t a_out[], uint16_t *l_out ); -#endif #endif /* JBM_PCMDSP_APA_H */ diff --git a/lib_dec/jbm_pcmdsp_fifo.c b/lib_dec/jbm_pcmdsp_fifo.c index 108b069402..a3e8936464 100644 --- a/lib_dec/jbm_pcmdsp_fifo.c +++ b/lib_dec/jbm_pcmdsp_fifo.c @@ -175,7 +175,6 @@ int16_t pcmdsp_fifo_write( return 0; } -#ifdef JBM_TSM_ON_TCS #ifdef DEBUGGING /* Writes the given audio data to the FIFO. */ int16_t pcmdsp_fifo_write_zero( @@ -218,7 +217,6 @@ int16_t pcmdsp_fifo_write_zero( return 0; } #endif -#endif /* Reads the given number of audio samples from the FIFO. */ int16_t pcmdsp_fifo_read( diff --git a/lib_dec/jbm_pcmdsp_fifo.h b/lib_dec/jbm_pcmdsp_fifo.h index d16bd2b8d2..b601cc2e0e 100644 --- a/lib_dec/jbm_pcmdsp_fifo.h +++ b/lib_dec/jbm_pcmdsp_fifo.h @@ -74,11 +74,9 @@ ivas_error pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, int16_t pcmdsp_fifo_write( PCMDSP_FIFO_HANDLE h, const uint8_t *samples, uint16_t nSamplesPerChannel ); -#ifdef JBM_TSM_ON_TCS #ifdef DEBUGGING int16_t pcmdsp_fifo_write_zero( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel ); #endif -#endif int16_t pcmdsp_fifo_read( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint8_t *samples ); diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.c b/lib_dec/jbm_pcmdsp_similarityestimation.c index e83d1f7c37..c67e71d591 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation.c @@ -52,11 +52,7 @@ /* Calculates cross correlation coefficient for template segment. */ float cross_correlation_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len ) @@ -67,11 +63,7 @@ float cross_correlation_self( c_c = 0.0f; for ( j = 0; j < corr_len; j++ ) { -#ifdef JBM_TSM_ON_TCS c_c += ( signal[j + x] * signal[j + y] ); -#else - c_c += ( (float) signal[j + x] * (float) signal[j + y] ); -#endif } return c_c; @@ -79,11 +71,7 @@ float cross_correlation_self( /* Calculates cross correlation coefficient for template segment. */ float cross_correlation_subsampled_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -95,11 +83,7 @@ float cross_correlation_subsampled_self( c_c = 0.0f; for ( j = 0; j < corr_len; j += subsampling ) { -#ifdef JBM_TSM_ON_TCS c_c += ( signal[j + x] * signal[j + y] ); -#else - c_c += ( (float) signal[j + x] * (float) signal[j + y] ); -#endif } return c_c; @@ -108,11 +92,7 @@ float cross_correlation_subsampled_self( /* Calculates normalized cross correlation coefficient for template segment. */ float normalized_cross_correlation_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -122,11 +102,7 @@ float normalized_cross_correlation_self( float c_c; float energy_xy, energy_x, energy_y; uint16_t j; -#ifdef JBM_TSM_ON_TCS const float *signal_a, *signal_b; -#else - const int16_t *signal_a, *signal_b; -#endif c_c = 0.0f; energy_x = 0.0f; @@ -135,21 +111,11 @@ float normalized_cross_correlation_self( signal_b = &signal[y]; for ( j = 0; j < corr_len; j += subsampling ) { -#ifdef JBM_TSM_ON_TCS c_c += ( signal_a[j] * signal_b[j] ); energy_x += ( signal_a[j] ) * ( signal_a[j] ); energy_y += ( signal_b[j] ) * ( signal_b[j] ); -#else - c_c += ( (float) signal_a[j] * (float) signal_b[j] ); - energy_x += ( (float) signal_a[j] ) * ( (float) signal_a[j] ); - energy_y += ( (float) signal_b[j] ) * ( (float) signal_b[j] ); -#endif } -#ifdef JBM_TSM_ON_TCS energy_xy = sqrtf( energy_x * energy_y ); -#else - energy_xy = (float) sqrt( (float) energy_x * (float) energy_y ); -#endif if ( energy_xy < 1.0f ) { energy_xy = 1.0f; /* conceal silent frames */ @@ -164,11 +130,7 @@ float normalized_cross_correlation_self( /* Splits the signal into segments and checks if all of them have very low energy. */ bool isSilence( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint32_t len, uint32_t segments ) { @@ -183,11 +145,7 @@ bool isSilence( if ( ( i != 0U && i % samplesPerSegment == 0U ) || i + 1 == len ) { /* check energy of current segment */ -#ifdef JBM_TSM_ON_TCS energy = 10 * log10f( energy / (float) samplesPerSegment ); -#else - energy = 10 * (float) log10( energy / samplesPerSegment ); -#endif if ( energy > -65 ) { return false; diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.h b/lib_dec/jbm_pcmdsp_similarityestimation.h index 44b4fd246a..c944bc1f7b 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.h +++ b/lib_dec/jbm_pcmdsp_similarityestimation.h @@ -68,11 +68,7 @@ ******************************************************************************** */ float cross_correlation_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len ); @@ -103,11 +99,7 @@ float cross_correlation_self( ******************************************************************************** */ float cross_correlation_subsampled_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -150,11 +142,7 @@ float cross_correlation_subsampled_self( ******************************************************************************** */ float normalized_cross_correlation_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -163,11 +151,7 @@ float normalized_cross_correlation_self( /* Splits the signal into segments and checks if all of them have very low energy. */ bool isSilence( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint32_t len, uint32_t segments ); diff --git a/lib_dec/jbm_pcmdsp_window.c b/lib_dec/jbm_pcmdsp_window.c index a31d368c91..15f692fb8a 100644 --- a/lib_dec/jbm_pcmdsp_window.c +++ b/lib_dec/jbm_pcmdsp_window.c @@ -80,15 +80,9 @@ void hannWindow( *-----------------------------------------------------------------------*/ void overlapAdd( -#ifdef JBM_TSM_ON_TCS const float *fadeOut, const float *fadeIn, float *out, -#else - const int16_t *fadeOut, - const int16_t *fadeIn, - int16_t *out, -#endif uint16_t n, uint16_t nChannels, const float *fadeOutWin, @@ -96,11 +90,7 @@ void overlapAdd( { float fdOutVal, fdInVal; int16_t i, j, hannIter; -#ifdef JBM_TSM_ON_TCS float combinedVal; -#else - int32_t combinedVal; -#endif for ( j = 0; j < nChannels; j++ ) { @@ -111,28 +101,8 @@ void overlapAdd( fdOutVal = fadeOut[i] * fadeOutWin[hannIter]; fdInVal = fadeIn[i] * fadeInWin[hannIter]; /* round combinedVal value (taking care of sign) */ -#ifdef JBM_TSM_ON_TCS combinedVal = fdInVal + fdOutVal; out[i] = combinedVal; -#else - combinedVal = (int32_t) ( ( fdInVal + fdOutVal ) + 0.5 ); - if ( fdInVal + fdOutVal < 0.0 ) - { - combinedVal = (int32_t) ( ( fdInVal + fdOutVal ) - 0.5 ); - } - - /* saturate value */ - if ( combinedVal > MAX16B ) - { - combinedVal = MAX16B; - } - else if ( combinedVal < MIN16B ) - { - combinedVal = MIN16B; - } - - out[i] = (int16_t) combinedVal; -#endif hannIter++; } } diff --git a/lib_dec/jbm_pcmdsp_window.h b/lib_dec/jbm_pcmdsp_window.h index 8c1823867a..b11decf11d 100644 --- a/lib_dec/jbm_pcmdsp_window.h +++ b/lib_dec/jbm_pcmdsp_window.h @@ -61,10 +61,6 @@ void hannWindow( uint16_t n, float *w ); * @param[in] nChannels number of channels * @param[in] fadeOutWin window for fade out * @param[in] fadeInWin window for fade in */ -#ifdef JBM_TSM_ON_TCS void overlapAdd( const float *fadeOut, const float *fadeIn, float *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); void overlapAddEvs( const float *fadeOut, const float *fadeIn, float *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); -#else -void overlapAdd( const int16_t *fadeOut, const int16_t *fadeIn, int16_t *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); -#endif #endif /* JBM_PCMDSP_WINDOW_H */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 3f1c20643a..7cb4753235 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -55,11 +55,7 @@ struct IVAS_DEC_VOIP JB4_HANDLE hJBM; PCMDSP_APA_HANDLE hTimeScaler; uint16_t lastDecodedWasActive; -#ifdef JBM_TSM_ON_TCS float *apaExecBuffer; /* Buffer for APA scaling */ -#else - int16_t *apaExecBuffer; /* Buffer for APA scaling */ -#endif JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ uint16_t *bs_conversion_buf; /* Buffer for bitstream conversion from packed to serial */ #ifdef VARIABLE_SPEED_DECODING @@ -67,14 +63,10 @@ struct IVAS_DEC_VOIP uint16_t speedFac; bool needNewFrame; #endif -#ifdef JBM_TSM_ON_TCS JBM_RENDERER_TYPE rendererType; PCMDSP_FIFO_HANDLE hFifoOut; uint8_t nTransportChannelsOld; uint16_t nSamplesAvailableNext; -#else - PCMDSP_FIFO_HANDLE hFifoAfterTimeScaler; -#endif #ifdef SUPPORT_JBM_TRACEFILE IVAS_JBM_TRACE_DATA JbmTraceData; #endif @@ -109,14 +101,9 @@ static void IVAS_DEC_Close_VoIP( IVAS_DEC_VOIP *hVoIP ); #ifdef SUPPORT_JBM_TRACEFILE static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, const uint32_t systemTimestamp_ms, const uint16_t extBufferedSamples, const int32_t output_Fs ); #endif -#ifdef JBM_TSM_ON_TCS static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); -#else -static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, int16_t *pcmBuf ); -#endif static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); -#ifdef JBM_TSM_ON_TCS static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ); static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec ); static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); @@ -125,7 +112,6 @@ static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *pcmBuf ); static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, int16_t *pcmBuf ); static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); -#endif /*---------------------------------------------------------------------* * IVAS_DEC_Open() @@ -256,9 +242,7 @@ static void init_decoder_config( hDecoderConfig->Opt_non_diegetic_pan = 0; hDecoderConfig->non_diegetic_pan_gain = 0; -#ifdef JBM_TSM_ON_TCS hDecoderConfig->voip_active = 0; -#endif hDecoderConfig->Opt_delay_comp = 0; @@ -521,10 +505,6 @@ ivas_error IVAS_DEC_EnableVoIP( error = IVAS_ERR_OK; -#ifndef JBM_TSM_ON_TCS - /* initialize time scaler and FIFO after time scaler */ - uint16_t wss, css; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -534,17 +514,12 @@ ivas_error IVAS_DEC_EnableVoIP( hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; hIvasDec->Opt_VOIP = 1; -#ifdef JBM_TSM_ON_TCS hDecoderConfig->voip_active = 1; -#endif -#ifdef JBM_TSM_ON_TCS if ( hDecoderConfig->output_config != AUDIO_CONFIG_EXTERNAL ) { -#endif hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); -#ifdef JBM_TSM_ON_TCS } #ifdef VARIABLE_SPEED_DECODING else @@ -552,11 +527,7 @@ ivas_error IVAS_DEC_EnableVoIP( hDecoderConfig->nchan_out = 1; } #endif -#endif -#ifndef JBM_TSM_ON_TCS - assert( hDecoderConfig->nchan_out > 0 && "EXT output not yet supported in VoIP mode" ); -#endif if ( ( error = input_format_API_to_internal( inputFormat, &hIvasDec->bitstreamformat, &hIvasDec->sdp_hf_only, true ) ) != IVAS_ERR_OK ) { @@ -575,27 +546,14 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->hVoIP->speedFac = speedFac; hIvasDec->hVoIP->needNewFrame = false; #endif -#ifdef JBM_TSM_ON_TCS hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); hIvasDec->hVoIP->nSamplesAvailableNext = 0; hIvasDec->hVoIP->rendererType = JBM_RENDERER_NONE; hIvasDec->hVoIP->hFifoOut = NULL; -#else - hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs * hDecoderConfig->nchan_out / FRAMES_PER_SEC ); -#endif -#ifdef JBM_TSM_ON_TCS /* postpone init of the buffers until we know the real number of TCs*/ hIvasDec->hVoIP->apaExecBuffer = NULL; hIvasDec->hVoIP->nTransportChannelsOld = 0; -#else - - hIvasDec->hVoIP->apaExecBuffer = malloc( sizeof( int16_t ) * APA_BUF_PER_CHANNEL * hDecoderConfig->nchan_out ); - if ( hIvasDec->hVoIP->apaExecBuffer == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } -#endif #define WMC_TOOL_SKIP /* Bitstream conversion is not counted towards complexity and memory usage */ @@ -624,34 +582,7 @@ ivas_error IVAS_DEC_EnableVoIP( #ifdef VARIABLE_SPEED_DECODING } #endif -#ifndef JBM_TSM_ON_TCS - if ( hDecoderConfig->output_Fs == 8000 ) - { - wss = 1; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 16000 ) - { - wss = 2; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 32000 ) - { - wss = 4; - css = 2; - } - else if ( hDecoderConfig->output_Fs == 48000 ) - { - wss = 6; - css = 3; - } - else - { - return IVAS_ERR_INIT_ERROR; - } -#endif -#ifdef JBM_TSM_ON_TCS /* postpone init of time scaler and output FIFO until we know the real number of TCs */ hIvasDec->hVoIP->hTimeScaler = NULL; #ifdef VARIABLE_SPEED_DECODING @@ -659,36 +590,6 @@ ivas_error IVAS_DEC_EnableVoIP( { hIvasDec->hVoIP->needNewFrame = true; } -#endif -#else -#ifdef VARIABLE_SPEED_DECODING - { - float startQuality = hIvasDec->hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ? -2.0f : 1.0f; - if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, - hDecoderConfig->nchan_out ) != IVAS_ERR_OK || - apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || - apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || - apa_set_quality( hIvasDec->hVoIP->hTimeScaler, startQuality, 4, 4 ) != 0 || - pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != 0 || - pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - /* we instantly need a new frame */ - hIvasDec->hVoIP->needNewFrame = true; - } -#else - if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, - hDecoderConfig->nchan_out ) != IVAS_ERR_OK || - apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || - apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || - apa_set_quality( hIvasDec->hVoIP->hTimeScaler, 1, 4, 4 ) != 0 || - pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != IVAS_ERR_OK || - pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != IVAS_ERR_OK ) - { - return IVAS_ERR_INIT_ERROR; - } -#endif #endif return error; @@ -817,11 +718,7 @@ ivas_error IVAS_DEC_GetSamples( if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = evs_dec_main( st_ivas, *nOutSamples, NULL, pcmBuf ) ) != IVAS_ERR_OK ) -#else - if ( ( error = evs_dec_main( st_ivas, *nOutSamples, pcmBuf ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -846,7 +743,6 @@ ivas_error IVAS_DEC_GetSamples( } -#ifdef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * IVAS_DEC_Setup( ) * @@ -1064,7 +960,6 @@ ivas_error IVAS_DEC_GetBufferedNumberOfSamples( return error; } -#endif /*---------------------------------------------------------------------* @@ -1831,10 +1726,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ const uint32_t systemTimestamp_ms /* i : current system timestamp */ -#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) , uint16_t *sampleAvailableNext /* o : samples available for the next call */ -#endif #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, @@ -1854,12 +1747,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples( int16_t timeScalingDone; int16_t result; ivas_error error; -#ifdef JBM_TSM_ON_TCS int16_t nSamplesRendered; uint16_t nSamplesTcsScaled; uint8_t nTransportChannels; uint8_t nOutChannels; -#endif error = IVAS_ERR_OK; @@ -1868,32 +1759,22 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hVoIP = hIvasDec->hVoIP; timeScalingDone = 0; -#ifdef JBM_TSM_ON_TCS nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; nTransportChannels = 0; nSamplesTcsScaled = hVoIP->nSamplesFrame; nSamplesRendered = 0; -#endif #ifdef VARIABLE_SPEED_DECODING scale = hVoIP->speedFac; maxScaling = hVoIP->speedFac; #endif -#ifdef JBM_TSM_ON_TCS if ( ( hVoIP->hFifoOut != NULL && nSamplesPerChannel > hVoIP->hFifoOut->capacity ) || nSamplesPerChannel == 0 ) -#else - if ( nSamplesPerChannel > hVoIP->hFifoAfterTimeScaler->capacity || nSamplesPerChannel == 0 ) -#endif { return IVAS_ERR_WRONG_PARAMS; } /* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */ -#ifdef JBM_TSM_ON_TCS while ( ( hVoIP->hFifoOut != NULL && pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ) < nSamplesPerChannel ) || ( hVoIP->hFifoOut == NULL && nSamplesRendered < nSamplesPerChannel ) ) -#else - while ( pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) < nSamplesPerChannel ) -#endif { #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING @@ -1906,7 +1787,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( #endif #endif -#ifdef JBM_TSM_ON_TCS if ( hVoIP->nSamplesAvailableNext == 0 ) { if ( hVoIP->hFifoOut ) @@ -1928,9 +1808,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } extBufferedSamples = nSamplesRendered + nSamplesBuffered; } -#else - extBufferedSamples = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); -#endif extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs; dataUnit = NULL; @@ -1999,7 +1876,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { /* codec mode to use not known yet - simply output silence */ -#ifdef JBM_TSM_ON_TCS nSamplesTcsScaled = hVoIP->nSamplesFrame; if ( hVoIP->hFifoOut != NULL ) { @@ -2017,14 +1893,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples( set_s( pcmBuf, 0, nSamplesPerChannel * nOutChannels ); } nSamplesRendered = nSamplesTcsScaled; -#else - set_s( hVoIP->apaExecBuffer, 0, hVoIP->nSamplesFrame ); /* TODO(mcjbm): Could be optimized: just write directly to output buffer */ -#endif } else { -#ifdef JBM_TSM_ON_TCS uint16_t l_ts = 1; uint16_t nSamplesRendered_loop; @@ -2062,12 +1934,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( return error; } -#else - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, hVoIP->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } #ifdef VARIABLE_SPEED_DECODING @@ -2106,46 +1972,21 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } /* apply time scaling on decoded/concealed samples */ -#ifdef JBM_TSM_ON_TCS if ( hIvasDec->hasBeenFedFirstGoodFrame ) { -#endif if ( apa_set_scale( hVoIP->hTimeScaler, (uint16_t) scale ) != 0 ) { return IVAS_ERR_UNKNOWN; } -#ifdef JBM_TSM_ON_TCS result = apa_exec( hVoIP->hTimeScaler, hVoIP->apaExecBuffer, hVoIP->nSamplesFrame * nTransportChannels, (uint16_t) maxScaling, hVoIP->apaExecBuffer, &nTimeScalerOutSamples ); -#else - result = apa_exec( hVoIP->hTimeScaler, hVoIP->apaExecBuffer, hVoIP->nSamplesFrame, (uint16_t) maxScaling, hVoIP->apaExecBuffer, &nTimeScalerOutSamples ); -#endif if ( result != 0 ) { return IVAS_ERR_UNKNOWN; } assert( nTimeScalerOutSamples <= APA_BUF ); -#ifdef JBM_TSM_ON_TCS nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels; -#else - /* append scaled samples to FIFO */ - if ( pcmdsp_fifo_write( hVoIP->hFifoAfterTimeScaler, (uint8_t *) hVoIP->apaExecBuffer, (uint16_t) ( nTimeScalerOutSamples / hDecoderConfig->nchan_out ) ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) - { - int16_t nSamplesAvailable = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); - if ( nSamplesAvailable < nSamplesPerChannel ) - { - hVoIP->needNewFrame = true; - } - } -#endif -#endif -#ifdef JBM_TSM_ON_TCS if ( hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->rendererType != JBM_RENDERER_NONE ) { /* render IVAS frames */ @@ -2177,7 +2018,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( nSamplesRendered = nSamplesTcsScaled; } } -#endif #ifdef SUPPORT_JBM_TRACEFILE /* jbmWriterFn and jbmWriter may be NULL if tracefile writing was not requested on CLI */ if ( jbmWriterFn != NULL && jbmWriter != NULL ) @@ -2191,7 +2031,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } } #endif -#ifdef JBM_TSM_ON_TCS } if ( hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->rendererType != JBM_RENDERER_NONE ) @@ -2252,40 +2091,18 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hVoIP->nSamplesAvailableNext = 0; } -#endif } /* fetch a user-specified number of samples from FIFO */ -#if defined( JBM_TSM_ON_TCS ) if ( hVoIP->hFifoOut ) { if ( pcmdsp_fifo_read( hVoIP->hFifoOut, nSamplesPerChannel, (uint8_t *) pcmBuf ) != 0 ) -#else - if ( pcmdsp_fifo_read( hVoIP->hFifoAfterTimeScaler, nSamplesPerChannel, (uint8_t *) pcmBuf ) != 0 ) -#endif { return IVAS_ERR_UNKNOWN; } -#ifdef JBM_TSM_ON_TCS } -#endif -#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) -#ifdef JBM_TSM_ON_TCS *sampleAvailableNext = hVoIP->nSamplesAvailableNext; -#else - *sampleAvailableNext = max( 0, pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) ); -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) - { - if ( *sampleAvailableNext < nSamplesPerChannel ) - { - hVoIP->needNewFrame = true; - } - } -#endif -#endif -#endif return error; } @@ -2296,7 +2113,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( * Function to flush remaining audio in VoIP *---------------------------------------------------------------------*/ -#if defined( VARIABLE_SPEED_DECODING ) || defined( JBM_TSM_ON_TCS ) ivas_error IVAS_DEC_VoIP_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ @@ -2307,41 +2123,24 @@ ivas_error IVAS_DEC_VoIP_Flush( { ivas_error error; IVAS_DEC_VOIP *hVoIP; -#ifdef JBM_TSM_ON_TCS int16_t rendererPcmBuf[( MAX_OUTPUT_CHANNELS * L_FRAME_MAX * APA_MAX_SCALE ) / 100]; uint16_t nSamplesToRender; uint16_t nSamplesFlushedLocal; -#endif error = IVAS_ERR_OK; hVoIP = hIvasDec->hVoIP; -#if defined( JBM_TSM_ON_TCS ) *nSamplesFlushed = min( nSamplesPerChannel, hVoIP->nSamplesAvailableNext ); -#else - *nSamplesFlushed = min( nSamplesPerChannel, pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) ); -#endif -#ifdef JBM_TSM_ON_TCS if ( hVoIP->rendererType == JBM_RENDERER_NONE ) { -#endif /* fetch a user-specified number of samples from FIFO */ -#if defined( JBM_TSM_ON_TCS ) if ( pcmdsp_fifo_read( hVoIP->hFifoOut, *nSamplesFlushed, (uint8_t *) pcmBuf ) != 0 ) -#else - if ( pcmdsp_fifo_read( hVoIP->hFifoAfterTimeScaler, *nSamplesFlushed, (uint8_t *) pcmBuf ) != 0 ) -#endif { return IVAS_ERR_UNKNOWN; } -#if defined( JBM_TSM_ON_TCS ) hVoIP->nSamplesAvailableNext -= *nSamplesFlushed; *nSamplesAvailableNext = hVoIP->nSamplesAvailableNext; -#else - *nSamplesAvailableNext = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); -#endif -#ifdef JBM_TSM_ON_TCS } else { @@ -2365,11 +2164,9 @@ ivas_error IVAS_DEC_VoIP_Flush( *nSamplesAvailableNext = hVoIP->nSamplesAvailableNext; *nSamplesFlushed = (int16_t) nSamplesFlushedLocal; } -#endif return error; } -#endif /*---------------------------------------------------------------------* @@ -2380,17 +2177,11 @@ ivas_error IVAS_DEC_VoIP_Flush( bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ -#ifdef JBM_TSM_ON_TCS , const int16_t nSamplesAsked -#endif ) { -#ifdef JBM_TSM_ON_TCS return ( ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 ) && ( hIvasDec->hVoIP->nSamplesAvailableNext < nSamplesAsked ) ); -#else - return JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0; -#endif } @@ -2431,11 +2222,7 @@ static void IVAS_DEC_Close_VoIP( apa_exit( &hVoIP->hTimeScaler ); -#ifdef JBM_TSM_ON_TCS pcmdsp_fifo_destroy( &hVoIP->hFifoOut ); -#else - pcmdsp_fifo_destroy( &hVoIP->hFifoAfterTimeScaler ); -#endif if ( hVoIP->apaExecBuffer != NULL ) { @@ -2761,7 +2548,6 @@ static ivas_error printConfigInfo_dec( } } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * Print VoIP mode info *-----------------------------------------------------------------*/ @@ -2770,7 +2556,6 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "VoIP mode: ON\n" ); } -#endif return IVAS_ERR_OK; } @@ -2870,18 +2655,14 @@ void IVAS_DEC_PrintDisclaimer( void ) static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, -#ifdef JBM_TSM_ON_TCS float *floatBuf, -#endif int16_t *pcmBuf ) { DEC_CORE_HANDLE *hCoreCoder; float output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN][L_FRAME48k]; float mixer_left, mixer_rigth; -#ifdef JBM_TSM_ON_TCS float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; int16_t ch; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -2891,12 +2672,10 @@ static ivas_error evs_dec_main( mdct_switching_dec( hCoreCoder[0] ); -#ifdef JBM_TSM_ON_TCS for ( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ ) { p_output[ch] = output[ch]; } -#endif /* run the main EVS decoding routine */ if ( hCoreCoder[0]->codec_mode == MODE1 ) @@ -2951,7 +2730,6 @@ static ivas_error evs_dec_main( v_multc( output[0], mixer_left, output[0], nOutSamples ); } -#ifdef JBM_TSM_ON_TCS if ( floatBuf != NULL ) { /* BE workaround */ @@ -2970,18 +2748,11 @@ static ivas_error evs_dec_main( } else { -#endif #ifdef DEBUGGING st_ivas->noClipping += #endif -#ifdef JBM_TSM_ON_TCS ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); -#else - ivas_syn_output( output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); -#endif -#ifdef JBM_TSM_ON_TCS } -#endif return error; } @@ -3179,7 +2950,6 @@ static ivas_error input_format_API_to_internal( } -#ifdef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_GetRenderGranularity() * @@ -3342,4 +3112,3 @@ ivas_error IVAS_DEC_VoIP_reconfigure( return error; } -#endif diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index c317b45e3a..8d2159a71f 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -232,17 +232,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ const uint32_t systemTimestamp_ms /* i : current system timestamp */ -#if defined( JBM_TSM_ON_TCS ) || defined(VARIABLE_SPEED_DECODING ) , uint16_t *sampleAvailableNext /* o : samples available for the next call */ -#endif #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter #endif ); -#if defined( JBM_TSM_ON_TCS ) || defined(VARIABLE_SPEED_DECODING ) ivas_error IVAS_DEC_VoIP_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ @@ -250,7 +247,6 @@ ivas_error IVAS_DEC_VoIP_Flush( uint16_t *nSamplesAvailableNext, /* o : number of samples still available */ int16_t *nSamplesFlushed /* o : number of samples flushed */ ); -#endif /* Setter functions - apply changes to decoder configuration */ @@ -376,10 +372,8 @@ ivas_error IVAS_DEC_GetPcmFrameSize( /*! r: true if decoder has no data in VoIP jitter buffer */ bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ -#ifdef JBM_TSM_ON_TCS , const int16_t nSamplesAsked -#endif ); ivas_error IVAS_DEC_VoIP_Get_CA_offset( diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index ae66c4fcfc..10f8743b23 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1292,13 +1292,8 @@ static ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig, -#ifdef JBM_TSM_ON_TCS float *pcm_in[], float *pcm_out[], -#else - float pcm_in[][L_FRAME48k], - float pcm_out[][L_FRAME48k], -#endif const int32_t output_Fs, const int16_t i_ts ) { @@ -1471,19 +1466,13 @@ ivas_error ivas_rend_crendProcess( HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: input/output audio channels */ -#else - float output[][L_FRAME48k], /* i/o: input/output audio channels */ -#endif const int32_t output_Fs ) { int16_t i, subframe_idx, output_frame, subframe_len; int16_t nchan_out; float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; -#ifdef JBM_TSM_ON_TCS float *p_pcm_tmp[BINAURAL_CHANNELS]; -#endif AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; @@ -1507,12 +1496,10 @@ ivas_error ivas_rend_crendProcess( output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { p_pcm_tmp[i] = pcm_tmp[i]; } -#endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { @@ -1537,22 +1524,14 @@ ivas_error ivas_rend_crendProcess( if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, p_pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) -#endif { return error; } if ( pCrend->hCrend->hReverb != NULL ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1576,7 +1555,6 @@ ivas_error ivas_rend_crendProcess( } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crendProcessSubframe() * @@ -1712,4 +1690,3 @@ ivas_error ivas_rend_crendProcessSubframe( return IVAS_ERR_OK; } -#endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index a561f2ecd0..c520c5631e 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -81,11 +81,7 @@ typedef struct hrtfGainCache * Local function prototypes *------------------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float *output_f[], const int16_t nchan_transport, const int16_t subframe ); -#else -static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], const int16_t nchan_transport, const int16_t subframe ); -#endif static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH @@ -98,19 +94,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, float Rmat[3][3] ); #endif -#ifdef JBM_TSM_ON_TCS static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); -#else -static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); - -static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, float Rmat[3][3] ); - -static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, float Rmat[3][3] ); -#endif static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH @@ -258,7 +246,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( st_ivas->hDiracDecBin = hBinaural; -#ifdef JBM_TSM_ON_TCS /* allocate transport channels*/ if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) { @@ -270,7 +257,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( return error; } } -#endif return IVAS_ERR_OK; } @@ -351,7 +337,6 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------------- * void ivas_dirac_dec_binaural_render() * @@ -418,7 +403,6 @@ void ivas_dirac_dec_binaural_render( return; } -#endif /*------------------------------------------------------------------------- @@ -434,7 +418,6 @@ void ivas_dirac_dec_binaural( ) { int16_t subframe; -#ifdef JBM_TSM_ON_TCS float cng_td_buffer[L_FRAME16k]; float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; @@ -465,45 +448,32 @@ void ivas_dirac_dec_binaural( { ivas_spar_dec_set_render_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); } -#endif if ( st_ivas->hDiracDecBin->useTdDecorr ) { float *decorr_signal[BINAURAL_CHANNELS]; -#ifndef JBM_TSM_ON_TCS - int16_t ch; -#endif int16_t output_frame; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { decorr_signal[ch] = (float *) &( output_f[ch + BINAURAL_CHANNELS][0] ); -#ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer->tc[ch + BINAURAL_CHANNELS] = decorr_signal[ch]; -#endif } output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#ifdef JBM_TSM_ON_TCS ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_output, decorr_signal, output_frame ); -#else - ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, output_f, decorr_signal, output_frame ); -#endif } -#ifdef JBM_TSM_ON_TCS if ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[nchan_transport], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); } -#endif for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) { -#ifdef JBM_TSM_ON_TCS int16_t n_samples_sf = slot_size * st_ivas->hDirAC->subframe_nbslots[subframe]; ivas_dirac_dec_binaural_internal( st_ivas, p_output, nchan_transport, subframe ); @@ -513,17 +483,12 @@ void ivas_dirac_dec_binaural( p_output[ch] += n_samples_sf; } st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + 1 ) % st_ivas->hDirAC->dirac_md_buffer_length; -#else - ivas_dirac_dec_binaural_internal( st_ivas, output_f, nchan_transport, subframe ); -#endif } -#ifdef JBM_TSM_ON_TCS for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) { st_ivas->hTcBuffer->tc[ch] = NULL; } -#endif return; } @@ -536,11 +501,7 @@ void ivas_dirac_dec_binaural( static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, -#ifdef JBM_TSM_ON_TCS float *output_f[], -#else - float output_f[][L_FRAME48k], -#endif const int16_t nchan_transport, const int16_t subframe ) { @@ -555,11 +516,7 @@ static void ivas_dirac_dec_binaural_internal( hDirAC = st_ivas->hDirAC; nBins = hDirAC->num_freq_bands; -#ifdef JBM_TSM_ON_TCS offsetSamples = hDirAC->slots_rendered * nBins; -#else - offsetSamples = subframe * CLDFB_SLOTS_PER_SUBFRAME * nBins; -#endif /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; @@ -581,22 +538,14 @@ static void ivas_dirac_dec_binaural_internal( Rmat[2][2] = 1.0f; /* CLDFB Analysis of input */ -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( ch = 0; ch < numInChannels; ch++ ) { if ( ch == 0 || nchan_transport == 2 ) { cldfbAnalysis_ts( -#ifdef JBM_TSM_ON_TCS &( st_ivas->hTcBuffer->tc[ch][nBins * slot + offsetSamples] ), -#else - &( output_f[ch][nBins * slot + offsetSamples] ), -#endif Cldfb_RealBuffer_in[ch][slot], Cldfb_ImagBuffer_in[ch][slot], nBins, st_ivas->cldfbAnaDec[ch] ); @@ -616,19 +565,11 @@ static void ivas_dirac_dec_binaural_internal( int16_t slotInFrame; numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; -#ifdef JBM_TSM_ON_TCS slotInFrame = hDirAC->slots_rendered + slot; -#else - slotInFrame = subframe * CLDFB_SLOTS_PER_SUBFRAME + slot; -#endif generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], -#ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer->tc[nchan_transport], -#else - &( output_f[1][L_FRAME48k - L_FRAME16k] ), /*used as temporary static buffer for the whole frame*/ -#endif Cldfb_RealBuffer_in[2][slot], Cldfb_ImagBuffer_in[2][slot], slotInFrame, st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, @@ -681,11 +622,7 @@ static void ivas_dirac_dec_binaural_internal( for ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) { cldfbAnalysis_ts( -#ifdef JBM_TSM_ON_TCS &( st_ivas->hTcBuffer->tc[ch][nBins * slot + offsetSamples] ), -#else - &( output_f[ch][nBins * slot + offsetSamples] ), -#endif Cldfb_RealBuffer_in[ch][slot], Cldfb_ImagBuffer_in[ch][slot], nBins, st_ivas->cldfbAnaDec[ch] ); @@ -718,15 +655,9 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { -#ifdef JBM_TSM_ON_TCS adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); -#else - adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, Rmat ); - - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, Rmat ); -#endif } } @@ -759,12 +690,8 @@ static void ivas_dirac_dec_binaural_internal( st_ivas->hDirAC->hDiffuseDist = NULL; -#ifdef JBM_TSM_ON_TCS hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe]; hDirAC->subframes_rendered++; -#else - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; -#endif return; } @@ -821,8 +748,6 @@ static void ivas_dirac_dec_decorrelate_slot( return; } -#ifdef JBM_TSM_ON_TCS -#endif static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( @@ -901,18 +826,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Formulate input and target covariance matrices for this subframe */ set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); -#ifdef JBM_TSM_ON_TCS dirac_read_idx = hDirAC->render_to_md_map[subframe]; -#else - dirac_read_idx = hDirAC->dirac_read_idx; -#endif /* Calculate input covariance matrix */ -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) -#else - for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) -#endif { for ( bin = 0; bin < nBins; bin++ ) { @@ -953,11 +870,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) -#else - for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) -#endif { for ( bin = 0; bin < nBins; bin++ ) { @@ -1192,11 +1105,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric #endif { float diffuseFieldCoherence; -#ifdef JBM_TSM_ON_TCS diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; -#else - diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[subframe][bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[subframe][bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[subframe][bin] * h->diffuseFieldCoherenceZ[bin]; -#endif h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; } else @@ -1469,11 +1378,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, -#ifdef JBM_TSM_ON_TCS float *output_f[], -#else - float output_f[][L_FRAME48k], -#endif float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, @@ -1491,41 +1396,23 @@ static void ivas_dirac_dec_binaural_process_output( float *decSlotRePointer; float *decSlotImPointer; int16_t offsetSamples; -#ifdef JBM_TSM_ON_TCS int16_t nSlots; -#endif h = st_ivas->hDiracDecBin; nBins = st_ivas->hDirAC->num_freq_bands; -#ifdef JBM_TSM_ON_TCS offsetSamples = 0; nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; -#else - offsetSamples = subframe * CLDFB_SLOTS_PER_SUBFRAME * nBins; -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { /* Process second / room effect part of binaural output when needed */ -#ifdef JBM_TSM_ON_TCS ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); -#else - ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, inRe, inIm, reverbRe, reverbIm ); -#endif } interpVal = 0.0f; -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { -#ifdef JBM_TSM_ON_TCS interpVal += 1.0f / (float) nSlots; -#else - interpVal += 1.0f / ( (float) CLDFB_SLOTS_PER_SUBFRAME ); -#endif if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { ivas_dirac_dec_decorrelate_slot( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); @@ -1607,9 +1494,7 @@ static void adaptTransportSignalsHeadtracked( float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, -#ifdef JBM_TSM_ON_TCS const int16_t nSlots, -#endif float Rmat[3][3] ) { int16_t slot, ch, bin, louderCh; @@ -1641,11 +1526,7 @@ static void adaptTransportSignalsHeadtracked( for ( ch = 0; ch < 2; ch++ ) { ch_nrg[ch] = 0.0f; -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( bin = bin_lo; bin < bin_hi; bin++ ) { @@ -1681,11 +1562,7 @@ static void adaptTransportSignalsHeadtracked( { float band_nrg = 0.0f; -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( bin = bin_lo; bin < bin_hi; bin++ ) { @@ -1711,11 +1588,7 @@ static void adaptTransportSignalsHeadtracked( ene_proc = hHeadTrackData->procChEneIIR[0][band_idx] + hHeadTrackData->procChEneIIR[1][band_idx]; eqVal = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( ch = 0; ch < 2; ch++ ) { @@ -1736,9 +1609,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, -#ifdef JBM_TSM_ON_TCS const int16_t nSlots, -#endif float Rmat[3][3] ) { int16_t slot, bin, ch; @@ -1761,11 +1632,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( /* When currently in interpolation */ if ( hHeadTrackData->lrSwitchedNext != hHeadTrackData->lrSwitchedCurrent ) { -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { float switchOrderFactor, origOrderFactor; @@ -1821,11 +1688,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( /* If not in interpolation, but in switched prototype situation, then switch left and right channels */ if ( hHeadTrackData->lrSwitchedCurrent == 1 ) { -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( bin = 0; bin < nBins; bin++ ) { diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index 7875165e51..951d950211 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -172,11 +172,7 @@ void ivas_limiter_close( void ivas_limiter_dec( IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ -#ifdef JBM_TSM_ON_TCS float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ -#else - float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], /* i/o: input/output buffer */ -#endif const int16_t num_channels, /* i : number of channels to be processed */ const int16_t output_frame, /* i : number of samples per channel in the buffer */ const int16_t BER_detect /* i : BER detect flag */ diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index cb71f5b731..361d017629 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -264,11 +264,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ const int16_t ism_md_subframe_update, /* i: Number of subframes to delay ism metadata to sync with audio */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: SCE channels / Binaural synthesis */ -#else - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ -#endif const int16_t output_frame /* i : output frame length */ ) { @@ -277,7 +273,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; ivas_error error; int16_t c_indx, nS; -#ifdef JBM_TSM_ON_TCS float *p_reverb_signal[BINAURAL_CHANNELS]; int16_t ch; @@ -285,7 +280,6 @@ ivas_error ivas_td_binaural_renderer_unwrap( { p_reverb_signal[ch] = reverb_signal[ch]; } -#endif subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; @@ -312,11 +306,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( if ( hReverb != NULL && hReverb->pConfig.roomAcoustics.late_reverb_on ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_reverb_process( hReverb, transport_config, 0, output, p_reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_reverb_process( hReverb, transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -348,11 +338,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ -#else - float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ -#endif const int16_t subframe_length, /* i/o: subframe length */ const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ const int16_t ism_md_subframe_update /* Number of subframes to delay ism metadata to sync with audio */ @@ -633,7 +619,6 @@ ivas_error ivas_td_binaural_renderer_ext( AUDIO_CONFIG transport_config; ivas_error error; int16_t ism_md_subframe_update_ext; -#ifdef JBM_TSM_ON_TCS float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; @@ -641,7 +626,6 @@ ivas_error ivas_td_binaural_renderer_ext( { p_output[ch] = output[ch]; } -#endif push_wmops( "ivas_td_binaural_renderer_ext" ); @@ -681,15 +665,9 @@ ivas_error ivas_td_binaural_renderer_ext( hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; } -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, ( headRotData != NULL ) ? headRotData->Pos : NULL, ism_md_subframe_update_ext, p_output, output_frame ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, - ( headRotData != NULL ) ? headRotData->Pos : NULL, ism_md_subframe_update_ext, output, output_frame ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index f59ab91e0d..e1328ca9d3 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -92,11 +92,7 @@ void ivas_limiter_close( void ivas_limiter_dec ( IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ -#ifdef JBM_TSM_ON_TCS float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ -#else - float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], /* i/o: input/output buffer */ -#endif const int16_t num_channels, /* i : number of channels to be processed */ const int16_t output_frame, /* i : number of samples per channel in the buffer */ const int16_t BER_detect /* i : BER detect flag */ @@ -159,7 +155,6 @@ void ivas_dirac_dec_binaural( const int16_t nchan_transport /* i : number of transport channels */ ); -#ifdef JBM_TSM_ON_TCS void ivas_dirac_dec_binaural_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -168,7 +163,6 @@ void ivas_dirac_dec_binaural_render( const int16_t nchan_transport, /* i : number of transport channels */ float *output_f[] /* o : rendered time signal */ ); -#endif ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -237,11 +231,7 @@ ivas_error ivas_td_binaural_renderer_unwrap( const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ const int16_t ism_md_subframe_update, -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: SCE channels / Binaural synthesis */ -#else - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ -#endif const int16_t output_frame /* i : output frame length */ ); @@ -283,11 +273,7 @@ void ivas_td_binaural_close( ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ -#else - float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ -#endif const int16_t subframe_length, /* i/o: subframe length */ const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ const int16_t ism_md_subframe_update /* Number of subframes to delay metadata to sync with audio */ @@ -517,15 +503,10 @@ ivas_error ivas_rend_crendProcess( HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: input/output audio channels */ -#else - float output[][L_FRAME48k], /* i/o: input/output audio channels */ -#endif const int32_t output_Fs ); -#ifdef JBM_TSM_ON_TCS ivas_error ivas_rend_crendProcessSubframe( const CREND_WRAPPER *pCrend, /* i/o: Crend wrapper handle */ const AUDIO_CONFIG inConfig, /* i : input audio configuration */ @@ -540,7 +521,6 @@ ivas_error ivas_rend_crendProcessSubframe( const int16_t n_samples_to_render, /* i : output frame length per channel */ const int32_t output_Fs /* i : output sampling rate */ ); -#endif /*----------------------------------------------------------------------------------* * Reverberator @@ -565,17 +545,13 @@ void ivas_binaural_reverb_close( void ivas_binaural_reverb_processSubframe( REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ const int16_t numInChannels, /* i : num input channels to be processed */ -#ifdef JBM_TSM_ON_TCS const int16_t numSlots, /* i : number of slots to be processed */ -#endif float inReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real */ float inImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ float outReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ float outImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* o : output CLDFB data imag */ ); -#ifdef JBM_TSM_ON_TCS -#endif ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ @@ -593,13 +569,8 @@ ivas_error ivas_reverb_process( const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const int16_t mix_signals, /* i : add reverb to output signal */ -#ifdef JBM_TSM_ON_TCS float *pcm_in[], /* i : the PCM audio to apply reverb on */ float *pcm_out[], /* o : the PCM audio with reverb applied */ -#else - float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ - float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ -#endif const int16_t i_ts /* i : subframe index */ ); @@ -822,11 +793,7 @@ void SHrotmatgen( void rotateFrame_shd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ -#else - float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ -#endif const int16_t subframe_len, /* i : subframe length per channel */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ const int16_t subframe_idx /* i : subframe index */ @@ -834,11 +801,7 @@ void rotateFrame_shd( void rotateFrame_sd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: unrotated SD signal buffer in TD */ -#else - float output[][L_FRAME48k], /* i/o: unrotated SD signal buffer in TD */ -#endif const int16_t subframe_len, /* i : subframe length per channel */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ @@ -850,9 +813,7 @@ void rotateFrame_shd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ float Rmat[3][3], /* i : real-space rotation matrix */ const int16_t nInChannels, /* i : number of channels */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif const int16_t shd_rot_max_order /* i : split-order rotation method */ ); @@ -862,9 +823,7 @@ void rotateFrame_sd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif const int16_t nb_band /* i : number of CLDFB bands to process */ ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index baa83fad0e..856914a58c 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1437,11 +1437,7 @@ static void reverb_block( static ivas_error downmix_input_block( const REVERB_HANDLE hReverb, -#ifdef JBM_TSM_ON_TCS float *pcm_in[], -#else - float pcm_in[][L_FRAME48k], -#endif const AUDIO_CONFIG input_audio_config, float *pPcm_out, const int16_t input_offset ) @@ -1583,13 +1579,8 @@ ivas_error ivas_reverb_process( const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const int16_t mix_signals, /* i : add reverb to output signal */ -#ifdef JBM_TSM_ON_TCS float *pcm_in[], /* i : the PCM audio to apply reverb on */ float *pcm_out[], /* o : the PCM audio with reverb applied */ -#else - float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ - float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ -#endif const int16_t i_ts /* i : subframe index */ ) { @@ -1628,9 +1619,7 @@ ivas_error ivas_reverb_process( void ivas_binaural_reverb_processSubframe( REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ const int16_t numInChannels, /* i : num inputs to be processed */ -#ifdef JBM_TSM_ON_TCS const int16_t numSlots, /* i : number of slots to be processed */ -#endif float inReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ float inImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ float outReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ @@ -1647,7 +1636,6 @@ void ivas_binaural_reverb_processSubframe( * for convolution purposes later on. */ for ( bin = 0; bin < hReverb->numBins; bin++ ) { -#ifdef JBM_TSM_ON_TCS /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + numSlots, hReverb->loopBufLength[bin] ); mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + numSlots, hReverb->loopBufLength[bin] ); @@ -1657,32 +1645,13 @@ void ivas_binaural_reverb_processSubframe( * is decorrelated later on. */ v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], numSlots ); v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], numSlots ); -#else - /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ - mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); - mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); - - /* Add the data from the end of the loop to the beginning, with an attenuation factor - * according to RT60. This procedure generates an IIR decaying response. The response - * is decorrelated later on. */ - v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], hReverb->blockSize ); - v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], hReverb->blockSize ); -#endif } /* 2) Apply the determined pre-delay to the input audio, and add the delayed audio to the loop. */ idx = hReverb->preDelayBufferIndex; -#ifdef JBM_TSM_ON_TCS for ( sample = 0; sample < numSlots; sample++ ) -#else - for ( sample = 0; sample < hReverb->blockSize; sample++ ) -#endif { -#ifdef JBM_TSM_ON_TCS invertSampleIndex = numSlots - sample - 1; -#else - invertSampleIndex = hReverb->blockSize - sample - 1; -#endif for ( bin = 0; bin < hReverb->numBins; bin++ ) { @@ -1725,20 +1694,14 @@ void ivas_binaural_reverb_processSubframe( phaseShiftTypePr = hReverb->tapPhaseShiftType[bin][ch]; /* Flush output */ -#ifdef JBM_TSM_ON_TCS set_f( hReverb->outputBufferReal[bin][ch], 0.0f, numSlots ); set_f( hReverb->outputBufferImag[bin][ch], 0.0f, numSlots ); -#else - set_f( hReverb->outputBufferReal[bin][ch], 0.0f, hReverb->blockSize ); - set_f( hReverb->outputBufferImag[bin][ch], 0.0f, hReverb->blockSize ); -#endif /* Add from temporally decaying sparse tap locations the audio to the output. */ for ( tapIdx = 0; tapIdx < hReverb->taps[bin][ch]; tapIdx++ ) { switch ( phaseShiftTypePr[tapIdx] ) { -#ifdef JBM_TSM_ON_TCS case 0: /* 0 degrees phase */ v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], numSlots ); v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], numSlots ); @@ -1755,24 +1718,6 @@ void ivas_binaural_reverb_processSubframe( v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], numSlots ); v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], numSlots ); break; -#else - case 0: /* 0 degrees phase */ - v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - case 1: /* 90 degrees phase */ - v_sub( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_add( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - case 2: /* 180 degrees phase */ - v_sub( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_sub( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - default: /* 270 degrees phase */ - v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; -#endif } } } @@ -1782,11 +1727,7 @@ void ivas_binaural_reverb_processSubframe( { if ( hReverb->useBinauralCoherence ) { -#ifdef JBM_TSM_ON_TCS for ( sample = 0; sample < numSlots; sample++ ) -#else - for ( sample = 0; sample < hReverb->blockSize; sample++ ) -#endif { float leftRe, rightRe, leftIm, rightIm; @@ -1807,18 +1748,10 @@ void ivas_binaural_reverb_processSubframe( /* 4) Write data to output */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { -#ifdef JBM_TSM_ON_TCS for ( sample = 0; sample < numSlots; sample++ ) -#else - for ( sample = 0; sample < hReverb->blockSize; sample++ ) -#endif { /* Audio was in the temporally inverted order for convolution, re-invert audio to output */ -#ifdef JBM_TSM_ON_TCS invertSampleIndex = numSlots - sample - 1; -#else - invertSampleIndex = hReverb->blockSize - sample - 1; -#endif for ( bin = 0; bin < hReverb->numBins; bin++ ) { @@ -1837,8 +1770,6 @@ void ivas_binaural_reverb_processSubframe( return; } -#ifdef JBM_TSM_ON_TCS -#endif /*------------------------------------------------------------------------- * ivas_binaural_reverb_open() diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 79ef75e470..5f4a54a3c5 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -250,11 +250,7 @@ void rotateAziEle( void rotateFrame_shd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ -#else - float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ -#endif const int16_t subframe_len, /* i : subframe length per channel */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ const int16_t subframe_idx /* i : subframe index */ @@ -357,11 +353,7 @@ void rotateFrame_shd( void rotateFrame_sd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: unrotated SD signal buffer in TD */ -#else - float output[][L_FRAME48k], /* i/o: unrotated SD signal buffer in TD */ -#endif const int16_t subframe_len, /* i : subframe length per channel */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ @@ -499,9 +491,7 @@ void rotateFrame_shd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ float Rmat[3][3], /* i : real-space rotation matrix */ const int16_t nInChannels, /* i : number of channels */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif const int16_t shd_rot_max_order /* i : split-order rotation method */ ) { @@ -525,11 +515,7 @@ void rotateFrame_shd_cldfb( SHrotmatgen( SHrotmat, Rmat, shd_rot_max_order ); /* rotation by mtx multiplication */ -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < numTimeSlots; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { for ( iBand = 0; iBand < CLDFB_NO_CHANNELS_MAX; iBand++ ) { @@ -600,9 +586,7 @@ void rotateFrame_sd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif const int16_t nb_band /* i : number of CLDFB bands to process */ ) { @@ -661,11 +645,7 @@ void rotateFrame_sd_cldfb( p_imagRot = imagRot[n]; if ( g1 > 0.f ) { -#ifdef JBM_TSM_ON_TCS for ( iBlock = 0; iBlock < numTimeSlots; iBlock++ ) -#else - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) -#endif { p_real = Cldfb_RealBuffer[m][iBlock]; p_imag = Cldfb_ImagBuffer[m][iBlock]; @@ -685,11 +665,7 @@ void rotateFrame_sd_cldfb( { p_realRot = realRot[n]; p_imagRot = imagRot[n]; -#ifdef JBM_TSM_ON_TCS for ( iBlock = 0; iBlock < numTimeSlots; iBlock++ ) -#else - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) -#endif { p_real = Cldfb_RealBuffer[n][iBlock]; p_imag = Cldfb_ImagBuffer[n][iBlock]; diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 059cd847e1..0974677922 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -66,9 +66,7 @@ void ivas_sba_prototype_renderer( int16_t cldfb_band; int16_t out_ch, in_ch; int16_t firstInCh, inChEnd, firstOutCh, outChEnd; -#ifdef JBM_TSM_ON_TCS int16_t slot_idx_start, md_idx; -#endif push_wmops( "ivas_sba_prototype_renderer" ); @@ -79,9 +77,7 @@ void ivas_sba_prototype_renderer( num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; -#ifdef JBM_TSM_ON_TCS slot_idx_start = hSpar->slots_rendered; -#endif if ( st_ivas->nchan_transport == 1 ) { @@ -99,19 +95,11 @@ void ivas_sba_prototype_renderer( } /* Apply mixing matrix */ -#ifdef JBM_TSM_ON_TCS for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < CLDFB_SLOTS_PER_SUBFRAME; ts++ ) -#endif { /* determine SPAR parameters for this time slot */ -#ifdef JBM_TSM_ON_TCS md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); -#else - ivas_spar_get_parameters( hSpar, hDecoderConfig, ts + subframe * CLDFB_SLOTS_PER_SUBFRAME, numch_out, numch_in, num_spar_bands, mixer_mat ); -#endif for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) { @@ -155,7 +143,6 @@ void ivas_sba_prototype_renderer( } } -#ifdef JBM_TSM_ON_TCS /* Update mixing matrices */ if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) { @@ -179,38 +166,13 @@ void ivas_sba_prototype_renderer( } } } -#endif } -#ifndef JBM_TSM_ON_TCS - /* Update mixing matrices */ - hSpar->i_subframe++; - hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) - { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( b = 0; b < num_spar_bands; b++ ) - { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + subframe * IVAS_MAX_NUM_BANDS]; - } - } - } -#endif /* Create prototypes */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { -#ifdef JBM_TSM_ON_TCS for ( ts = 0; ts < hSpar->subframe_nbslots[subframe]; ts++ ) -#else - for ( ts = 0; ts < CLDFB_SLOTS_PER_SUBFRAME; ts++ ) -#endif { if ( st_ivas->nchan_transport == 1 ) /* Dual mono */ { @@ -236,10 +198,8 @@ void ivas_sba_prototype_renderer( } } -#ifdef JBM_TSM_ON_TCS hSpar->subframes_rendered++; hSpar->slots_rendered += hSpar->subframe_nbslots[subframe]; -#endif pop_wmops(); return; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 3810cb1918..e9d4b2d5e6 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2473,9 +2473,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hDecoderConfig->output_Fs = sampleRate; decDummy->hDecoderConfig->nchan_out = numOutChannels; decDummy->hDecoderConfig->Opt_Headrotation = 0; -#ifdef JBM_TSM_ON_TCS decDummy->hDecoderConfig->voip_active = 0; -#endif decDummy->hBinRenderer = NULL; decDummy->hEFAPdata = NULL; @@ -2492,9 +2490,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hHeadTrackData = NULL; decDummy->hDirAC = NULL; #endif -#ifdef JBM_TSM_ON_TCS decDummy->hTcBuffer = NULL; -#endif decDummy->hDecoderConfig->output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); decDummy->nchan_transport = numTransChannels; @@ -2544,10 +2540,8 @@ static DecoderDummy *initDecoderDummy( decDummy->hRenderConfig = NULL; } -#ifdef JBM_TSM_ON_TCS /* get a default TC buffer, needed for some renderers */ ivas_jbm_dec_tc_buffer_open( decDummy, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ); -#endif decDummy->renderer_type = RENDERER_DISABLE; @@ -2656,10 +2650,8 @@ static void freeDecoderDummy( /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); -#ifdef JBM_TSM_ON_TCS /* TC buffer */ ivas_jbm_dec_tc_buffer_close( &pDecDummy->hTcBuffer ); -#endif free( pDecDummy ); pDecDummy = NULL; @@ -4383,14 +4375,12 @@ static ivas_error renderIsmToBinauralRoom( IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioObjectPosition rotatedPos; const IVAS_REND_HeadRotData *headRotData; -#ifdef JBM_TSM_ON_TCS float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpRendBuffer[i] = tmpRendBuffer[i]; } -#endif push_wmops( "renderIsmToBinauralRoom" ); @@ -4489,13 +4479,8 @@ static ivas_error renderIsmToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, - NULL, NULL, NULL, NULL, tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -4763,7 +4748,6 @@ static ivas_error renderMcToBinaural( IVAS_REND_AudioConfig inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; -#ifdef JBM_TSM_ON_TCS float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; int16_t i; @@ -4771,7 +4755,6 @@ static ivas_error renderMcToBinaural( { p_tmpRendBuffer[i] = tmpRendBuffer[i]; } -#endif push_wmops( "renderMcToBinaural" ); @@ -4812,13 +4795,8 @@ static ivas_error renderMcToBinaural( } /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -4846,7 +4824,6 @@ static ivas_error renderMcToBinauralRoom( IVAS_REND_AudioConfig inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; -#ifdef JBM_TSM_ON_TCS float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; int16_t i; @@ -4854,7 +4831,6 @@ static ivas_error renderMcToBinauralRoom( { p_tmpRendBuffer[i] = tmpRendBuffer[i]; } -#endif push_wmops( "renderMcToBinauralRoom" ); @@ -4895,13 +4871,8 @@ static ivas_error renderMcToBinauralRoom( } /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -4932,9 +4903,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( IVAS_REND_AudioBuffer tmpRotBuffer; IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioBuffer *tmpBufPtr; -#ifdef JBM_TSM_ON_TCS float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; -#endif push_wmops( "renderMcCustomLsToBinauralRoom" ); @@ -4942,12 +4911,10 @@ static ivas_error renderMcCustomLsToBinauralRoom( headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } -#endif /* apply rotation */ if ( headRotEnabled ) @@ -4982,13 +4949,8 @@ static ivas_error renderMcCustomLsToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, - tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -5188,19 +5150,15 @@ static ivas_error renderSbaToBinaural( float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; -#ifdef JBM_TSM_ON_TCS float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; int16_t i; -#endif push_wmops( "renderSbaToBinaural" ); -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } -#endif /* apply rotation */ if ( sbaInput->base.ctx.pHeadRotData->headRotEnabled ) @@ -5225,13 +5183,8 @@ static ivas_error renderSbaToBinaural( } /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -5256,20 +5209,16 @@ static ivas_error renderSbaToBinauralRoom( IVAS_REND_AudioBuffer tmpRotBuffer; IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioBuffer *tmpBufPtr; -#ifdef JBM_TSM_ON_TCS float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; -#endif tmpRotBuffer = outAudio; /* avoid compilation warning */ push_wmops( "renderSbaToBinauralRoom" ); -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } -#endif headRotEnabled = sbaInput->base.ctx.pHeadRotData->headRotEnabled; @@ -5309,13 +5258,8 @@ static ivas_error renderSbaToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -5467,11 +5411,7 @@ static void renderMasaToMc( } else { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); -#else - ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, NULL, NULL, -1 ); -#endif } accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); @@ -5488,11 +5428,7 @@ static void renderMasaToSba( copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); -#else - ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, NULL, NULL, -1 ); -#endif accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); -- GitLab From a70b76c590791f0db6d92a0b0172bdaa4393697b Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:06:32 +0200 Subject: [PATCH 28/53] [cleanup] accept FIX_DTX_428 --- lib_com/ivas_dirac_com.c | 16 ---------------- lib_com/options.h | 1 - lib_enc/ivas_sba_enc.c | 6 ------ 3 files changed, 23 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 55d9911c3e..3ff512a26c 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -528,22 +528,6 @@ ivas_error ivas_dirac_sba_config( { return error; } -#if !defined( FIX_DTX_428 ) - { - int16_t dir, j; - for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) - { - for ( j = 0; j < nbands_coded; j++ ) - { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[dir].band_data[j].energy_ratio_index[i] = 0; - hQMetaData->q_direction[dir].band_data[j].energy_ratio_index_mod[i] = 0; - } - } - } - } -#endif } ivas_get_dirac_sba_max_md_bits( sba_total_brate, diff --git a/lib_com/options.h b/lib_com/options.h index 14b5e1b921..3eb7c01d95 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_DTX_428 /* FhG: fix for issue 428, crash with DTX and bitrate switching */ #define FIX_STEREO_474 /* FhG fix for issue 574, crash with SBA to stereo output at 512 kbps */ #define FIX_MDCT_ST_PLC_FADEOUT_DELAY #define FIX_DIRAC_LS_SYNTHESIS_CONFIG_479 /* FhG: fix for issue 479, broken LS output with DirAC at high BRs */ diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index c26f8e9983..a1a505f67a 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -121,10 +121,8 @@ ivas_error ivas_sba_enc_reconfigure( SPAR_ENC_HANDLE hSpar; int16_t analysis_order_old; int16_t spar_reconfig_flag; -#ifdef FIX_DTX_428 int16_t nbands_old; int16_t ndir_old; -#endif spar_reconfig_flag = 0; nchan_transport_old = st_ivas->nchan_transport; @@ -132,10 +130,8 @@ ivas_error ivas_sba_enc_reconfigure( nSCE_old = st_ivas->nSCE; st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); -#ifdef FIX_DTX_428 nbands_old = st_ivas->hQMetaData->q_direction->cfg.nbands; ndir_old = st_ivas->hQMetaData->no_directions; -#endif if ( analysis_order_old != st_ivas->sba_analysis_order ) { @@ -250,7 +246,6 @@ ivas_error ivas_sba_enc_reconfigure( { return error; } -#ifdef FIX_DTX_428 if ( st_ivas->hQMetaData->q_direction->cfg.nbands != nbands_old || st_ivas->hQMetaData->no_directions != ndir_old ) { int16_t dir, j, i; @@ -267,7 +262,6 @@ ivas_error ivas_sba_enc_reconfigure( } } } -#endif #ifndef SBA_MODE_CLEAN_UP mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); #endif -- GitLab From f2308d398cfa462afd3b06befdcb160e6a25ba69 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:07:19 +0200 Subject: [PATCH 29/53] [cleanup] accept FIX_STEREO_474 --- lib_com/ivas_prot.h | 4 ---- lib_com/options.h | 1 - lib_dec/ivas_cpe_dec.c | 2 -- lib_dec/ivas_sba_dirac_stereo_dec.c | 12 ------------ lib_dec/ivas_stereo_dft_dec.c | 4 ---- 5 files changed, 23 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 729b1fced2..6ba8a133ec 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1315,10 +1315,8 @@ void stereo_dft_dec( 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 */ -#ifdef FIX_STEREO_474 , const int16_t num_md_sub_frames /* i: number of MD subframes */ -#endif ); void stereo_dft_res_ecu( @@ -3529,10 +3527,8 @@ void ivas_sba_dirac_stereo_smooth_parameters( 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 */ -#ifdef FIX_STEREO_474 , const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ -#endif ); void ivas_sba2mc_cldfb( diff --git a/lib_com/options.h b/lib_com/options.h index 3eb7c01d95..e3988e45d2 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_STEREO_474 /* FhG fix for issue 574, crash with SBA to stereo output at 512 kbps */ #define FIX_MDCT_ST_PLC_FADEOUT_DELAY #define FIX_DIRAC_LS_SYNTHESIS_CONFIG_479 /* FhG: fix for issue 479, broken LS output with DirAC at high BRs */ #define HYBRID_ITD_MAX /* FhG: Improvement for DFT-stereo for cases with large ITDs */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index a19fb21dc2..f0d550649d 100755 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -406,10 +406,8 @@ ivas_error ivas_cpe_dec( else { stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 -#ifdef FIX_STEREO_474 , MAX_PARAM_SPATIAL_SUBFRAMES -#endif ); } diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 13f1401f8e..7a5b492102 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -697,10 +697,8 @@ void ivas_sba_dirac_stereo_smooth_parameters( 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 */ -#ifdef FIX_STEREO_474 , const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ -#endif ) { int16_t i, j, k, i_sf; @@ -740,9 +738,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( float xfade_start_ns; int16_t xfade_delay_subframes; int16_t i_hist; -#ifdef FIX_STEREO_474 int16_t md_sf; -#endif xfade_start_ns = cross_fade_start_offset / (float) output_Fs * 1000000000.f - IVAS_FB_ENC_DELAY_NS; xfade_delay_subframes = (int16_t) ( xfade_start_ns / ( FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) ); @@ -754,9 +750,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( for ( i_sf = k * 2; i_sf < ( k + 1 ) * 2; i_sf++ ) { -#ifdef FIX_STEREO_474 md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? i_sf : 0; -#endif if ( hStereoDft->first_frame ) { @@ -802,11 +796,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( { for ( b = 0; b < hStereoDft->nbands; b++ ) { -#ifdef FIX_STEREO_474 hMdDec->mixer_mat_prev[4][i][j][b] = hMdDec->mixer_mat[i][j][b + md_sf * IVAS_MAX_NUM_BANDS]; -#else - hMdDec->mixer_mat_prev[4][i][j][b] = hMdDec->mixer_mat[i][j][b + i_sf * IVAS_MAX_NUM_BANDS]; -#endif } } } @@ -916,10 +906,8 @@ void ivas_sba_dirac_stereo_dec( ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport -#ifdef FIX_STEREO_474 , ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) -#endif ); /* DFT synthesis */ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 5c2d0b37e6..36d8eb662b 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1131,10 +1131,8 @@ void stereo_dft_dec( 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 */ -#ifdef FIX_STEREO_474 , const int16_t num_md_sub_frames /* i: number of MD subframes */ -#endif ) { int16_t i, k, b, N_div, stop; @@ -1213,10 +1211,8 @@ void stereo_dft_dec( hMdDec, cross_fade_start_offset, output_Fs -#ifdef FIX_STEREO_474 , num_md_sub_frames -#endif ); } else -- GitLab From 7179baef36b99f7dd293ecd13de45b76de120f93 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:08:44 +0200 Subject: [PATCH 30/53] [cleanup] accept FIX_MDCT_ST_PLC_FADEOUT_DELAY --- lib_com/ivas_cnst.h | 2 -- lib_com/options.h | 1 - lib_dec/er_dec_tcx.c | 12 ------------ 3 files changed, 15 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 9c657f69e7..9d74a26033 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -869,9 +869,7 @@ enum fea_names #define MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG 0.001f #define MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME 2 * FRAMES_PER_SEC #define MDCT_ST_PLC_FADEOUT_TO_ZERO_LEN 20 -#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY #define MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE 3 -#endif typedef enum { EQUAL_CORES, diff --git a/lib_com/options.h b/lib_com/options.h index e3988e45d2..d67ccf54a3 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_MDCT_ST_PLC_FADEOUT_DELAY #define FIX_DIRAC_LS_SYNTHESIS_CONFIG_479 /* FhG: fix for issue 479, broken LS output with DirAC at high BRs */ #define HYBRID_ITD_MAX /* FhG: Improvement for DFT-stereo for cases with large ITDs */ #define FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR /* Eri: Fix for issue 462: Use-of-uninitialized memory in external HRTF deallocation in decoder together with BR switching */ diff --git a/lib_dec/er_dec_tcx.c b/lib_dec/er_dec_tcx.c index fb797f92c9..24a4817052 100644 --- a/lib_dec/er_dec_tcx.c +++ b/lib_dec/er_dec_tcx.c @@ -553,7 +553,6 @@ void con_tcx( if ( A_cng != NULL ) { -#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY float alpha_delayed; alpha_delayed = 1.0f; @@ -563,27 +562,16 @@ void con_tcx( } if ( st->plcBackgroundNoiseUpdated && alpha_delayed != 1.0f ) -#else - if ( st->plcBackgroundNoiseUpdated && alpha != 1.0f ) -#endif { float lsp_local[M], lsp_fade[M], alpha_inv; -#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY alpha_inv = 1.0f - alpha_delayed; -#else - alpha_inv = 1.0f - alpha; -#endif a2lsp_stab( A_local, lsp_local, lsp_local ); for ( i = 0; i < M; i++ ) { -#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY lsp_fade[i] = alpha_delayed * lsp_local[i] + alpha_inv * st->lspold_cng[i]; -#else - lsp_fade[i] = alpha * lsp_local[i] + alpha_inv * st->lspold_cng[i]; -#endif } lsp2a_stab( lsp_fade, A_local, M ); -- GitLab From 4aaff20de7841c7ad23f7a85a37a528885f77fba Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:10:09 +0200 Subject: [PATCH 31/53] [cleanup] accept FIX_DIRAC_LS_SYNTHESIS_CONFIG_479 --- lib_com/options.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index d67ccf54a3..45d3e1dea0 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_DIRAC_LS_SYNTHESIS_CONFIG_479 /* FhG: fix for issue 479, broken LS output with DirAC at high BRs */ #define HYBRID_ITD_MAX /* FhG: Improvement for DFT-stereo for cases with large ITDs */ #define FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR /* Eri: Fix for issue 462: Use-of-uninitialized memory in external HRTF deallocation in decoder together with BR switching */ #define FIX_487_LOWRATE_SBA_TUNING_FIX /* Dlb: TUning fix for low bitrate cases to match theoretical longest SPAR MD bitstream */ -- GitLab From 40408d53ac60e2910125e51a01f9f02fbb6b00f1 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:10:53 +0200 Subject: [PATCH 32/53] [cleanup] accept HYBRID_ITD_MAX --- lib_com/ivas_prot.h | 2 -- lib_com/options.h | 1 - lib_enc/ivas_cpe_enc.c | 2 -- lib_enc/ivas_stat_enc.h | 2 -- lib_enc/ivas_stereo_dft_enc.c | 4 ---- lib_enc/ivas_stereo_dft_enc_itd.c | 10 ---------- lib_enc/ivas_stereo_dft_td_itd.c | 2 -- 7 files changed, 23 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6ba8a133ec..e0375afbb1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1550,10 +1550,8 @@ int16_t read_BS_adapt_GR_sg( void stereo_dft_hybrid_ITD_flag( STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ const int32_t input_Fs /* i : CPE element sampling rate */ -#ifdef HYBRID_ITD_MAX , const int16_t hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ -#endif ); void stereo_dft_enc_compute_itd( diff --git a/lib_com/options.h b/lib_com/options.h index 45d3e1dea0..b59d490f0e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define HYBRID_ITD_MAX /* FhG: Improvement for DFT-stereo for cases with large ITDs */ #define FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR /* Eri: Fix for issue 462: Use-of-uninitialized memory in external HRTF deallocation in decoder together with BR switching */ #define FIX_487_LOWRATE_SBA_TUNING_FIX /* Dlb: TUning fix for low bitrate cases to match theoretical longest SPAR MD bitstream */ #define FIX_490_MASA_2TC_LBR_DTX /* Nokia: Fixes issue 490 by correcting condition. */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 5f19a5395a..0f3fffb369 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -334,10 +334,8 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode == IVAS_CPE_DFT ) { stereo_dft_hybrid_ITD_flag( hCPE->hStereoDft->hConfig, input_Fs -#ifdef HYBRID_ITD_MAX , hCPE->hStereoDft->hItd->hybrid_itd_max -#endif ); /* Time Domain ITD compensation using extrapolation */ diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index a4bd36207d..5c9f02e4d4 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -81,10 +81,8 @@ typedef struct stereo_itd_data_struct int16_t prev_itd1; int16_t prev_itd2; -#ifdef HYBRID_ITD_MAX /*flag for hybrid ITD for very large ITDs*/ int16_t hybrid_itd_max; -#endif } ITD_DATA, *ITD_DATA_HANDLE; typedef struct dft_ana_struct diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 36e577b482..94ee7bddf6 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -298,10 +298,8 @@ ivas_error stereo_dft_enc_create( stereo_dft_enc_open( hStereoDft_loc, input_Fs, max_bwidth ); stereo_dft_hybrid_ITD_flag( hStereoDft_loc->hConfig, input_Fs -#ifdef HYBRID_ITD_MAX , hStereoDft_loc->hItd->hybrid_itd_max -#endif ); *hStereoDft = hStereoDft_loc; @@ -567,9 +565,7 @@ void stereo_enc_itd_init( hItd->prev_itd1 = 0; hItd->prev_itd2 = 0; -#ifdef HYBRID_ITD_MAX hItd->hybrid_itd_max = 0; -#endif return; } diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index 025729e0cd..fd438bcd3f 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -115,18 +115,14 @@ static void set_band_limits( void stereo_dft_hybrid_ITD_flag( STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ const int32_t input_Fs /* i : CPE element sampling rate */ -#ifdef HYBRID_ITD_MAX , const int16_t hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ -#endif ) { if ( hConfig != NULL ) { if ( hConfig->res_cod_mode || ( hConfig->ada_wb_res_cod_mode && input_Fs == 16000 ) -#ifdef HYBRID_ITD_MAX || ( hybrid_itd_max == 1 ) -#endif ) { hConfig->hybrid_itd_flag = 1; @@ -650,10 +646,8 @@ void stereo_dft_enc_compute_itd( float cng_xcorr_filt; -#ifdef HYBRID_ITD_MAX int16_t prev_itd_max; int16_t itd_max_flip; -#endif if ( hCPE->element_mode == IVAS_CPE_DFT ) { @@ -1341,12 +1335,10 @@ void stereo_dft_enc_compute_itd( hItd->prev_sum_nrg_L_lb = sum_nrg_L_lb; mvr2r( xcorr_lb, hItd->prev_xcorr_lb, STEREO_DFT_XCORR_LB_MAX ); } -#ifdef HYBRID_ITD_MAX /*save previous flag*/ prev_itd_max = hItd->hybrid_itd_max; /* enable hybrid ITD handling for very large ITDs*/ hItd->hybrid_itd_max = ( abs( itd ) > STEREO_DFT_ITD_MAX && abs( itd ) < STEREO_DFT_ITD_MAX_ANA && !hCPE->hCoreCoder[0]->sp_aud_decision0 && hCPE->element_brate < IVAS_32k ); -#endif /* Update memory */ hItd->prev_itd = itd; @@ -1371,7 +1363,6 @@ void stereo_dft_enc_compute_itd( hItd->deltaItd[k_offset] = hItd->itd[k_offset] - hItd->td_itd[k_offset]; -#ifdef HYBRID_ITD_MAX if ( hItd->hybrid_itd_max ) { /*check if there is an ITD flip*/ @@ -1388,7 +1379,6 @@ void stereo_dft_enc_compute_itd( { hItd->hybrid_itd_max = -1; } -#endif #ifdef DEBUG_MODE_DFT { diff --git a/lib_enc/ivas_stereo_dft_td_itd.c b/lib_enc/ivas_stereo_dft_td_itd.c index 27a71dfae4..613fd33424 100644 --- a/lib_enc/ivas_stereo_dft_td_itd.c +++ b/lib_enc/ivas_stereo_dft_td_itd.c @@ -271,14 +271,12 @@ void stereo_td_itd( hITD->td_itd_32k[i] = hITD->td_itd_32k[i + 1]; } } -#ifdef HYBRID_ITD_MAX /*reset TD ITDs in case of hybrid itd_max change - turn hybrid ITD off*/ if ( hITD->hybrid_itd_max == -1 && hybrid_itd_flag == 0 ) { hITD->td_itd[k_offset] = 0; hITD->td_itd_32k[k_offset] = 0; } -#endif if ( hybrid_itd_flag == 0 ) { return; -- GitLab From 4ebac5bea1575552b0d06428e1e71ed9aa81ff1a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:11:45 +0200 Subject: [PATCH 33/53] [cleanup] accept FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR --- lib_com/options.h | 1 - lib_dec/ivas_ism_dec.c | 19 ------------------- 2 files changed, 20 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index b59d490f0e..c374e94228 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR /* Eri: Fix for issue 462: Use-of-uninitialized memory in external HRTF deallocation in decoder together with BR switching */ #define FIX_487_LOWRATE_SBA_TUNING_FIX /* Dlb: TUning fix for low bitrate cases to match theoretical longest SPAR MD bitstream */ #define FIX_490_MASA_2TC_LBR_DTX /* Nokia: Fixes issue 490 by correcting condition. */ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 2974e9d137..3276d9488d 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -176,7 +176,6 @@ static ivas_error ivas_ism_bitrate_switching( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); /* Open the TD Binaural renderer */ -#ifdef FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL ) { if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -184,12 +183,6 @@ static ivas_error ivas_ism_bitrate_switching( return error; } } -#else - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else { @@ -250,7 +243,6 @@ static ivas_error ivas_ism_bitrate_switching( } /* Close the TD Binaural renderer */ -#ifdef FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { if ( st_ivas->hBinRendererTd != NULL ) @@ -263,17 +255,6 @@ static ivas_error ivas_ism_bitrate_switching( st_ivas->hHrtfTD = NULL; } } -#else - if ( st_ivas->hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - } - - if ( st_ivas->hHrtfTD != NULL ) - { - st_ivas->hHrtfTD = NULL; - } -#endif } else { -- GitLab From f6ce6460886d9d7202171c1bdfaee5a3ff877217 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:12:45 +0200 Subject: [PATCH 34/53] [cleanup] accept FIX_487_LOWRATE_SBA_TUNING_FIX --- lib_com/ivas_rom_com.c | 8 -------- lib_com/options.h | 1 - 2 files changed, 9 deletions(-) diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 67ed4d80bb..6d1482d5f6 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -888,19 +888,11 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] = /* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */ { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, -#ifdef FIX_487_LOWRATE_SBA_TUNING_FIX { { 10000, 8150, 13150 } }, -#else - { { 10000, 8300, 13150 } }, -#endif { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, -#ifdef FIX_487_LOWRATE_SBA_TUNING_FIX { { 13200, 11350, 16350 } }, -#else - { { 13200, 11500, 16350 } }, -#endif { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0,{ { 16400, 14850, 24350 } }, { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, diff --git a/lib_com/options.h b/lib_com/options.h index c374e94228..1bee5fe7e7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_487_LOWRATE_SBA_TUNING_FIX /* Dlb: TUning fix for low bitrate cases to match theoretical longest SPAR MD bitstream */ #define FIX_490_MASA_2TC_LBR_DTX /* Nokia: Fixes issue 490 by correcting condition. */ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ -- GitLab From a52685651e9b75170647ed9f2fb2fe57d08ce04d Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:13:36 +0200 Subject: [PATCH 35/53] [cleanup] accept FIX_490_MASA_2TC_LBR_DTX --- lib_com/options.h | 1 - lib_dec/ivas_masa_dec.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1bee5fe7e7..85a461d9b7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -148,7 +148,6 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define FIX_490_MASA_2TC_LBR_DTX /* Nokia: Fixes issue 490 by correcting condition. */ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ #define FIX_163_SBA_TD_DECORR_OPT /* Dlb : Issue 163 : TD decorr state optimization in SBA for certain output formats */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index a33c48b85b..dcf3b3dbc6 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -604,11 +604,7 @@ void ivas_masa_prerender( const int16_t output_frame /* i : output frame length per channel */ ) { -#ifdef FIX_490_MASA_2TC_LBR_DTX if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) -#endif { if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { -- GitLab From 5344eb5ef9f5a78b787e4e4578606b53596ef51a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:14:20 +0200 Subject: [PATCH 36/53] [cleanup] accept FIX_163_SBA_TD_DECORR_OPT --- lib_com/options.h | 1 - lib_dec/ivas_sba_dec.c | 4 ---- lib_dec/ivas_spar_decoder.c | 16 ---------------- 3 files changed, 21 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 85a461d9b7..f577368ab9 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -150,7 +150,6 @@ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ -#define FIX_163_SBA_TD_DECORR_OPT /* Dlb : Issue 163 : TD decorr state optimization in SBA for certain output formats */ #define FIX_HBR_MASAMETA /* Nokia: Fixes to HBR MASA metadata at 384 and 512 kbps. Addresses issues 438 and 477 as well. */ #define FIX_482_DUMMYDEC_INIT /* Nokia: fix issue #428: missing inits for dummyDec in IVAS_rend */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index bddabbc822..60d76b65df 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -473,14 +473,10 @@ ivas_error ivas_sba_dec_digest_tc( while ( nSamplesLeftForTD ) { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( st_ivas->hDiracDecBin->hTdDecorr ) { -#endif ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { decorr_signal[ch_idx] += nSamplesToDecorr; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index a03018e58d..cd9888dc21 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -101,21 +101,17 @@ ivas_error ivas_spar_dec_open( } /* TD decorr. */ -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_256k && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) ) ) { hSpar->hTdDecorr = NULL; } else { -#endif if ( ( error = ivas_td_decorr_dec_open( &hSpar->hTdDecorr, output_Fs, num_decor_chs + 1, 1 ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif /* MD handle */ if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK ) @@ -762,15 +758,11 @@ static void ivas_spar_dec_MD( if ( hSpar->hMdDec->table_idx != table_idx ) { hSpar->hMdDec->table_idx = table_idx; -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( hSpar->hTdDecorr ) { -#endif hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels, sba_order ); } } @@ -1268,10 +1260,8 @@ void ivas_spar_dec_digest_tc( { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( hSpar->hTdDecorr ) { -#endif ivas_td_decorr_process( hSpar->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr ); if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) { @@ -1291,9 +1281,7 @@ void ivas_spar_dec_digest_tc( mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); } } -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif for ( ch = 0; ch < nchan_internal; ch++ ) { p_tc[ch] += nSamplesToDecorr; @@ -1356,10 +1344,8 @@ void ivas_spar_dec_upmixer( if ( hSpar->hMdDec->td_decorr_flag ) { -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( hSpar->hTdDecorr ) { -#endif ivas_td_decorr_process( hSpar->hTdDecorr, st_ivas->hTcBuffer->tc, pPcm_tmp, output_frame ); if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) { @@ -1379,9 +1365,7 @@ void ivas_spar_dec_upmixer( mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); } } -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif } ivas_spar_dec_set_render_params( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); -- GitLab From f96fe9d03faff1610529b84829299a408edabc95 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:15:19 +0200 Subject: [PATCH 37/53] [cleanup] accept FIX_HBR_MASAMETA --- lib_com/ivas_cnst.h | 2 -- lib_com/ivas_masa_com.c | 30 ------------------------------ lib_com/ivas_prot.h | 6 ------ lib_com/ivas_stat_com.h | 2 -- lib_com/options.h | 1 - lib_dec/ivas_masa_dec.c | 18 ------------------ lib_dec/ivas_qmetadata_dec.c | 16 ---------------- lib_enc/ivas_masa_enc.c | 14 -------------- lib_enc/ivas_qmetadata_enc.c | 4 ---- 9 files changed, 93 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 9d74a26033..aa9690ac1a 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1202,9 +1202,7 @@ enum #define MASA_MAX_BITS_HR 2000 /* max. bit-budget for MASA metadata in HR mode*/ #define HR_MASA_ER_LEVELS 16 -#ifdef FIX_HBR_MASAMETA #define MAX_REDUCED_NBANDS 18 /* max number of subbands that is less than the default value 24 */ -#endif #define LIMIT_ER_ELEVATION_ENC 4 #define LIMIT_ER_SIMPLE_ENC 6 diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 820d505e47..a962e45a81 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -324,40 +324,16 @@ void masa_sample_rate_band_correction( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ -#ifdef FIX_HBR_MASAMETA const uint8_t maxBand, /* i : max band */ uint8_t is_encoder, /* i: signals if called at encoder */ -#else - const int32_t sampling_rate, /* i : Sampling rate */ -#endif MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ) { uint8_t band, sf; -#ifdef FIX_HBR_MASAMETA int16_t highBand; -#else - int16_t maxBin, highBand, maxBand; -#endif uint8_t numBands48k; -#ifndef FIX_HBR_MASAMETA - if ( sampling_rate == 48000 ) - { - return; - } -#endif -#ifndef FIX_HBR_MASAMETA - /* Find maximum band usable at this sample rate */ - maxBin = (int16_t) ( CLDFB_NO_CHANNELS_MAX * sampling_rate / 48000 ); - maxBand = 0; - while ( MASA_band_grouping_24[maxBand] <= maxBin ) - { - maxBand++; - } - maxBand--; -#endif numBands48k = config->numCodingBands; for ( band = 1; band < config->numCodingBands + 1; band++ ) @@ -368,7 +344,6 @@ void masa_sample_rate_band_correction( { config->numCodingBands = band; hQMetaData->numCodingBands = band; -#ifdef FIX_HBR_MASAMETA if ( is_encoder ) { if ( hQMetaData->q_direction->cfg.nbands > band ) @@ -380,7 +355,6 @@ void masa_sample_rate_band_correction( hQMetaData->q_direction[1].cfg.nbands = band; } } -#endif band_mapping[band] = maxBand; break; } @@ -428,11 +402,7 @@ void masa_sample_rate_band_correction( /* in decoder, zero the EXT out MASA meta buffer */ for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { -#ifdef FIX_HBR_MASAMETA for ( band = hQMetaData->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ ) -#else - for ( band = config->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ ) -#endif { hExtOutMeta->directionIndex[0][sf][band] = SPH_IDX_FRONT; hExtOutMeta->directToTotalRatio[0][sf][band] = 0u; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index e0375afbb1..0ddc423629 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3150,10 +3150,8 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( const SPHERICAL_GRID_DATA *sph_grid16, /* i: spherical grid for deindexing */ const int16_t bits_sph_idx, const int16_t bits_sp_coh -#ifdef FIX_HBR_MASAMETA , uint8_t ncoding_bands_config -#endif ); /*! r: number of bits read */ @@ -5110,12 +5108,8 @@ void masa_sample_rate_band_correction( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ -#ifdef FIX_HBR_MASAMETA const uint8_t maxBand, /* i : max band */ uint8_t is_encoder, /* i: signals if called at encoder */ -#else - const int32_t sampling_rate, /* i : sampling rate */ -#endif MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ); diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 917cb0e063..43b7adcc7c 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -475,9 +475,7 @@ typedef struct int16_t nbands; int16_t nblocks; int16_t start_band; -#ifdef FIX_HBR_MASAMETA uint8_t inactiveBands; -#endif int16_t search_effort; MC_LS_SETUP mc_ls_setup; diff --git a/lib_com/options.h b/lib_com/options.h index f577368ab9..bcd39f9d90 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,7 +151,6 @@ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ -#define FIX_HBR_MASAMETA /* Nokia: Fixes to HBR MASA metadata at 384 and 512 kbps. Addresses issues 438 and 477 as well. */ #define FIX_482_DUMMYDEC_INIT /* Nokia: fix issue #428: missing inits for dummyDec in IVAS_rend */ #define FIX_468_16KHZ_PUPMIX /* Dlb: Fix issue 468 for Param Upmix at 16kHz sampling rate */ #define FIX_499_DFT_STEREO_PLC /* Eri: Fix for issue 499: Wrong past memory addressed for computing energy of DFT stereo residual ECU frame */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index dcf3b3dbc6..ae30e4bebd 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -196,19 +196,15 @@ ivas_error ivas_masa_decode( if ( ivas_total_brate >= IVAS_512k ) { *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 16, 4 -#ifdef FIX_HBR_MASAMETA , hMasa->config.numCodingBands -#endif ); } else { *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 11, 3 -#ifdef FIX_HBR_MASAMETA , hMasa->config.numCodingBands -#endif ); } } @@ -505,10 +501,8 @@ static ivas_error ivas_masa_dec_config( { int16_t i; MASA_DECODER_HANDLE hMasa; -#ifdef FIX_HBR_MASAMETA uint8_t maxBand; int16_t maxBin; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -557,7 +551,6 @@ static ivas_error ivas_masa_dec_config( ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format ); -#ifdef FIX_HBR_MASAMETA /* Find maximum band usable */ maxBin = (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH ); maxBand = 0; @@ -576,17 +569,6 @@ static ivas_error ivas_masa_dec_config( { masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, maxBand, 0, NULL ); } -#else - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) - { - /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */ - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, hMasa->data.extOutMeta ); - } - else - { - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, NULL ); - } -#endif return error; } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index eabe725035..bd63c14daf 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -775,10 +775,8 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( const SPHERICAL_GRID_DATA *sph_grid16, /* i : spherical grid for deindexing */ const int16_t bits_sph_idx, const int16_t bits_sp_coh -#ifdef FIX_HBR_MASAMETA , uint8_t ncoding_bands_config -#endif ) { int16_t d, b, m; @@ -801,10 +799,8 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( #endif uint16_t all_coherence_zero; int16_t p[MASA_MAXIMUM_CODING_SUBBANDS], dif_p[MASA_MAXIMUM_CODING_SUBBANDS]; -#ifdef FIX_HBR_MASAMETA int16_t codedBands, sf_nbands0, sf_nbands1; sf_nbands1 = 1; -#endif #ifdef DEBUG_MODE_QMETADATA static FILE *pF = NULL; @@ -829,7 +825,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( #endif start_index_0 = *index; -#ifdef FIX_HBR_MASAMETA /* read number of higher inactive/not encoded bands */ if ( bitstream[( *index )--] ) { @@ -879,7 +874,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->q_direction[0].cfg.nbands = codedBands; -#endif /*Coherence flag decoding*/ #ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA @@ -913,23 +907,17 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( { /* Read which bands have 2 directions */ hQMetaData->q_direction[1].cfg.nbands = hQMetaData->numTwoDirBands; -#ifdef FIX_HBR_MASAMETA sf_nbands1 = hQMetaData->q_direction[1].cfg.nbands; if ( hQMetaData->q_direction[1].cfg.nbands > codedBands ) { hQMetaData->q_direction[1].cfg.nbands = codedBands; } -#endif set_c( (int8_t *) hQMetaData->twoDirBands, 0, hQMetaData->q_direction[0].cfg.nbands ); d = *index; dif_p[0] = ivas_qmetadata_DecodeExtendedGR( bitstream, index, MASA_MAXIMUM_CODING_SUBBANDS, 0 ); p[0] = dif_p[0]; hQMetaData->twoDirBands[p[0]] = 1; -#ifdef FIX_HBR_MASAMETA for ( b = 1; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) -#else - for ( b = 1; b < hQMetaData->numTwoDirBands; b++ ) -#endif { dif_p[b] = ivas_qmetadata_DecodeExtendedGR( bitstream, index, MASA_MAXIMUM_CODING_SUBBANDS, 0 ); p[b] = p[b - 1] + dif_p[b] + 1; @@ -944,7 +932,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( #endif } -#ifdef FIX_HBR_MASAMETA if ( bits_sph_idx == 16 && hQMetaData->no_directions == 2 ) { sf_nbands1 = hQMetaData->q_direction[1].cfg.nbands; @@ -953,7 +940,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->q_direction[1].cfg.nbands = codedBands; } } -#endif #ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_diff_sum = @@ -1214,13 +1200,11 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->dir_comp_ratio = 1.0f; } -#ifdef FIX_HBR_MASAMETA hQMetaData->q_direction[0].cfg.nbands = sf_nbands0; if ( hQMetaData->no_directions == 2 ) { hQMetaData->q_direction[1].cfg.nbands = sf_nbands1; } -#endif return ( start_index_0 - *index ); } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 17a9b68074..3044eb8bf6 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -497,10 +497,8 @@ ivas_error ivas_masa_enc_config( uint8_t coherencePresent; uint8_t isActualTwoDir; /* Flag to tell that when there are two directions present in metadata, they both contain meaningful information. */ int32_t ivas_total_brate; -#ifdef FIX_HBR_MASAMETA uint8_t maxBand; int16_t maxBin, sf; -#endif ivas_error error; #ifndef FIX_505_MASA_SPHGRID_REUSE SPHERICAL_GRID_DATA *sphGrid; @@ -642,7 +640,6 @@ ivas_error ivas_masa_enc_config( ivas_set_qmetadata_maxbit_req( hQMetaData, ivas_format ); -#ifdef FIX_HBR_MASAMETA /* Find maximum band usable */ maxBin = (int16_t) ( st_ivas->hEncoderConfig->input_Fs * INV_CLDFB_BANDWIDTH ); maxBand = 0; @@ -690,9 +687,6 @@ ivas_error ivas_masa_enc_config( set_c( (int8_t *) hMasa->data.twoDirBands, 1, hMasa->config.numCodingBands ); } -#else - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs, NULL ); -#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 ) @@ -799,11 +793,7 @@ static void combine_freqbands_and_subframes( } } } -#ifdef FIX_HBR_MASAMETA if ( numCodingBands <= MAX_REDUCED_NBANDS ) -#else - if ( numCodingBands < MASA_FREQUENCY_BANDS ) -#endif { /* reduce metadata *frequency* resolution. time resolution is not touched */ for ( i = 0; i < numDirections; i++ ) @@ -2340,9 +2330,7 @@ static void masa_metadata_direction_alignment( { /* swap the metadata of the two directions in this TF-tile */ float tmp_val; -#ifdef FIX_HBR_MASAMETA uint16_t tmp_int_val; -#endif tmp_val = hMeta->directional_meta[0].azimuth[sf][band]; hMeta->directional_meta[0].azimuth[sf][band] = hMeta->directional_meta[1].azimuth[sf][band]; hMeta->directional_meta[1].azimuth[sf][band] = tmp_val; @@ -2350,11 +2338,9 @@ static void masa_metadata_direction_alignment( tmp_val = hMeta->directional_meta[0].elevation[sf][band]; hMeta->directional_meta[0].elevation[sf][band] = hMeta->directional_meta[1].elevation[sf][band]; hMeta->directional_meta[1].elevation[sf][band] = tmp_val; -#ifdef FIX_HBR_MASAMETA tmp_int_val = hMeta->directional_meta[0].spherical_index[sf][band]; hMeta->directional_meta[0].spherical_index[sf][band] = hMeta->directional_meta[1].spherical_index[sf][band]; hMeta->directional_meta[1].spherical_index[sf][band] = tmp_int_val; -#endif tmp_val = hMeta->directional_meta[0].energy_ratio[sf][band]; hMeta->directional_meta[0].energy_ratio[sf][band] = hMeta->directional_meta[1].energy_ratio[sf][band]; hMeta->directional_meta[1].energy_ratio[sf][band] = tmp_val; diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index bae7edc5fd..3be51aa3ee 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -790,7 +790,6 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( #else bits_no_dirs_coh = 0; #endif -#ifdef FIX_HBR_MASAMETA if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { push_next_indice( hMetaData, 1, 1 ); @@ -802,7 +801,6 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( /* no change */ push_next_indice( hMetaData, 0, 1 ); } -#endif if ( hQMetaData->coherence_flag ) { all_coherence_zero = hQMetaData->all_coherence_zero; @@ -984,7 +982,6 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( } } } -#ifdef FIX_HBR_MASAMETA if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { hQMetaData->q_direction[0].cfg.nbands += hQMetaData->q_direction->cfg.inactiveBands; @@ -993,7 +990,6 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( hQMetaData->q_direction[1].cfg.nbands += hQMetaData->q_direction->cfg.inactiveBands; } } -#endif return error; } -- GitLab From 6d19d90a3a0bbdd405c06e26006327c6eb88a850 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:16:08 +0200 Subject: [PATCH 38/53] [cleanup] accept FIX_482_DUMMYDEC_INIT --- lib_com/options.h | 1 - lib_rend/lib_rend.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bcd39f9d90..76656e6c61 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,7 +151,6 @@ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ -#define FIX_482_DUMMYDEC_INIT /* Nokia: fix issue #428: missing inits for dummyDec in IVAS_rend */ #define FIX_468_16KHZ_PUPMIX /* Dlb: Fix issue 468 for Param Upmix at 16kHz sampling rate */ #define FIX_499_DFT_STEREO_PLC /* Eri: Fix for issue 499: Wrong past memory addressed for computing energy of DFT stereo residual ECU frame */ #define FIX_489_COV_SMOOTHING /* Dlb: Fix covariance smoothing for ParamUpmix */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e9d4b2d5e6..0bac2513c0 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2485,11 +2485,9 @@ static DecoderDummy *initDecoderDummy( decDummy->hMasa = NULL; decDummy->hDiracDecBin = NULL; decDummy->hQMetaData = NULL; -#ifdef FIX_482_DUMMYDEC_INIT decDummy->hHrtfParambin = NULL; decDummy->hHeadTrackData = NULL; decDummy->hDirAC = NULL; -#endif decDummy->hTcBuffer = NULL; decDummy->hDecoderConfig->output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); decDummy->nchan_transport = numTransChannels; @@ -2504,7 +2502,6 @@ static DecoderDummy *initDecoderDummy( decDummy->hHeadTrackData->Rmat_prev[i][i] = 1.0f; } -#ifdef FIX_482_DUMMYDEC_INIT set_zero( decDummy->hHeadTrackData->chEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( decDummy->hHeadTrackData->chEneIIR[1], MASA_FREQUENCY_BANDS ); set_zero( decDummy->hHeadTrackData->procChEneIIR[0], MASA_FREQUENCY_BANDS ); @@ -2516,7 +2513,6 @@ static DecoderDummy *initDecoderDummy( decDummy->hHeadTrackData->Quaternions[i].y = 0.0f; decDummy->hHeadTrackData->Quaternions[i].z = 0.0f; } -#endif decDummy->hHeadTrackData->num_quaternions = 0; decDummy->hHeadTrackData->lrSwitchInterpVal = 0.0f; decDummy->hHeadTrackData->lrSwitchedCurrent = 0; -- GitLab From 4a9d3bb37e4722c3e067a254315ba78fa6192d58 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:16:47 +0200 Subject: [PATCH 39/53] [cleanup] accept FIX_468_16KHZ_PUPMIX --- lib_com/options.h | 1 - lib_enc/ivas_mc_paramupmix_enc.c | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 76656e6c61..536c465826 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,7 +151,6 @@ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ -#define FIX_468_16KHZ_PUPMIX /* Dlb: Fix issue 468 for Param Upmix at 16kHz sampling rate */ #define FIX_499_DFT_STEREO_PLC /* Eri: Fix for issue 499: Wrong past memory addressed for computing energy of DFT stereo residual ECU frame */ #define FIX_489_COV_SMOOTHING /* Dlb: Fix covariance smoothing for ParamUpmix */ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 272e3f817b..1203fcdc64 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -742,9 +742,7 @@ static void ivas_mc_paramupmix_param_est_enc( int16_t l_ts; int16_t b, i, j, ts, bnd; -#ifdef FIX_468_16KHZ_PUPMIX int16_t maxbands; -#endif int16_t transient_det[MC_PARAMUPMIX_COMBINATIONS][2]; int16_t transient_det_l[2], transient_det_r[2]; @@ -820,18 +818,11 @@ static void ivas_mc_paramupmix_param_est_enc( } ivas_enc_cov_handler_process( hMCParamUpmix->hCovEnc[b], pp_in_fr_real, pp_in_fr_imag, cov_real, cov_dtx_real, hMCParamUpmix->hFbMixer->pFb, 0, hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands, MC_PARAMUPMIX_NCH, 0 /*dtx_vad*/, transient_det[b], HOA_md_ind ); } -#ifdef FIX_468_16KHZ_PUPMIX maxbands = hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands; for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) { for ( bnd = 0; bnd < maxbands; bnd++ ) { -#else - for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) - { - for ( bnd = 0; bnd < IVAS_MAX_NUM_BANDS; bnd++ ) - { -#endif rxy = hMCParamUpmix->cov_real[b][1][0][bnd]; ryy = hMCParamUpmix->cov_real[b][1][1][bnd]; cmat = rxy / ( ryy + EPSILON ); @@ -845,7 +836,6 @@ static void ivas_mc_paramupmix_param_est_enc( betas[b][bnd] = (float) 2.0 * wetaux; } } -#ifdef FIX_468_16KHZ_PUPMIX if ( maxbands < IVAS_MAX_NUM_BANDS ) { for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) @@ -857,6 +847,5 @@ static void ivas_mc_paramupmix_param_est_enc( } } } -#endif return; } -- GitLab From 34632e9d9ea9d5f8d669133c282c0dcbb6752467 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:17:46 +0200 Subject: [PATCH 40/53] [cleanup] accept FIX_499_DFT_STEREO_PLC --- lib_com/options.h | 1 - lib_dec/ivas_stereo_dft_dec.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 536c465826..890938b1ae 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,7 +151,6 @@ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ -#define FIX_499_DFT_STEREO_PLC /* Eri: Fix for issue 499: Wrong past memory addressed for computing energy of DFT stereo residual ECU frame */ #define FIX_489_COV_SMOOTHING /* Dlb: Fix covariance smoothing for ParamUpmix */ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 36d8eb662b..de232e8fa8 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1734,11 +1734,7 @@ void stereo_dft_dec( if ( st0->bfi && !prev_bfi ) { -#ifdef FIX_499_DFT_STEREO_PLC idx_k0 = ( hStereoDft->past_DMX_pos + STEREO_DFT_PAST_MAX - 1 ) % STEREO_DFT_PAST_MAX; -#else - idx_k0 = ( hStereoDft->past_DMX_pos + 1 ) % STEREO_DFT_PAST_MAX; -#endif idx_k1 = ( idx_k0 + 1 ) % STEREO_DFT_PAST_MAX; /*dmx energy memory*/ hStereoDft->past_dmx_nrg = stereo_dft_dmx_swb_nrg( hStereoDft->DFT_past_DMX[idx_k0], hStereoDft->DFT_past_DMX[idx_k1], min( hStereoDft->NFFT, STEREO_DFT32MS_N_32k ) ); -- GitLab From c45979aa007572fa8b8c66e4f54eaf3c193e52c8 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:18:40 +0200 Subject: [PATCH 41/53] [cleanup] accept FIX_489_COV_SMOOTHING --- lib_com/cnst.h | 2 -- lib_com/ivas_cov_smooth.c | 12 ------------ lib_com/ivas_prot.h | 4 ---- lib_com/options.h | 1 - lib_enc/ivas_enc_cov_handler.c | 18 ------------------ lib_enc/ivas_mc_paramupmix_enc.c | 4 ---- lib_enc/ivas_spar_encoder.c | 4 ---- 7 files changed, 45 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index a35f5280c2..cee56f7d42 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -2240,13 +2240,11 @@ enum VOIP_RTPDUMP }; -#ifdef FIX_489_COV_SMOOTHING typedef enum _COV_SMOOTHING_TYPE { COV_SMOOTH_SPAR, COV_SMOOTH_MC } COV_SMOOTHING_TYPE; -#endif /* clang-format on */ #endif /* CNST_H */ diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index e407bccc6c..b466351e02 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -35,9 +35,7 @@ #ifdef DEBUGGING #include "debug.h" #endif -#ifdef FIX_489_COV_SMOOTHING #include "cnst.h" -#endif #include "ivas_prot.h" #include "wmc_auto.h" #include "prot.h" @@ -54,10 +52,8 @@ static void ivas_set_up_cov_smoothing( ivas_filterbank_t *pFb, const float max_update_rate, const int16_t min_pool_size -#ifdef FIX_489_COV_SMOOTHING , const COV_SMOOTHING_TYPE smooth_mode /* i : flag multichannel vs SPAR */ -#endif , const int32_t ivas_total_brate ) { @@ -96,7 +92,6 @@ static void ivas_set_up_cov_smoothing( } } } -#ifdef FIX_489_COV_SMOOTHING else if ( smooth_mode == COV_SMOOTH_MC ) { for ( j = 0; j < pFb->filterbank_num_bands; j++ ) @@ -117,7 +112,6 @@ static void ivas_set_up_cov_smoothing( } } } -#endif else { for ( j = 0; j < pFb->filterbank_num_bands; j++ ) @@ -159,9 +153,7 @@ ivas_error ivas_spar_covar_smooth_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp /* i : number of input channels */ , -#ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { @@ -191,11 +183,7 @@ ivas_error ivas_spar_covar_smooth_enc_open( } -#ifdef FIX_489_COV_SMOOTHING ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate ); -#else - ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, ivas_total_brate ); -#endif *hCovState_out = hCovState; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 0ddc423629..3b7a95a000 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4687,9 +4687,7 @@ ivas_error ivas_spar_covar_enc_open( const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ , -#ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); @@ -4720,9 +4718,7 @@ ivas_error ivas_spar_covar_smooth_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp /* i : number of input channels */ , -#ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); diff --git a/lib_com/options.h b/lib_com/options.h index 890938b1ae..37b2cc237f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,7 +151,6 @@ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ -#define FIX_489_COV_SMOOTHING /* Dlb: Fix covariance smoothing for ParamUpmix */ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ #define FIX_485_STATIC_BUFFERS /* FhG: move static buffers in DirAC parameter estimator to the DirAC struct */ diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 61c4ccaef9..40db2d4f75 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -68,9 +68,7 @@ ivas_error ivas_spar_covar_enc_open( const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ , -#ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { @@ -88,25 +86,13 @@ ivas_error ivas_spar_covar_enc_open( cov_smooth_cfg.max_bands = IVAS_MAX_NUM_BANDS; cov_smooth_cfg.max_update_rate = MAX_UPDATE_RATE; cov_smooth_cfg.min_pool_size = MIN_POOL_SIZE; -#ifdef FIX_489_COV_SMOOTHING if ( smooth_mode == COV_SMOOTH_MC ) { cov_smooth_cfg.max_update_rate = 1.0f; cov_smooth_cfg.min_pool_size = 20; } -#else - if ( nchan_inp == 3 ) /* to discriminate between SPAR and mc there could be a better solution */ - { - cov_smooth_cfg.max_update_rate = 1.0f; - cov_smooth_cfg.min_pool_size = 20; - } -#endif -#ifdef FIX_489_COV_SMOOTHING if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_state, &cov_smooth_cfg, pFb, nchan_inp, smooth_mode, ivas_total_brate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_state, &cov_smooth_cfg, pFb, nchan_inp, ivas_total_brate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -114,11 +100,7 @@ ivas_error ivas_spar_covar_enc_open( cov_smooth_cfg.max_update_rate = MAX_UPDATE_RATE_DTX; cov_smooth_cfg.min_pool_size = MIN_POOL_SIZE_DTX; -#ifdef FIX_489_COV_SMOOTHING if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_dtx_state, &cov_smooth_cfg, pFb, nchan_inp, smooth_mode, ivas_total_brate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_dtx_state, &cov_smooth_cfg, pFb, nchan_inp, ivas_total_brate ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 1203fcdc64..b328223d77 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -211,11 +211,7 @@ ivas_error ivas_mc_paramupmix_enc_open( for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { /* Covariance handle */ -#ifdef FIX_489_COV_SMOOTHING if ( ( error = ivas_spar_covar_enc_open( &( hMCParamUpmix->hCovEnc[i] ), hMCParamUpmix->hFbMixer->pFb, input_Fs, MC_PARAMUPMIX_NCH + 1, COV_SMOOTH_MC, st_ivas->hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_covar_enc_open( &( hMCParamUpmix->hCovEnc[i] ), hMCParamUpmix->hFbMixer->pFb, input_Fs, MC_PARAMUPMIX_NCH + 1, st_ivas->hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 4d4ed1ef6d..d9dd0880c5 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -142,11 +142,7 @@ ivas_error ivas_spar_enc_open( } /* Covariance handle */ -#ifdef FIX_489_COV_SMOOTHING if ( ( error = ivas_spar_covar_enc_open( &( hSpar->hCovEnc ), hSpar->hFbMixer->pFb, input_Fs, nchan_inp, COV_SMOOTH_SPAR, hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_covar_enc_open( &( hSpar->hCovEnc ), hSpar->hFbMixer->pFb, input_Fs, nchan_inp, hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) -#endif { return error; } -- GitLab From cf9f8f8c0d4bfcf33e6f713f7242da761931aec2 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:19:28 +0200 Subject: [PATCH 42/53] [cleanup] accept FIX_485_STATIC_BUFFERS --- lib_com/ivas_dirac_com.c | 35 ----------------------------------- lib_com/ivas_prot.h | 2 -- lib_com/options.h | 1 - lib_enc/ivas_dirac_enc.c | 4 ---- lib_enc/ivas_stat_enc.h | 2 -- 5 files changed, 44 deletions(-) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 3ff512a26c..3386cf5a99 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -930,9 +930,7 @@ void deindex_spherical_component( *-----------------------------------------------------------------*/ void calculate_hodirac_sector_parameters( -#ifdef FIX_485_STATIC_BUFFERS DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ -#endif float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector (L+1)^2 x N_bins, real part */ float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector, imaginary part */ const float beta, /* i : forgetting factor for average filtering */ @@ -951,17 +949,6 @@ void calculate_hodirac_sector_parameters( float sec_I_vec_y[NUM_ANA_SECTORS]; float sec_I_vec_z[NUM_ANA_SECTORS]; -#ifndef FIX_485_STATIC_BUFFERS - static int16_t firstrun_sector_params = 1; - - static float sec_I_vec_smth_x[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; - static float sec_I_vec_smth_y[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; - static float sec_I_vec_smth_z[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; - - static float energy_smth[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; - static float azi_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; - static float ele_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; -#endif for ( i_sec = 0; i_sec < NUM_ANA_SECTORS; i_sec++ ) { @@ -997,7 +984,6 @@ void calculate_hodirac_sector_parameters( float *p_ene = &ene[i_sec * N_bands + i_band]; float *p_diff = &diff[i_sec * N_bands + i_band]; -#ifdef FIX_485_STATIC_BUFFERS float *p_azi_prev = &hDirAC->azi_prev[i_sec * N_bands + i_band]; float *p_ele_prev = &hDirAC->ele_prev[i_sec * N_bands + i_band]; @@ -1005,15 +991,6 @@ void calculate_hodirac_sector_parameters( float *p_sec_I_vec_smth_x = &hDirAC->sec_I_vec_smth_x[i_sec][i_band]; float *p_sec_I_vec_smth_y = &hDirAC->sec_I_vec_smth_y[i_sec][i_band]; float *p_sec_I_vec_smth_z = &hDirAC->sec_I_vec_smth_z[i_sec][i_band]; -#else - float *p_azi_prev = &azi_prev[i_sec * N_bands + i_band]; - float *p_ele_prev = &ele_prev[i_sec * N_bands + i_band]; - - float *p_energy_smth = &energy_smth[i_sec][i_band]; - float *p_sec_I_vec_smth_x = &sec_I_vec_smth_x[i_sec][i_band]; - float *p_sec_I_vec_smth_y = &sec_I_vec_smth_y[i_sec][i_band]; - float *p_sec_I_vec_smth_z = &sec_I_vec_smth_z[i_sec][i_band]; -#endif *p_sec_I_vec_x = 0.f; *p_sec_I_vec_y = 0.f; *p_sec_I_vec_z = 0.f; @@ -1079,11 +1056,7 @@ void calculate_hodirac_sector_parameters( sec_z_real * sec_z_real + sec_z_imag * sec_z_imag ); } } -#ifdef FIX_485_STATIC_BUFFERS if ( hDirAC->firstrun_sector_params ) -#else - if ( firstrun_sector_params ) -#endif { *p_sec_I_vec_smth_x = *p_sec_I_vec_x; *p_sec_I_vec_smth_y = *p_sec_I_vec_y; @@ -1125,11 +1098,7 @@ void calculate_hodirac_sector_parameters( } if ( tmp_diff > 0.5f ) { -#ifdef FIX_485_STATIC_BUFFERS if ( hDirAC->firstrun_sector_params ) -#else - if ( firstrun_sector_params ) -#endif { *p_azi = 0.f; *p_ele = 0.f; @@ -1148,11 +1117,7 @@ void calculate_hodirac_sector_parameters( } } -#ifdef FIX_485_STATIC_BUFFERS hDirAC->firstrun_sector_params = 0; -#else - firstrun_sector_params = 0; -#endif return; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 3b7a95a000..96c6ca9a90 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3895,9 +3895,7 @@ void ivas_dirac_dec_get_frequency_axis( const int16_t num_freq_bands ); /* i : number of frequency bands */ void calculate_hodirac_sector_parameters( -#ifdef FIX_485_STATIC_BUFFERS DIRAC_ENC_HANDLE hDirAC, -#endif float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ const float beta, /* i : forgetting factor for average filtering */ diff --git a/lib_com/options.h b/lib_com/options.h index 37b2cc237f..acb51e1b21 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,7 +153,6 @@ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ -#define FIX_485_STATIC_BUFFERS /* FhG: move static buffers in DirAC parameter estimator to the DirAC struct */ #define FIX_I503_ASAN_ERROR_IND_LIST /* VA: fix issue #503: address sanitizer error with IND_LIST_DYN */ #define FIX_473_JITTER_NONDIEGETIC_PANNING /* FhG,Orange: add missing non-diegetic panning to JITTER */ diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 5aa872e434..97b238f330 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -83,7 +83,6 @@ ivas_error ivas_dirac_enc_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); } -#ifdef FIX_485_STATIC_BUFFERS hDirAC->firstrun_sector_params = 1; set_zero( hDirAC->sec_I_vec_smth_x[0], NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); set_zero( hDirAC->sec_I_vec_smth_y[0], NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); @@ -91,7 +90,6 @@ ivas_error ivas_dirac_enc_open( set_zero( hDirAC->azi_prev, NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); set_zero( hDirAC->ele_prev, NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); set_zero( hDirAC->energy_smth[0], NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); -#endif /*-----------------------------------------------------------------* * DirAC main configuration *-----------------------------------------------------------------*/ @@ -920,9 +918,7 @@ void ivas_dirac_param_est_enc( assert( l_ts <= DIRAC_NO_FB_BANDS_MAX ); #endif calculate_hodirac_sector_parameters( -#ifdef FIX_485_STATIC_BUFFERS hDirAC, -#endif Cldfb_RealBuffer, Cldfb_ImagBuffer, 0.20f, diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 5c9f02e4d4..fe520a0817 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -600,7 +600,6 @@ typedef struct ivas_dirac_enc_data_structure float diffuseness_m[DIRAC_MAX_NBANDS]; int16_t band_grouping[DIRAC_MAX_NBANDS + 1]; int16_t block_grouping[5]; -#ifdef FIX_485_STATIC_BUFFERS int16_t firstrun_sector_params; float sec_I_vec_smth_x[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; @@ -610,7 +609,6 @@ typedef struct ivas_dirac_enc_data_structure float energy_smth[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; float azi_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; float ele_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; -#endif #ifndef SBA_MODE_CLEAN_UP int16_t dirac_to_spar_md_bands[DIRAC_MAX_NBANDS]; -- GitLab From 666632df7b5d3572acf84ced6ffbd38da28d6485 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:20:13 +0200 Subject: [PATCH 43/53] [cleanup] accept FIX_I503_ASAN_ERROR_IND_LIST --- lib_com/options.h | 1 - lib_enc/ivas_qmetadata_enc.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index acb51e1b21..0793b929af 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,7 +153,6 @@ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ -#define FIX_I503_ASAN_ERROR_IND_LIST /* VA: fix issue #503: address sanitizer error with IND_LIST_DYN */ #define FIX_473_JITTER_NONDIEGETIC_PANNING /* FhG,Orange: add missing non-diegetic panning to JITTER */ #define SBA_MODE_CLEAN_UP /* Dlb: Cean up SBA mode references */ diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 3be51aa3ee..4e017dd052 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -2251,11 +2251,7 @@ void restore_metadata_buffer( int16_t i; #ifdef IND_LIST_DYN -#ifdef FIX_I503_ASAN_ERROR_IND_LIST for ( i = next_ind_start; i < hMetaData->nb_ind_tot; i++ ) -#else - for ( i = next_ind_start; i <= hMetaData->nb_ind_tot; i++ ) -#endif #else for ( i = next_ind_start; i <= hMetaData->next_ind; i++ ) #endif -- GitLab From 4d65c1aabcc650c99bab522087af3f798a8ec056 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:20:58 +0200 Subject: [PATCH 44/53] [cleanup] accept FIX_473_JITTER_NONDIEGETIC_PANNING --- lib_com/options.h | 1 - lib_dec/ivas_ism_renderer.c | 4 ---- lib_dec/ivas_jbm_dec.c | 8 -------- lib_dec/lib_dec.c | 8 -------- 4 files changed, 21 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 0793b929af..3b04c7fd45 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -153,7 +153,6 @@ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ -#define FIX_473_JITTER_NONDIEGETIC_PANNING /* FhG,Orange: add missing non-diegetic panning to JITTER */ #define SBA_MODE_CLEAN_UP /* Dlb: Cean up SBA mode references */ #define FIX_502_IND_LIST_SIZE /* Fix issue #502: insufficient index buffer sizes */ diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 32f0393c0e..915b545a59 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -259,11 +259,7 @@ void ivas_ism_render_sf( for ( i = 0; i < num_objects; i++ ) { /* Head rotation: rotate the object positions depending the head's orientation */ -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 && !st_ivas->hIsmMetaData[i]->non_diegetic_flag ) -#else - if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) -#endif { rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, Rmat, st_ivas->hIntSetup.is_planar_setup ); if ( st_ivas->hEFAPdata != NULL ) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index dc54aa9734..91c7a1c185 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -644,9 +644,7 @@ ivas_error ivas_jbm_dec_render( int16_t nchan_remapped; int32_t output_Fs; AUDIO_CONFIG output_config; -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING float pan_left, pan_right; -#endif int16_t nSamplesAskedLocal; ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; @@ -706,7 +704,6 @@ ivas_error ivas_jbm_dec_render( { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, st_ivas->nchan_transport, p_output ); } -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); @@ -715,7 +712,6 @@ ivas_error ivas_jbm_dec_render( v_multc( st_ivas->hTcBuffer->tc[0], pan_right, output[1], *nSamplesRendered ); v_multc( st_ivas->hTcBuffer->tc[0], pan_left, output[0], *nSamplesRendered ); } -#endif else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { ivas_param_ism_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); @@ -737,7 +733,6 @@ ivas_error ivas_jbm_dec_render( /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); } -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { pan_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; @@ -745,7 +740,6 @@ ivas_error ivas_jbm_dec_render( v_multc( st_ivas->hTcBuffer->tc[0], pan_right, output[1], *nSamplesRendered ); v_multc( st_ivas->hTcBuffer->tc[0], pan_left, output[0], *nSamplesRendered ); } -#endif else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ @@ -1810,9 +1804,7 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( case RENDERER_PARAM_ISM: case RENDERER_BINAURAL_MIXER_CONV: case RENDERER_BINAURAL_MIXER_CONV_ROOM: -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING case RENDERER_NON_DIEGETIC_DOWNMIX: -#endif buffer_mode = TC_BUFFER_MODE_RENDERER; break; case RENDERER_MC_PARAMMC: diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 7cb4753235..0634cdfd05 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -766,7 +766,6 @@ static ivas_error IVAS_DEC_Setup( if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING if ( hIvasDec->st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { *nTransportChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; @@ -774,12 +773,9 @@ static ivas_error IVAS_DEC_Setup( } else { -#endif *nTransportChannels = 1; *nOutChannels = 1; -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING } -#endif } else { @@ -2733,11 +2729,7 @@ static ivas_error evs_dec_main( if ( floatBuf != NULL ) { /* BE workaround */ -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING int16_t pcm_buf_local[L_FRAME48k * MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; -#else - int16_t pcm_buf_local[L_FRAME48k]; -#endif /* convert 'float' output data to 'short' */ #ifdef DEBUGGING -- GitLab From e406fff2d73fb6702048eae09e88c3e8fd8f6946 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:21:43 +0200 Subject: [PATCH 45/53] [cleanup] accept SBA_MODE_CLEAN_UP --- lib_com/bitstream.c | 3 - lib_com/ivas_cnst.h | 9 - lib_com/ivas_dirac_com.c | 239 --------------- lib_com/ivas_fb_mixer.c | 17 -- lib_com/ivas_prot.h | 68 ----- lib_com/ivas_sba_config.c | 13 - lib_com/ivas_spar_com.c | 6 - lib_com/options.h | 1 - lib_dec/ivas_corecoder_dec_reconfig.c | 5 - lib_dec/ivas_dec.c | 53 ---- lib_dec/ivas_dirac_dec.c | 151 --------- lib_dec/ivas_init_dec.c | 84 ----- lib_dec/ivas_jbm_dec.c | 48 --- lib_dec/ivas_masa_dec.c | 8 - lib_dec/ivas_output_config.c | 5 - lib_dec/ivas_qmetadata_dec.c | 36 --- lib_dec/ivas_sba_dec.c | 31 -- lib_dec/ivas_sba_dirac_stereo_dec.c | 30 -- lib_dec/ivas_sba_rendering_internal.c | 17 -- lib_dec/ivas_sce_dec.c | 9 - lib_dec/ivas_spar_decoder.c | 7 - lib_dec/ivas_stat_dec.h | 6 - lib_dec/lib_dec.c | 3 - lib_enc/ivas_cpe_enc.c | 12 - lib_enc/ivas_dirac_enc.c | 304 ------------------- lib_enc/ivas_enc.c | 25 -- lib_enc/ivas_init_enc.c | 20 -- lib_enc/ivas_ism_param_enc.c | 5 - lib_enc/ivas_masa_enc.c | 4 - lib_enc/ivas_mc_param_enc.c | 5 - lib_enc/ivas_mc_paramupmix_enc.c | 5 - lib_enc/ivas_mcmasa_enc.c | 14 - lib_enc/ivas_mct_enc.c | 16 - lib_enc/ivas_qmetadata_enc.c | 49 --- lib_enc/ivas_sba_enc.c | 22 -- lib_enc/ivas_sce_enc.c | 4 - lib_enc/ivas_spar_encoder.c | 134 -------- lib_enc/ivas_stat_enc.h | 15 - lib_enc/lib_enc.c | 7 - lib_rend/ivas_dirac_dec_binaural_functions.c | 12 - lib_rend/lib_rend.c | 9 - 41 files changed, 1511 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 2321d37334..b4a42e0b2e 100755 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -2942,9 +2942,6 @@ ivas_error preview_indices( if ( bit_stream[2] == 0 ) { st_ivas->ivas_format = SBA_FORMAT; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = ivas_sba_mode_select(); -#endif } else { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index aa9690ac1a..d314be3154 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -915,15 +915,6 @@ typedef enum { #define SBA_NHARM_HOA3 16 #define SBA_T_DESIGN_11_SIZE 70 #define SBA_DTX_BITRATE_THRESHOLD IVAS_80k -#ifndef SBA_MODE_CLEAN_UP -typedef enum -{ - SBA_MODE_NONE, - SBA_MODE_DIRAC, - SBA_MODE_SPAR, -} SBA_MODE; - -#endif /*----------------------------------------------------------------------------------* * DirAC Constants diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 3386cf5a99..e799d42c56 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -85,11 +85,7 @@ ivas_error ivas_dirac_config( { IVAS_FORMAT ivas_format; int16_t sba_order; -#ifndef SBA_MODE_CLEAN_UP - int16_t *nSCE, *nCPE, *element_mode, *nchan_transport; -#else int16_t *element_mode; -#endif int32_t ivas_total_brate; DIRAC_CONFIG_DATA_HANDLE hConfig; IVAS_QMETADATA_HANDLE hQMetaData; @@ -98,9 +94,6 @@ ivas_error ivas_dirac_config( ivas_error error; int16_t spar_dirac_split_band; IVAS_FB_MIXER_HANDLE hFbMdft; -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE sba_mode; -#endif int16_t *dirac_to_spar_md_bands; @@ -110,23 +103,13 @@ ivas_error ivas_dirac_config( if ( enc_dec == ENC ) { ivas_format = ( (Encoder_Struct *) st_ivas )->hEncoderConfig->ivas_format; -#ifndef SBA_MODE_CLEAN_UP - nSCE = &( ( (Encoder_Struct *) st_ivas )->nSCE ); - nCPE = &( (Encoder_Struct *) st_ivas )->nCPE; -#endif element_mode = &( (Encoder_Struct *) st_ivas )->hEncoderConfig->element_mode_init; -#ifndef SBA_MODE_CLEAN_UP - nchan_transport = &( (Encoder_Struct *) st_ivas )->nchan_transport; -#endif sba_order = ( (Encoder_Struct *) st_ivas )->sba_analysis_order; ivas_total_brate = ( (Encoder_Struct *) st_ivas )->hEncoderConfig->ivas_total_brate; Fs = ( (Encoder_Struct *) st_ivas )->hEncoderConfig->input_Fs; band_grouping = ( (Encoder_Struct *) st_ivas )->hDirAC->band_grouping; hConfig = ( (Encoder_Struct *) st_ivas )->hDirAC->hConfig; hQMetaData = ( (Encoder_Struct *) st_ivas )->hQMetaData; -#ifndef SBA_MODE_CLEAN_UP - sba_mode = ( (Encoder_Struct *) st_ivas )->sba_mode; -#endif if ( ( (Encoder_Struct *) st_ivas )->hSpar != NULL ) { hFbMdft = ( (Encoder_Struct *) st_ivas )->hSpar->hFbMixer; @@ -135,32 +118,18 @@ ivas_error ivas_dirac_config( { hFbMdft = NULL; } -#ifndef SBA_MODE_CLEAN_UP - dirac_to_spar_md_bands = ( (Encoder_Struct *) st_ivas )->hDirAC->dirac_to_spar_md_bands; -#else dirac_to_spar_md_bands = ( (Encoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands; -#endif } else { ivas_format = ( (Decoder_Struct *) st_ivas )->ivas_format; -#ifndef SBA_MODE_CLEAN_UP - nSCE = &( (Decoder_Struct *) st_ivas )->nSCE; - nCPE = &( (Decoder_Struct *) st_ivas )->nCPE; -#endif element_mode = &( (Decoder_Struct *) st_ivas )->element_mode_init; -#ifndef SBA_MODE_CLEAN_UP - nchan_transport = &( (Decoder_Struct *) st_ivas )->nchan_transport; -#endif sba_order = ( (Decoder_Struct *) st_ivas )->sba_analysis_order; ivas_total_brate = ( (Decoder_Struct *) st_ivas )->hDecoderConfig->ivas_total_brate; Fs = ( (Decoder_Struct *) st_ivas )->hDecoderConfig->output_Fs; band_grouping = ( (Decoder_Struct *) st_ivas )->hDirAC->band_grouping; hConfig = ( (Decoder_Struct *) st_ivas )->hDirAC->hConfig; hQMetaData = ( (Decoder_Struct *) st_ivas )->hQMetaData; -#ifndef SBA_MODE_CLEAN_UP - sba_mode = ( (Decoder_Struct *) st_ivas )->sba_mode; -#endif if ( ( (Decoder_Struct *) st_ivas )->hSpar != NULL ) { hFbMdft = ( (Decoder_Struct *) st_ivas )->hSpar->hFbMixer; @@ -170,18 +139,10 @@ ivas_error ivas_dirac_config( hFbMdft = NULL; } ( (Decoder_Struct *) st_ivas )->hDirAC->hFbMdft = hFbMdft; -#ifndef SBA_MODE_CLEAN_UP - dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hDirAC->dirac_to_spar_md_bands; -#else dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands; -#endif } -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { hConfig->nbands = IVAS_MAX_NUM_BANDS; @@ -204,22 +165,14 @@ ivas_error ivas_dirac_config( #endif if ( ivas_format == SBA_FORMAT ) /* skip for MASA decoder */ { -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_dirac_sba_config( hQMetaData, nchan_transport, nSCE, nCPE, element_mode, ivas_total_brate, sba_order, sba_mode, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_sba_config( hQMetaData, element_mode, ivas_total_brate, sba_order, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK ) -#endif { return error; } if ( hQMetaData != NULL ) { -#ifndef SBA_MODE_CLEAN_UP - if ( enc_dec == ENC || sba_mode != SBA_MODE_SPAR ) -#else if ( enc_dec == ENC || ivas_format != SBA_FORMAT ) -#endif { hConfig->nbands = hQMetaData->q_direction[0].cfg.nbands; } @@ -227,10 +180,6 @@ ivas_error ivas_dirac_config( } -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif hConfig->dec_param_estim = TRUE; if ( hConfig->dec_param_estim == TRUE ) { @@ -245,23 +194,9 @@ ivas_error ivas_dirac_config( set_c( (int8_t *) hQMetaData->twoDirBands, (int8_t) 1, hQMetaData->q_direction[0].cfg.nbands ); hQMetaData->numTwoDirBands = (uint8_t) hQMetaData->q_direction[0].cfg.nbands; } -#ifndef SBA_MODE_CLEAN_UP - } - else - { - if ( *nchan_transport > 2 ) - { - hConfig->dec_param_estim = TRUE; - } - } -#endif } -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft ); } @@ -448,24 +383,12 @@ void ivas_get_dirac_sba_max_md_bits( ivas_error ivas_dirac_sba_config( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ -#ifndef SBA_MODE_CLEAN_UP - int16_t *nchan_transport, /* o : number of transport channel needed for MASA format */ - int16_t *nSCE, /* o : number of SCEs */ - int16_t *nCPE, /* o : number of CPEs */ -#endif int16_t *element_mode, /* i/o: element mode of the core coder */ int32_t sba_total_brate, /* i : SBA total bitrate */ const int16_t sba_order, /* i : Ambisonic (SBA) order */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t nbands /* i : number of frequency bands */ ) { -#ifndef SBA_MODE_CLEAN_UP - int16_t i; - int16_t nbands_wb; -#endif int16_t nbands_coded; int16_t hodirac_flag; ivas_error error; @@ -474,10 +397,6 @@ ivas_error ivas_dirac_sba_config( hQMetaData->is_masa_ivas_format = 0; hodirac_flag = ivas_get_hodirac_flag( sba_total_brate, sba_order ); -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif /* map the bitrate for SID frame */ if ( sba_total_brate == IVAS_SID_5k2 ) { @@ -537,164 +456,6 @@ ivas_error ivas_dirac_sba_config( hQMetaData->q_direction[0].cfg.nbands ); return error; -#ifndef SBA_MODE_CLEAN_UP - } - - if ( sba_total_brate > IVAS_SID_5k2 ) - { - *nchan_transport = ivas_get_sba_num_TCs( sba_total_brate, sba_order ); - } - else if ( sba_total_brate == IVAS_SID_5k2 ) - { - switch ( *element_mode ) - { - case IVAS_CPE_MDCT: - *nchan_transport = 2; - break; - case IVAS_SCE: - *nchan_transport = 1; - break; - default: - assert( !"Wrong initial element mode for SBA SID!" ); - break; - } - } - - if ( hQMetaData != NULL ) - { - ivas_set_qmetadata_maxbit_req( hQMetaData, SBA_FORMAT ); - if ( sba_total_brate <= IVAS_16k4 ) - { - hQMetaData->useLowerRes = 1; - } - else - { - hQMetaData->useLowerRes = 0; - } - if ( sba_total_brate >= IVAS_96k ) - { - { - int16_t no_dirs = 1; - if ( hodirac_flag ) - { - no_dirs = 2; - } - if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, 6, no_dirs, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - nbands_wb = 4; - } - else - { - if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, 5, 1, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - - nbands_wb = 4; - } - for ( i = 0; i < hQMetaData->no_directions; i++ ) - { - hQMetaData->q_direction[i].cfg.start_band = 0; - } - - if ( *nchan_transport > 2 && *nchan_transport <= 8 ) - { - *nCPE = ( ( *nchan_transport + 1 ) / 2 ); - *nSCE = 0; - - hQMetaData->bits_frame_nominal = (int16_t) ( sba_total_brate / FRAMES_PER_SEC ); - - hQMetaData->metadata_max_bits = MAX16B; /* no limit */ - for ( i = 0; i < hQMetaData->no_directions; i++ ) - { - hQMetaData->q_direction[i].cfg.search_effort = 1; - - if ( hodirac_flag ) - { - hQMetaData->q_direction[i].cfg.start_band = 0; - } - else - { - hQMetaData->q_direction[i].cfg.start_band = nbands_wb; - } - } - - *element_mode = IVAS_CPE_MDCT; - } - else if ( *nchan_transport == 2 ) - { - *nCPE = 1; - *nSCE = 0; - - if ( sba_total_brate <= IVAS_48k ) - { - hQMetaData->bits_frame_nominal = IVAS_48k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 120; - } - else if ( sba_total_brate <= IVAS_64k ) - { - hQMetaData->bits_frame_nominal = IVAS_64k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_80k ) - { - hQMetaData->bits_frame_nominal = IVAS_80k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_96k ) - { - hQMetaData->bits_frame_nominal = IVAS_96k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else - { - hQMetaData->bits_frame_nominal = (int16_t) ( sba_total_brate / FRAMES_PER_SEC ); - hQMetaData->metadata_max_bits = 250; - } - - *element_mode = IVAS_CPE_MDCT; - } - else if ( *nchan_transport == 1 ) - { - *nCPE = 0; - *nSCE = 1; - - if ( sba_total_brate <= IVAS_13k2 ) - { - hQMetaData->bits_frame_nominal = ACELP_9k60 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 70; - } - else if ( sba_total_brate <= IVAS_16k4 ) - { - hQMetaData->bits_frame_nominal = ACELP_13k20 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 80; - } - else if ( sba_total_brate <= IVAS_24k4 ) - { - hQMetaData->bits_frame_nominal = ACELP_16k40 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 160; - } - else if ( sba_total_brate <= IVAS_32k ) - { - } - else - { - hQMetaData->bits_frame_nominal = ACELP_32k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 176; - } - - *element_mode = IVAS_SCE; - } - else - { - assert( !"SBA number of transport channels must be 8 or lower" ); - } - } - return error; -#endif } diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index dbbce9afe4..c9edff81db 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -101,9 +101,6 @@ static int16_t ivas_get_num_bands( ivas_error ivas_fb_set_cfg( IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ const int16_t ivas_format, /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t num_in_chans, /* i : number of FB input channels */ const int16_t num_out_chans, /* i : number of FB output channels */ const int16_t active_w_mixing, /* i : active_w_mixing flag */ @@ -137,23 +134,9 @@ ivas_error ivas_fb_set_cfg( { pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS ); -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_4_NS ); pFb_cfg->prior_input_length = NS2SA( sampling_rate, FRAME_SIZE_NS ); pFb_cfg->windowed_fr_offset = (int16_t) ( (float) ( sampling_rate / FRAMES_PER_SEC ) * 3.0f / 4.0f ) - NS2SA( sampling_rate, DELAY_DIRAC_SPAR_ENC_CMP_NS ); -#ifndef SBA_MODE_CLEAN_UP - } - else /* SBA_MODE_DIRAC */ - { - pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_1_NS ); - pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ) + NS2SA( sampling_rate, DIRAC_SLOT_ENC_NS ); - /* extra SPAR/DirAC synchro delay */ - pFb_cfg->prior_input_length += NS2SA( sampling_rate, DELAY_FB_1_NS ); - } -#endif } else if ( ivas_format == MASA_FORMAT ) { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 96c6ca9a90..cfd5e5925a 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3115,10 +3115,6 @@ void reset_metadata_spatial( int32_t *total_brate, /* o : total bitrate */ const int32_t core_brate, /* i : core bitrate */ const int16_t nb_bits_metadata /* i : number of meatdata bits */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ); /*! r: number of bits written */ @@ -3127,10 +3123,6 @@ void ivas_qmetadata_enc_sid_encode( IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ const int16_t masa_sid_descriptor, /* i : description of MASA SID coding structure*/ const int16_t ivas_format /* i : ivas format */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ); /*! r: number of bits read */ @@ -3162,10 +3154,6 @@ int16_t ivas_qmetadata_dec_sid_decode( const int16_t nchan_transport, /* i : number of transport channels */ int16_t *element_mode, /* o : element mode */ const int16_t ivas_format /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ); void ivas_qmetadata_to_dirac( @@ -3173,11 +3161,7 @@ void ivas_qmetadata_to_dirac( DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#else const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); @@ -3378,27 +3362,13 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode -#else const IVAS_FORMAT ivas_format -#endif , const int16_t hodirac_flag, const int16_t nchan_fb_in ); -#ifndef SBA_MODE_CLEAN_UP -/*----------------------------------------------------------------------------------* - * SBA format prototypes - *----------------------------------------------------------------------------------*/ - -/*! r: SBA format mode */ -SBA_MODE ivas_sba_mode_select( - void -); -#endif void ivas_sba_config( const int32_t sba_total_brate, /* i : SBA total bitrate */ int16_t sba_order, /* i : Ambisonic (SBA) order */ @@ -3555,18 +3525,6 @@ void ivas_dirac_enc_close( const int32_t input_Fs /* i : input sampling_rate */ ); -#ifndef SBA_MODE_CLEAN_UP -void ivas_dirac_enc( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - int16_t *nb_bits_metadata, /* o : number of metadata bits written */ - const int16_t Opt_DTX_ON, /* i : flag signaling DTX on */ - float data_f[][L_FRAME48k], /* i/o: SBA channels */ - const int16_t input_frame, /* i : input frame length */ - const int16_t sba_planar /* i : SBA planar flag */ -); -#else void ivas_dirac_enc( DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ @@ -3579,7 +3537,6 @@ void ivas_dirac_enc( const IVAS_FORMAT ivas_format, /* i : ivas format */ int16_t hodirac_flag /* i : hodirac flag */ ); -#endif ivas_error ivas_dirac_config( void *st_ivas, /* i/o: IVAS encoder/decoder state structure */ const int16_t enc_dec /* i : encoder or decoder flag */ @@ -3604,17 +3561,9 @@ void ivas_get_dirac_sba_max_md_bits( ivas_error ivas_dirac_sba_config( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ -#ifndef SBA_MODE_CLEAN_UP - int16_t *nchan_transport, /* o : number of transport channel needed for MASA format */ - int16_t *nSCE, /* o : number of SCEs */ - int16_t *nCPE, /* o : number of CPEs */ -#endif int16_t *element_mode, /* o : element mode of the core coder */ int32_t sba_total_brate, /* i : SBA total bitrate */ const int16_t sba_order, /* i : Ambisonic (SBA) order */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t nbands /* i : number of frequency bands */ ); @@ -3647,9 +3596,6 @@ void ivas_dirac_dec_read_BS( DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q metadata */ int16_t *nb_bits, /* o : number of bits read */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); @@ -5422,12 +5368,8 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode /* i : SBA mode */ -#else const IVAS_FORMAT ivas_format, /* i : ivas_format */ int16_t ref_power_w /* i : use 0 if hodirac is enabled */ -#endif , const int16_t nchan_ana /* i : number of analysis channels */ ); @@ -5554,9 +5496,6 @@ ivas_error ivas_td_binaural_renderer_sf( ivas_error ivas_fb_set_cfg( IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ const int16_t ivas_format, /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t num_in_chans, /* i : number of FB input channels */ const int16_t num_out_chans, /* i : number of FB output channels */ const int16_t active_w_mixing, /* i : active_w_mixing flag */ @@ -5587,13 +5526,6 @@ void ivas_fb_mixer_pcm_ingest( const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ); -#ifndef SBA_MODE_CLEAN_UP -void ivas_dirac_enc_spar_delay_synchro( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const int16_t input_frame, /* i : input frame length */ - float data_f[][L_FRAME48k] /* i/o: SBA channels (ACN / SN3D) */ -); -#endif void ivas_fb_mixer_update_prior_input( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float *pcm_in[], /* i : input audio channels */ diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index 450ebef791..91137d3433 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -47,19 +47,6 @@ #include "wmc_auto.h" -#ifndef SBA_MODE_CLEAN_UP -/*-------------------------------------------------------------------* - * ivas_sba_mode_select() - * - * Return SBA mode - *-------------------------------------------------------------------*/ - -/*! r: SBA format mode */ -SBA_MODE ivas_sba_mode_select() -{ - return SBA_MODE_SPAR; -} -#endif /*-------------------------------------------------------------------* * ivas_sba_config() * diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index f8f3fa1209..8be61ea768 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -435,12 +435,6 @@ int16_t ivas_get_sba_num_TCs( { nchan_transport = 1; } -#ifndef SBA_MODE_CLEAN_UP - else if ( ivas_sba_mode_select() == SBA_MODE_DIRAC ) - { - nchan_transport = 1; - } -#endif else { table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); diff --git a/lib_com/options.h b/lib_com/options.h index 3b04c7fd45..46bce4c1c8 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,7 +154,6 @@ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ -#define SBA_MODE_CLEAN_UP /* Dlb: Cean up SBA mode references */ #define FIX_502_IND_LIST_SIZE /* Fix issue #502: insufficient index buffer sizes */ #define FIX_505_MASA_SPHGRID_REUSE /* Nokia: Fix issue #505: MASA spherical grid reuse fix */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index e112a8ec04..ffd96b635c 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -511,13 +511,8 @@ ivas_error ivas_cldfb_dec_reconfig( } } -#ifndef SBA_MODE_CLEAN_UP - /* CLDFB Interpolation weights */ - 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 /* CLDFB Interpolation weights */ if ( st_ivas->ivas_format == SBA_FORMAT && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) && numCldfbAnalyses != 0 && numCldfbSyntheses != 0 ) -#endif { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 1fb8e06cc3..5c34af0a36 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -272,54 +272,17 @@ ivas_error ivas_dec( set_s( nb_bits_metadata, 0, MAX_SCE ); /* read parameters from the bitstream */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hQMetaData != NULL ) -#endif { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT ) - { - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ), - 0 ); - } - else - { -#endif if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } -#ifndef SBA_MODE_CLEAN_UP - } -#endif } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL ) - { - st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; - -#ifndef SBA_MODE_CLEAN_UP - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ), - st_ivas->hSpar->dirac_to_spar_md_bands ); -#else - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ), - st_ivas->hSpar->dirac_to_spar_md_bands ); -#endif - } -#endif if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { @@ -376,11 +339,7 @@ ivas_error ivas_dec( { nchan_remapped = nchan_out; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -411,20 +370,12 @@ ivas_error ivas_dec( { nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame ); -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) -#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->renderer_type != RENDERER_DISABLE ) -#else else if ( st_ivas->renderer_type != RENDERER_DISABLE ) -#endif { ivas_spar_dec_agc_pca( st_ivas, output, output_frame ); } @@ -458,11 +409,7 @@ ivas_error ivas_dec( { ivas_dirac_dec_binaural( st_ivas, output, nchan_remapped ); } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_DIRAC || st_ivas->ivas_format == MASA_FORMAT ) -#else else if ( st_ivas->ivas_format == MASA_FORMAT ) -#endif { if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 3bde2aa5ee..0b795ddd31 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -312,11 +312,7 @@ ivas_error ivas_dirac_dec_config( num_protos_diff_old = 0; nchan_transport_orig = st_ivas->nchan_transport; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) -#else if ( st_ivas->ivas_format == SBA_FORMAT && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) -#endif { st_ivas->nchan_transport = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -421,11 +417,7 @@ ivas_error ivas_dirac_dec_config( } /* band config needed only for SPAR with FOA output */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->sba_mode == SBA_MODE_SPAR && !hodirac_flag ) -#else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) -#endif { return IVAS_ERR_OK; } @@ -587,11 +579,7 @@ ivas_error ivas_dirac_dec_config( set_s( hDirAC->proto_index_diff, 0, hDirAC->num_outputs_diff ); hDirAC->sba_map_tc = sba_map_tc; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { if ( st_ivas->sba_order > SBA_FOA_ORDER && ivas_total_brate >= IVAS_512k ) { @@ -696,11 +684,7 @@ ivas_error ivas_dirac_dec_config( { hDirAC->num_protos_diff = 1; hDirAC->num_protos_dir = nchan_transport; -#ifndef SBA_MODE_CLEAN_UP - if ( ( st_ivas->sba_planar ) && ( !( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) -#else if ( ( st_ivas->sba_planar ) && ( !( st_ivas->ivas_format == SBA_FORMAT ) ) ) -#endif { hDirAC->num_protos_dir++; } @@ -810,11 +794,7 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { hDirAC->hoa_decoder = NULL; -#ifndef SBA_MODE_CLEAN_UP - if ( ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) || st_ivas->sba_mode == SBA_MODE_SPAR || ( nchan_transport > 2 ) ) -#else if ( ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) || st_ivas->ivas_format == SBA_FORMAT || ( nchan_transport > 2 ) ) -#endif { if ( hDirAC->hOutSetup.is_loudspeaker_setup ) { @@ -1047,22 +1027,6 @@ ivas_error ivas_dirac_dec_config( { int16_t num_slots_in_subfr; num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) - { -#ifdef FIX_393_459_460_SBA_MD - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; -#else - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES * num_slots_in_subfr; -#endif - hDirAC->dirac_bs_md_write_idx = 0; - hDirAC->spar_to_dirac_write_idx = 0; - hDirAC->dirac_read_idx = 0; - hDirAC->dirac_estimator_idx = 0; - } - else - { -#endif #ifdef FIX_393_459_460_SBA_MD hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; @@ -1074,9 +1038,6 @@ ivas_error ivas_dirac_dec_config( #endif hDirAC->dirac_read_idx = 0; hDirAC->dirac_estimator_idx = 0; -#ifndef SBA_MODE_CLEAN_UP - } -#endif set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); #ifdef FIX_393_459_460_SBA_MD @@ -1123,11 +1084,7 @@ ivas_error ivas_dirac_dec_config( { int16_t num_slots_in_subfr; num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { if ( ( hDirAC->hConfig->dec_param_estim_old != hDirAC->hConfig->dec_param_estim ) ) { @@ -1151,11 +1108,7 @@ ivas_error ivas_dirac_dec_config( { if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { int16_t nchan_to_allocate; @@ -1746,9 +1699,6 @@ void ivas_dirac_dec_read_BS( DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata */ int16_t *nb_bits, /* o : number of bits read */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) @@ -1765,40 +1715,8 @@ void ivas_dirac_dec_read_BS( b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode != SBA_MODE_SPAR ) - { - assert( ( b == 0 ) || ( hQMetaData->q_direction[0].cfg.start_band > 0 ) ); - } -#endif if ( b == 1 ) /* WB 4TCs condition, no other metadata to read*/ { -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode != SBA_MODE_SPAR ) - { - if ( hDirAC != NULL ) - { - /* No Data transmitted*/ - hQMetaData->q_direction[0].cfg.nblocks = 0; - for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) - { - for ( b = 0; b < hQMetaData->q_direction[dir].cfg.nbands; b++ ) - { - set_zero( hQMetaData->q_direction[dir].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[dir].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[dir].band_data[b].energy_ratio_index[i] = 0; - } - } - } - } - } - } - else - { -#endif orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; hQMetaData->sba_inactive_mode = 1; @@ -1813,11 +1731,7 @@ void ivas_dirac_dec_read_BS( } } -#ifndef SBA_MODE_CLEAN_UP - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, sba_mode ); -#else *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); -#endif for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; @@ -1835,9 +1749,6 @@ void ivas_dirac_dec_read_BS( } hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; -#ifndef SBA_MODE_CLEAN_UP - } -#endif } else { @@ -1887,15 +1798,7 @@ void ivas_dirac_dec_read_BS( } } -#ifndef SBA_MODE_CLEAN_UP - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, sba_mode ); -#else *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); -#endif -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; @@ -1913,29 +1816,15 @@ void ivas_dirac_dec_read_BS( } hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; -#ifndef SBA_MODE_CLEAN_UP - } - else - { - *nb_bits += SID_FORMAT_NBITS; - } - -#endif st->next_bit_pos = next_bit_pos_orig; } if ( hDirAC != NULL ) { -#ifndef SBA_MODE_CLEAN_UP - ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, sba_mode, - hodirac_flag, - dirac_to_spar_md_bands ); -#else ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); -#endif } return; @@ -1953,11 +1842,7 @@ void ivas_qmetadata_to_dirac( DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#else const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) @@ -2082,11 +1967,7 @@ void ivas_qmetadata_to_dirac( nbands = hDirAC->band_grouping[hDirAC->hConfig->nbands]; band_grouping = hDirAC->band_grouping; -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_total_brate <= IVAS_SID_5k2 && sba_mode != SBA_MODE_SPAR ) -#else if ( ivas_total_brate <= IVAS_SID_5k2 && ivas_format != SBA_FORMAT ) -#endif { /* SID/zero-frame: 1 direction, 5 bands, nblocks re-generated out of SID decoder*/ start_band = 0; @@ -2097,11 +1978,7 @@ void ivas_qmetadata_to_dirac( else { start_band = hDirAC->hConfig->enc_param_start_band; -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { hDirAC->hConfig->nbands = IVAS_MAX_NUM_BANDS; } @@ -2188,11 +2065,7 @@ void ivas_qmetadata_to_dirac( band_end = band_grouping[band + 1]; tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { qBand_idx = dirac_to_spar_md_bands[band] - start_band; } @@ -2497,11 +2370,7 @@ void ivas_dirac_dec( st_ivas->hTcBuffer->tc[n] = output_f[n]; } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) -#endif { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; @@ -2531,11 +2400,7 @@ void ivas_dirac_dec( { st_ivas->hTcBuffer->tc[n] = NULL; } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) -#endif { st_ivas->hTcBuffer->tc[nchan_transport] = NULL; } @@ -2680,11 +2545,7 @@ void ivas_dirac_dec_render_sf( hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT ) -#else - if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) -#endif { coherence_flag = st_ivas->hQMetaData->coherence_flag; } @@ -2899,11 +2760,7 @@ void ivas_dirac_dec_render_sf( md_idx = hDirAC->render_to_md_map[subframe_idx]; } -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { for ( ch = 0; ch < nchan_transport; ch++ ) { @@ -2925,11 +2782,7 @@ void ivas_dirac_dec_render_sf( } /* CNG in DirAC, extra CLDFB ana for CNA*/ -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) -#else - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) -#endif { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; @@ -3403,11 +3256,7 @@ void ivas_dirac_dec_render_sf( st_ivas->cldfbSynDec[ch] ); } } -#ifdef SBA_MODE_CLEAN_UP else if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { for ( ch = 0; ch < hDirAC->hOutSetup.nchan_out_woLFE; ch++ ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d89f33e075..d4699a7273 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -260,18 +260,10 @@ ivas_error ivas_dec_setup( if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == SBA_FORMAT ) { int16_t nchan_transport_old, nchan_transport; -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE sba_mode_old; - sba_mode_old = ivas_sba_mode_select(); -#endif nchan_transport_old = st_ivas->nchan_transport; nchan_transport = ( st_ivas->sid_format == SID_SBA_2TC ) ? 2 : 1; -#ifdef SBA_MODE_CLEAN_UP if ( ( nchan_transport_old != nchan_transport ) ) -#else - if ( ( nchan_transport_old != nchan_transport ) || ( sba_mode_old != st_ivas->sba_mode ) ) -#endif { /*Setting the default bitrate for the reconfig function*/ if ( st_ivas->sid_format == SID_SBA_2TC ) @@ -280,12 +272,7 @@ ivas_error ivas_dec_setup( } else { -#ifdef SBA_MODE_CLEAN_UP st_ivas->hDecoderConfig->ivas_total_brate = IVAS_24k4; -#else - st_ivas->hDecoderConfig->ivas_total_brate = ( st_ivas->sba_mode == SBA_MODE_SPAR ) ? IVAS_24k4 : IVAS_13k2; - -#endif } if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) @@ -406,9 +393,6 @@ static ivas_error ivas_read_format( else { st_ivas->ivas_format = SBA_FORMAT; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = ivas_sba_mode_select(); -#endif } ( *num_bits_read )++; break; @@ -476,16 +460,6 @@ static ivas_error ivas_read_format( { st_ivas->sba_analysis_order = SBA_FOA_ORDER; } -#ifndef SBA_MODE_CLEAN_UP - if ( idx == 1 ) - { - st_ivas->sba_mode = SBA_MODE_SPAR; - } - else - { - st_ivas->sba_mode = SBA_MODE_DIRAC; - } -#endif } /* reset bitstream handle to avoid BER detection after reading the 2400 kbps for ch0 */ @@ -580,9 +554,6 @@ ivas_error ivas_init_decoder_front( st_ivas->ism_mode = ISM_MODE_NONE; st_ivas->mc_mode = MC_MODE_NONE; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = SBA_MODE_NONE; -#endif st_ivas->sba_dirac_stereo_flag = 0; @@ -676,11 +647,7 @@ ivas_error ivas_init_decoder( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { -#ifndef SBA_MODE_CLEAN_UP - int16_t i, k, n; -#else int16_t i, n; -#endif int16_t sce_id, cpe_id; int16_t numCldfbAnalyses, numCldfbSyntheses; int16_t granularity, n_channels_transport_jbm; @@ -886,10 +853,6 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { -#endif if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; @@ -905,17 +868,9 @@ ivas_error ivas_init_decoder( if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, -#ifndef SBA_MODE_CLEAN_UP - &st_ivas->nchan_transport, - &st_ivas->nSCE, - &st_ivas->nCPE, -#endif &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode, -#endif ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) { return error; @@ -928,12 +883,6 @@ ivas_error ivas_init_decoder( return error; } -#ifndef SBA_MODE_CLEAN_UP - for ( k = 0; k < DIRAC_MAX_NBANDS; k++ ) - { - st_ivas->hSpar->dirac_to_spar_md_bands[k] = st_ivas->hDirAC->dirac_to_spar_md_bands[k]; - } -#endif st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; } else @@ -953,27 +902,10 @@ ivas_error ivas_init_decoder( st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#ifndef SBA_MODE_CLEAN_UP - } - else /* SBA_MODE_DIRAC */ - { - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); - } -#endif } -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->ivas_format != SBA_FORMAT ) -#else - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && - st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) -#endif { if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -1438,11 +1370,7 @@ ivas_error ivas_init_decoder( } /* CLDFB Interpolation weights */ -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT && !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 && st_ivas->hDecoderConfig->nchan_out != 1 ) -#endif { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } @@ -1949,11 +1877,7 @@ void ivas_init_dec_get_num_cldfb_instances( } break; case RENDERER_DIRAC: -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; @@ -1970,11 +1894,7 @@ void ivas_init_dec_get_num_cldfb_instances( *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; } } -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format != SBA_FORMAT ) -#else - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) -#endif { if ( st_ivas->nchan_transport > 2 && st_ivas->sba_planar ) { @@ -2015,11 +1935,7 @@ void ivas_init_dec_get_num_cldfb_instances( case RENDERER_BINAURAL_MIXER_CONV_ROOM: case RENDERER_BINAURAL_FASTCONV: case RENDERER_BINAURAL_FASTCONV_ROOM: -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { if ( st_ivas->sba_dirac_stereo_flag ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 91c7a1c185..a0dd0aad18 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -183,21 +183,13 @@ ivas_error ivas_jbm_dec_tc( set_s( nb_bits_metadata, 0, MAX_SCE ); /* read parameters from the bitstream */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT ) -#endif { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; if ( st_ivas->ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, hodirac_flag, 0 ); -#else ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], hodirac_flag, 0 ); -#endif } else { @@ -207,23 +199,8 @@ ivas_error ivas_jbm_dec_tc( } } } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL ) - { - st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; -#ifndef SBA_MODE_CLEAN_UP - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, hodirac_flag, st_ivas->hSpar->dirac_to_spar_md_bands ); -#else - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], hodirac_flag, st_ivas->hSpar->dirac_to_spar_md_bands ); -#endif - } -#endif if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { @@ -269,11 +246,7 @@ ivas_error ivas_jbm_dec_tc( { nchan_remapped = nchan_out; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -304,19 +277,11 @@ ivas_error ivas_jbm_dec_tc( { nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame ); -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) -#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else -#endif { ivas_spar_dec_agc_pca( st_ivas, output, output_frame ); } @@ -781,11 +746,7 @@ ivas_error ivas_jbm_dec_render( { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_DIRAC || st_ivas->ivas_format == MASA_FORMAT ) -#else else if ( st_ivas->ivas_format == MASA_FORMAT ) -#endif { if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { @@ -1311,12 +1272,7 @@ int16_t ivas_jbm_dec_get_num_tc_channels( } if ( st_ivas->ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - if ( ( st_ivas->sba_mode != SBA_MODE_SPAR && st_ivas->sba_planar && num_tc >= 3 ) || - ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && num_tc == 3 ) ) -#else if ( ( st_ivas->sba_planar && num_tc >= 3 ) || ( num_tc == 3 ) ) -#endif { num_tc++; } @@ -1834,11 +1790,7 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( } break; case RENDERER_SBA_LINEAR_DEC: -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) -#else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) -#endif { buffer_mode = TC_BUFFER_MODE_BUFFER; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index ae30e4bebd..87ddae3a5c 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -274,11 +274,7 @@ ivas_error ivas_masa_decode( } tmp_elem_mode = -1; -#ifndef SBA_MODE_CLEAN_UP - *nb_bits_read += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), st_ivas->nchan_transport, &tmp_elem_mode, ivas_format, SBA_MODE_NONE ); -#else *nb_bits_read += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), st_ivas->nchan_transport, &tmp_elem_mode, ivas_format ); -#endif if ( st_ivas->nchan_transport == 2 ) { assert( st_ivas->nCPE > 0 ); @@ -299,11 +295,7 @@ ivas_error ivas_masa_decode( if ( st_ivas->hDirAC != NULL ) { ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE_NONE, -#else ivas_format, -#endif 0, 0 ); } diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 52891aaf87..aec03b506b 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -316,13 +316,8 @@ void ivas_renderer_select( else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) { *renderer_type = RENDERER_DIRAC; -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT && ( 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 - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && - ( 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 ) ) -#endif { if ( output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_FOA ) { diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index bd63c14daf..73043ec78e 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1225,10 +1225,6 @@ int16_t ivas_qmetadata_dec_sid_decode( const int16_t nchan_transport, /* i : number of transport channels */ int16_t *element_mode, /* o : element mode */ const int16_t ivas_format /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ) { int16_t b, m, i; @@ -1259,21 +1255,8 @@ int16_t ivas_qmetadata_dec_sid_decode( if ( ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ -#ifndef SBA_MODE_CLEAN_UP - } - else - { - /* keep 13.2 and 16.4 sid bitrate as 4.4 kbps for now*/ - /* TODO: still use old sid frame size to keep bitexactness */ - metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; - } -#endif } else { @@ -1299,11 +1282,7 @@ int16_t ivas_qmetadata_dec_sid_decode( /* Fix configuration for SID */ q_direction = &hQMetaData->q_direction[0]; /* only 1 direction */ -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { nbands = DIRAC_DTX_BANDS; /* only 2 bands transmitted */ } @@ -1316,11 +1295,7 @@ int16_t ivas_qmetadata_dec_sid_decode( start_band = 0; /* start from band 0 */ /* Read 2D signaling*/ -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode != SBA_MODE_SPAR ) -#else if ( ivas_format != SBA_FORMAT ) -#endif { q_direction->not_in_2D = bitstream[( *index )--]; } @@ -1405,18 +1380,7 @@ int16_t ivas_qmetadata_dec_sid_decode( } } /* TODO: temporary hack to keep BE */ -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_format == SBA_FORMAT ) - { - if ( sba_mode != SBA_MODE_SPAR ) - { - metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - 1; /* -1 for spar/dirac indicator*/ - } - } - else -#else if ( ivas_format != SBA_FORMAT ) -#endif { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 60d76b65df..6b8576a95f 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -59,11 +59,7 @@ void ivas_sba_set_cna_cng_flag( { int16_t n, cpe_id; -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 1 ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) -#endif { /* skip as done in init function */ /* st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; */ @@ -294,17 +290,9 @@ ivas_error ivas_sba_dec_reconfigure( if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, -#ifndef SBA_MODE_CLEAN_UP - &st_ivas->nchan_transport, - &st_ivas->nSCE, - &st_ivas->nCPE, -#endif &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode, -#endif ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) @@ -321,9 +309,6 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->hDirAC != NULL ) { -#ifndef SBA_MODE_CLEAN_UP - mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); -#endif st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; } @@ -389,11 +374,7 @@ ivas_error ivas_sba_dec_reconfigure( { tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { tc_nchan_to_allocate = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -437,20 +418,12 @@ ivas_error ivas_sba_dec_digest_tc( error = IVAS_ERR_OK; /* set the md map */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hDirAC && !( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode == SBA_MODE_DIRAC ) ) -#else if ( st_ivas->hDirAC ) -#endif { ivas_dirac_dec_set_md_map( st_ivas, nCldfbSlots ); } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { ivas_spar_dec_digest_tc( st_ivas, st_ivas->nchan_transport, nCldfbSlots, nSamplesForRendering ); } @@ -487,11 +460,7 @@ ivas_error ivas_sba_dec_digest_tc( } /* if we have a late CNG generation, do it here */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format == SBA_FORMAT ) -#endif { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], nCldfbSlots, st->cna_dirac_flag && st->flag_cna ); diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 7a5b492102..f96fdb694a 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -63,11 +63,7 @@ int16_t ivas_get_sba_dirac_stereo_flag( if ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { if ( output_config == AUDIO_CONFIG_STEREO || ( output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ) { @@ -854,12 +850,7 @@ void ivas_sba_dirac_stereo_dec( memOffset = NS2SA( output_frame * FRAMES_PER_SEC, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); ivas_sba_dirac_stereo_config( hStereoDft->hConfig ); -#ifdef SBA_MODE_CLEAN_UP hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT, ( st_ivas->ivas_format == SBA_FORMAT && !mcmasa ) ); -#else - hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); - -#endif stereo_dft_dec_update( hStereoDft, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); if ( st_ivas->nchan_transport > 1 ) { @@ -881,22 +872,11 @@ void ivas_sba_dirac_stereo_dec( } /* mapping of DirAC parameters (azimuth, elevation, diffuseness) to DFT Stereo parameters (side gain, prediction gain) */ -#ifdef SBA_MODE_CLEAN_UP map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], st_ivas->ivas_format == MC_FORMAT, ( st_ivas->ivas_format != SBA_FORMAT || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame, ( st_ivas->ivas_format != SBA_FORMAT || mcmasa ) ); -#else - map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], - st_ivas->ivas_format == MC_FORMAT, - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame, - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ); -#endif -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT && !mcmasa ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) -#endif { set_f( hStereoDft->res_pred_gain, 1.f, 3 * STEREO_DFT_BAND_MAX ); } @@ -940,13 +920,8 @@ void ivas_sba_dirac_stereo_dec( /* upmix ACELP BWE */ ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain ); -#ifdef SBA_MODE_CLEAN_UP ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, ( st_ivas->ivas_format != SBA_FORMAT || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft ); -#else - ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft ); -#endif /* add HB to ACELP core */ v_add( output[0], hb_synth_stereo[0], output[0], output_frame ); @@ -955,12 +930,7 @@ void ivas_sba_dirac_stereo_dec( v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); /* apply TD Stereo Filling as is done in ICBWE */ -#ifdef SBA_MODE_CLEAN_UP ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, ( st_ivas->ivas_format == SBA_FORMAT && !mcmasa ) ); -#else - ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); - -#endif } } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index b683262a6e..5415609d80 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -232,21 +232,10 @@ int16_t ivas_sba_remapTCs( #endif nchan_remapped = st_ivas->nchan_transport; -#ifdef SBA_MODE_CLEAN_UP if ( nchan_remapped == 3 ) -#else - if ( ( st_ivas->sba_mode != SBA_MODE_SPAR && st_ivas->sba_planar && nchan_remapped >= 3 ) || - ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && nchan_remapped == 3 ) ) -#endif { nchan_remapped++; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) - { - assert( ( ( st_ivas->nchan_transport == 3 ) || ( st_ivas->nchan_transport == 5 ) || ( st_ivas->nchan_transport == 7 ) ) && "Number of channels must be odd for SBA planar!" ); - } -#endif if ( nchan_remapped == 4 ) { @@ -273,12 +262,6 @@ int16_t ivas_sba_remapTCs( } } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) - { - ivas_sba_zero_vert_comp( sba_data, st_ivas->sba_analysis_order, st_ivas->sba_planar, output_frame ); - } -#endif return ( nchan_remapped ); } diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index f405f50c04..2ee76d24c5 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -149,13 +149,8 @@ ivas_error ivas_sce_dec( st->codec_mode = MODE1; /* set "bits_frame_nominal" */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( st_ivas->hQMetaData != NULL ) && - ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) -#else if ( ( st_ivas->hQMetaData != NULL ) && ( st_ivas->ivas_format != SBA_FORMAT ) ) -#endif { if ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) { @@ -166,11 +161,7 @@ ivas_error ivas_sce_dec( st->bits_frame_nominal = st_ivas->hQMetaData->bits_frame_nominal; } } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { st->bits_frame_nominal = (int16_t) ( st_ivas->hSpar->core_nominal_brate / FRAMES_PER_SEC ); } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index cd9888dc21..df0bb993da 100755 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -130,13 +130,8 @@ ivas_error ivas_spar_dec_open( /* set FB config. */ active_w_mixing = -1; -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -327,7 +322,6 @@ ivas_error ivas_spar_dec( bit_stream_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; -#ifdef SBA_MODE_CLEAN_UP /* read DirAC bitstream */ if ( st_ivas->hQMetaData != NULL ) { @@ -335,7 +329,6 @@ ivas_error ivas_spar_dec( ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); } -#endif last_bit_pos = (int16_t) ( ( hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC ) - 1 ); if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 3a48913566..bb96d8bcba 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -718,9 +718,6 @@ typedef struct ivas_dirac_dec_data_structure float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; IVAS_FB_MIXER_HANDLE hFbMdft; -#ifndef SBA_MODE_CLEAN_UP - int16_t dirac_to_spar_md_bands[DIRAC_MAX_NBANDS]; -#endif const int16_t *sba_map_tc; } DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; @@ -1280,9 +1277,6 @@ typedef struct Decoder_Struct ISM_MODE ism_mode; /* ISM format mode */ int16_t nchan_ism; /* number of ISM channels */ -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE sba_mode; /* SBA format mode */ -#endif MC_MODE mc_mode; /* MC format mode */ int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 0634cdfd05..09cf754979 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -205,9 +205,6 @@ ivas_error IVAS_DEC_Open( st_ivas->writeFECoffset = 0; st_ivas->ism_mode = ISM_MODE_NONE; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = SBA_MODE_NONE; -#endif st_ivas->mc_mode = MC_MODE_NONE; st_ivas->sba_order = 0; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 0f3fffb369..6bea810953 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -465,11 +465,7 @@ ivas_error ivas_cpe_enc( { if ( hCPE->element_mode == IVAS_CPE_DFT || hCPE->element_mode == IVAS_CPE_TD ) { -#ifndef SBA_MODE_CLEAN_UP - reset_metadata_spatial( ivas_format, hCPE->hMetaData, hCPE->element_brate, &tmp, sts[0]->core_brate, nb_bits_metadata, st_ivas->sba_mode ); -#else reset_metadata_spatial( ivas_format, hCPE->hMetaData, hCPE->element_brate, &tmp, sts[0]->core_brate, nb_bits_metadata ); -#endif } } @@ -479,17 +475,9 @@ ivas_error ivas_cpe_enc( stereoFdCngCoherence( sts, hCPE->last_element_mode, fft_buff ); /* Reset metadata */ -#ifndef SBA_MODE_CLEAN_UP - if ( sts[0]->cng_sba_flag || ( ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) ) -#else if ( sts[0]->cng_sba_flag || ( ivas_format == SBA_FORMAT ) ) -#endif { -#ifndef SBA_MODE_CLEAN_UP - reset_metadata_spatial( ivas_format, hCPE->hMetaData, hCPE->element_brate, &tmp, sts[0]->core_brate, nb_bits_metadata, st_ivas->sba_mode ); -#else reset_metadata_spatial( ivas_format, hCPE->hMetaData, hCPE->element_brate, &tmp, sts[0]->core_brate, nb_bits_metadata ); -#endif } } diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 97b238f330..f364137bdf 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -62,13 +62,7 @@ ivas_error ivas_dirac_enc_open( ) { int16_t i, j; -#ifndef SBA_MODE_CLEAN_UP - int32_t input_Fs; -#endif DIRAC_ENC_HANDLE hDirAC; -#ifndef SBA_MODE_CLEAN_UP - IVAS_FB_CFG *fb_cfg; -#endif int32_t dirac_slot_ns; ivas_error error; @@ -95,9 +89,6 @@ ivas_error ivas_dirac_enc_open( *-----------------------------------------------------------------*/ st_ivas->hDirAC = hDirAC; -#ifndef SBA_MODE_CLEAN_UP - input_Fs = st_ivas->hEncoderConfig->input_Fs; -#endif if ( ( error = ivas_dirac_config( (void *) st_ivas, ENC ) ) != IVAS_ERR_OK ) { @@ -105,29 +96,7 @@ ivas_error ivas_dirac_enc_open( } /* set FB config. */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { -#endif hDirAC->hFbMixer = NULL; -#ifndef SBA_MODE_CLEAN_UP - } - else - { - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_DIRAC, - FOA_CHANNELS, - 0, 0, input_Fs, - FOA_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - /* Allocate and initialize FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif for ( i = 0; i < DIRAC_MAX_NBANDS + 1; i++ ) { @@ -137,30 +106,6 @@ ivas_error ivas_dirac_enc_open( dirac_slot_ns = DIRAC_SLOT_ENC_NS; /* initialize delay for SPAR/DirAC delay synchronization */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) - { - hDirAC->num_samples_synchro_delay = NS2SA( input_Fs, IVAS_FB_ENC_DELAY_NS ); - - for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) - { - if ( ( hDirAC->sba_synchro_buffer[i] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_zero( hDirAC->sba_synchro_buffer[i], hDirAC->num_samples_synchro_delay ); - } - } - else - { - hDirAC->num_samples_synchro_delay = 0; - - for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) - { - hDirAC->sba_synchro_buffer[i] = NULL; - } - } -#endif /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) @@ -216,15 +161,7 @@ ivas_error ivas_dirac_enc_open( hDirAC->index_buffer_intensity = 0; st_ivas->hDirAC = hDirAC; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); -#endif st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; -#ifndef SBA_MODE_CLEAN_UP - } -#endif return error; } @@ -297,16 +234,6 @@ void ivas_dirac_enc_close( { ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs, 0 ); } -#ifndef SBA_MODE_CLEAN_UP - for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) - { - if ( hDirAC->sba_synchro_buffer[i] != NULL ) - { - free( hDirAC->sba_synchro_buffer[i] ); - hDirAC->sba_synchro_buffer[i] = NULL; - } - } -#endif /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { @@ -347,220 +274,6 @@ void ivas_dirac_enc_close( return; } -#ifndef SBA_MODE_CLEAN_UP -/*------------------------------------------------------------------------- - * ivas_dirac_enc() - * - * DirAC Encoder - * - * input-data in data_f[] is assumed to be in ACN ordering, i.e. - * data_f[0] --> W - * data_f[1] --> Y - * data_f[2] --> Z - * data_f[3] --> X - *------------------------------------------------------------------------*/ - -void ivas_dirac_enc( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - int16_t *nb_bits_metadata, /* o : number of metadata bits written */ - const int16_t Opt_DTX_ON, /* i : flag signaling DTX on */ - float data_f[][L_FRAME48k], /* i/o: SBA channels */ - const int16_t input_frame, /* i : input frame length */ - const int16_t sba_planar /* i : SBA planar flag */ -) -{ - int16_t i; - - push_wmops( "ivas_dirac_enc" ); - - /*Check if highest band of input signal <= enc_param_start_band: could happen for WB input signal in 4TCs mode*/ - if ( hDirAC->band_grouping[hDirAC->hConfig->nbands] <= hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ) - { - /* Signal 4 bands (WB 4TC mode) on 1 bit */ - push_next_indice( hMetaData, 1, 1 ); - *nb_bits_metadata = hMetaData->nb_bits_tot; - } - else - { - /* WB 4TC mode bit */ - push_next_indice( hMetaData, 0, 1 ); - - /* parameter estimation */ - if ( sba_planar ) - { - /* Z is forced to zero in planar case */ - set_zero( data_f[2], input_frame ); - } - - ivas_dirac_param_est_enc( hDirAC, &( hQMetaData->q_direction[0] ), hQMetaData->useLowerRes, data_f, NULL, NULL, input_frame, SBA_MODE_DIRAC, - 0, - FOA_CHANNELS ); - - /* encode parameters */ - if ( sba_planar || hQMetaData->useLowerRes ) - { - for ( i = hQMetaData->q_direction[0].cfg.start_band; i < hQMetaData->q_direction[0].cfg.nbands; i++ ) - { - /* Make sure elevation is really zero */ - set_zero( hQMetaData->q_direction[0].band_data[i].elevation, hQMetaData->q_direction[0].cfg.nblocks ); - } - } - - ivas_qmetadata_enc_encode( hMetaData, hQMetaData, - 0 ); - - *nb_bits_metadata = hMetaData->nb_bits_tot; - - if ( Opt_DTX_ON ) - { - if ( !( hQMetaData->no_directions == 1 && hQMetaData->numCodingBands == 5 ) ) - { - float orig_azi[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - float orig_ele[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - float orig_energy_ratio[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - - float dir[3]; - float avg_dir[3]; - - float vecLen; - float energySum; - - int16_t j; - int16_t nbands; - - for ( i = 0; i < DIRAC_MAX_NBANDS; i++ ) - { - mvr2r( &hQMetaData->q_direction[0].band_data[i].azimuth[0], orig_azi[i], MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( &hQMetaData->q_direction[0].band_data[i].elevation[0], orig_ele[i], MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( &hQMetaData->q_direction[0].band_data[i].energy_ratio[0], orig_energy_ratio[i], MAX_PARAM_SPATIAL_SUBFRAMES ); - } - - /* Force to 5 bands */ - nbands = hQMetaData->q_direction[0].cfg.nbands; - hDirAC->hConfig->nbands = 5; - hQMetaData->q_direction[0].cfg.nbands = 5; - - /* compute directions */ - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - set_zero( dir, 3 ); - set_zero( avg_dir, 3 ); - energySum = 0.0f; - - /* average values over last two bands into 5th band */ - for ( j = DIRAC_MAX_NBANDS - 2; j < DIRAC_MAX_NBANDS; j++ ) - { - ivas_qmetadata_azimuth_elevation_to_direction_vector( hQMetaData->q_direction[0].band_data[j].azimuth[i], hQMetaData->q_direction[0].band_data[j].elevation[i], &dir[0] ); - vecLen = hQMetaData->q_direction[0].band_data[j].energy_ratio[i] * hDirAC->buffer_energy[i * DIRAC_MAX_NBANDS + j]; - - avg_dir[0] += dir[0] * vecLen; - avg_dir[1] += dir[1] * vecLen; - avg_dir[2] += dir[2] * vecLen; - - energySum += hDirAC->buffer_energy[i * DIRAC_MAX_NBANDS + j]; - } - - ivas_qmetadata_direction_vector_to_azimuth_elevation( &avg_dir[0], &hQMetaData->q_direction[0].band_data[DIRAC_MAX_NBANDS - 2].azimuth[i], &hQMetaData->q_direction[0].band_data[DIRAC_MAX_NBANDS - 2].elevation[i] ); - - hQMetaData->q_direction[0].band_data[DIRAC_MAX_NBANDS - 2].energy_ratio[i] = sqrtf( dotp( avg_dir, avg_dir, 3 ) ) / ( energySum + EPSILON ); - } - - /* encode SID parameters */ -#ifndef SBA_MODE_CLEAN_UP - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, SBA_MODE_DIRAC ); -#else - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT ); - -#endif - /* restore original metadata */ - hDirAC->hConfig->nbands = nbands; - hQMetaData->q_direction[0].cfg.nbands = nbands; - - for ( i = 0; i < DIRAC_MAX_NBANDS; i++ ) - { - mvr2r( orig_azi[i], &hQMetaData->q_direction[0].band_data[i].azimuth[0], MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( orig_ele[i], &hQMetaData->q_direction[0].band_data[i].elevation[0], MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( orig_energy_ratio[i], &hQMetaData->q_direction[0].band_data[i].energy_ratio[0], MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - else - { - /*indicate whether SPAR or DiRAC mode*/ - push_next_indice( hMetaData, 0, 1 ); - - /* encode SID parameters */ -#ifndef SBA_MODE_CLEAN_UP - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, SBA_MODE_DIRAC ); -#else - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT ); -#endif - } - } - } - - pop_wmops(); - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_enc_spar_delay_synchro() - * - * Delay input channels to be synchronized between DirAC and SPAR - *-------------------------------------------------------------------------*/ - -void ivas_dirac_enc_spar_delay_synchro( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const int16_t input_frame, /* i : input frame length */ - float data_f[][L_FRAME48k] /* i/o: SBA channels (ACN / SN3D) */ -) -{ - int16_t ch_idx; - float tmp_buffer[L_FRAME48k]; - Encoder_State *sts[MCT_MAX_BLOCKS]; - int16_t sce_id, cpe_id, i_chan; - - /* check last sba_mode */ - if ( ivas_sba_mode_select() == SBA_MODE_SPAR ) - { - /* initializations */ - i_chan = 0; - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - sts[sce_id] = st_ivas->hSCE[sce_id]->hCoreCoder[0]; - i_chan++; - } - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( int16_t ch = 0; ch < CPE_CHANNELS; ch++ ) - { - sts[i_chan] = st_ivas->hCPE[cpe_id]->hCoreCoder[ch]; - i_chan++; - } - } - - /* populate old synchro buffers */ - for ( ch_idx = 0; ch_idx < i_chan; ch_idx++ ) - { - mvr2r( sts[ch_idx]->input, st_ivas->hDirAC->sba_synchro_buffer[ch_idx], st_ivas->hDirAC->num_samples_synchro_delay ); - } - } - - for ( ch_idx = 0; ch_idx < DIRAC_MAX_ANA_CHANS; ch_idx++ ) - { - mvr2r( data_f[ch_idx], tmp_buffer, input_frame ); - mvr2r( st_ivas->hDirAC->sba_synchro_buffer[ch_idx], data_f[ch_idx], st_ivas->hDirAC->num_samples_synchro_delay ); - mvr2r( tmp_buffer, &data_f[ch_idx][st_ivas->hDirAC->num_samples_synchro_delay], input_frame - st_ivas->hDirAC->num_samples_synchro_delay ); - mvr2r( &tmp_buffer[input_frame - st_ivas->hDirAC->num_samples_synchro_delay], st_ivas->hDirAC->sba_synchro_buffer[ch_idx], st_ivas->hDirAC->num_samples_synchro_delay ); - } - - return; -} -#else /*------------------------------------------------------------------------- * ivas_dirac_enc() * @@ -674,7 +387,6 @@ void ivas_dirac_enc( return; } -#endif /*------------------------------------------------------------------------- * computeReferencePower_enc() @@ -689,12 +401,8 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode /* i : SBA mode */ -#else const IVAS_FORMAT ivas_format, /* i : ivas_format */ int16_t ref_power_w /* i : use 0 if hodirac is enabled */ -#endif , const int16_t nchan_ana /* i : number of analysis channels */ ) @@ -728,11 +436,7 @@ void computeReferencePower_enc( } v_multc( reference_power, 0.5f, reference_power, num_freq_bands ); -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT && ref_power_w == 1 ) -#endif { for ( i = 0; i < num_freq_bands; i++ ) { @@ -758,11 +462,7 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, -#else const IVAS_FORMAT ivas_format, -#endif const int16_t hodirac_flag, const int16_t nchan_fb_in ) { @@ -871,12 +571,8 @@ void ivas_dirac_param_est_enc( reference_power[ts], hDirAC->hConfig->enc_param_start_band, num_freq_bands, -#ifndef SBA_MODE_CLEAN_UP - hodirac_flag ? SBA_MODE_DIRAC : sba_mode, -#else ivas_format, hodirac_flag ? 0 : 1, -#endif FOA_CHANNELS ); computeIntensityVector_enc( diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 89a97ea0b0..9939384c76 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -132,11 +132,7 @@ ivas_error ivas_enc( /* bypass EVS coding in float precision, emulating EVS encoder/decoder delay */ for ( i = 0; i < n; i++ ) { -#ifndef SBA_MODE_CLEAN_UP - if ( ( ivas_format == SBA_FORMAT ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) && !( st_ivas->sba_analysis_order > 1 ) ) -#else if ( ( ivas_format == SBA_FORMAT ) && !( st_ivas->sba_analysis_order > 1 ) ) -#endif { hp20( data_f[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } @@ -221,22 +217,8 @@ ivas_error ivas_enc( /* SBA/MASA metadata encoding and SBA/MASA metadata bitstream writing */ hMetaData = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData : st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->hQMetaData != NULL && ivas_format != SBA_FORMAT ) -#endif { -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_format == SBA_FORMAT ) - { - ivas_dirac_enc( st_ivas->hDirAC, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], hEncoderConfig->Opt_DTX_ON, data_f, input_frame, hEncoderConfig->sba_planar ); - - ivas_dirac_enc_spar_delay_synchro( st_ivas, input_frame, data_f ); - } - else - { -#endif ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { @@ -247,15 +229,8 @@ ivas_error ivas_enc( { return error; } -#ifndef SBA_MODE_CLEAN_UP - } -#endif } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( ivas_format == SBA_FORMAT ) -#endif { if ( ( error = ivas_spar_enc( st_ivas, data_f, input_frame, nb_bits_metadata, hMetaData ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 5591b12f40..e1f6d72493 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -355,14 +355,8 @@ ivas_error ivas_init_encoder( /* In IVAS, ensure that minimum coded bandwidth is WB */ hEncoderConfig->max_bwidth = max( hEncoderConfig->max_bwidth, WB ); } -#ifndef SBA_MODE_CLEAN_UP - hEncoderConfig->spar_reconfig_flag = 0; -#endif st_ivas->ism_mode = ISM_MODE_NONE; st_ivas->mc_mode = MC_MODE_NONE; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = SBA_MODE_NONE; -#endif st_ivas->nchan_transport = -1; @@ -517,23 +511,13 @@ ivas_error ivas_init_encoder( if ( ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = ivas_sba_mode_select(); -#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { -#endif if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } -#ifndef SBA_MODE_CLEAN_UP - } -#endif if ( ( error = ivas_dirac_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -564,11 +548,7 @@ ivas_error ivas_init_encoder( reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); #endif -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->hEncoderConfig->Opt_DTX_ON ) -#else if ( ivas_format == SBA_FORMAT && st_ivas->hEncoderConfig->Opt_DTX_ON ) -#endif { st_ivas->hSCE[sce_id]->hCoreCoder[0]->dtx_sce_sba = 1; } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 24038448d9..572a0f1802 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -299,13 +299,8 @@ ivas_error ivas_param_ism_enc_open( /* set FB config. */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, SBA_MODE_NONE, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 3044eb8bf6..0307d3f61d 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -392,11 +392,7 @@ ivas_error ivas_masa_encode( free( h_orig_metadata ); -#ifndef SBA_MODE_CLEAN_UP - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, masa_sid_descriptor, ivas_format, SBA_MODE_NONE ); -#else ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, masa_sid_descriptor, ivas_format ); -#endif /* restore old values */ hMasa->config.numCodingBands = numCodingBands; diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index ba746ff442..2af0ee3c04 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -140,13 +140,8 @@ ivas_error ivas_param_mc_enc_open( hParamMC->dmx_factors = ivas_param_mc_conf[config_index].dmx_fac; /* set FB config. */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, SBA_MODE_DIRAC, nchan_inp, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, nchan_inp, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index b328223d77..500065c347 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -184,13 +184,8 @@ ivas_error ivas_mc_paramupmix_enc_open( /* set FB config. */ /* need to set num output channels to a value > 0 to get pFb != NULL */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, SBA_MODE_SPAR, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 09fe5e3f40..398b975705 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -188,13 +188,8 @@ ivas_error ivas_mcmasa_enc_open( } /* set FB config. */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MASA_FORMAT, SBA_MODE_NONE, numAnalysisChannels, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, MASA_FORMAT, numAnalysisChannels, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -225,13 +220,8 @@ ivas_error ivas_mcmasa_enc_open( else { /* Allocate and initialize FB mixer handle for LFE channel */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfgLfe, MASA_FORMAT, SBA_MODE_NONE, 1, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfgLfe, MASA_FORMAT, 1, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -987,12 +977,8 @@ void ivas_mcmasa_param_est_enc( reference_power[ts], 0, num_freq_bands, -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE_NONE, -#else MC_FORMAT, 0, -#endif FOA_CHANNELS ); /* Fill buffers of length "averaging_length" time slots for intensity and energy */ diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 378bcb6910..9bd4b4132c 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -60,11 +60,7 @@ static ivas_error ivas_mc_enc_reconfig( Encoder_Struct *st_ivas, const int16_t l static void set_mct_enc_params( MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#else const IVAS_FORMAT ivas_format, /* i : IVAS_FORMAT */ -#endif const uint16_t b_nchan_change /* i : flag indicating different channel count */ ) { @@ -86,11 +82,7 @@ static void set_mct_enc_params( } hMCT->hbr_mct = 0; -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR && ivas_total_brate >= IVAS_256k ) -#else if ( ivas_format == SBA_FORMAT && ivas_total_brate >= IVAS_256k ) -#endif { hMCT->hbr_mct = 1; } @@ -399,11 +391,7 @@ ivas_error create_mct_enc( * Initializations *-----------------------------------------------------------------*/ -#ifndef SBA_MODE_CLEAN_UP - set_mct_enc_params( hMCT, ivas_total_brate, st_ivas->sba_mode, 1 ); -#else set_mct_enc_params( hMCT, ivas_total_brate, ivas_format, 1 ); -#endif st_ivas->hMCT = hMCT; @@ -569,11 +557,7 @@ ivas_error mct_enc_reconfigure( * Initializations *-----------------------------------------------------------------*/ -#ifndef SBA_MODE_CLEAN_UP - set_mct_enc_params( hMCT, ivas_total_brate, st_ivas->sba_mode, b_nchan_change ); -#else set_mct_enc_params( hMCT, ivas_total_brate, ivas_format, b_nchan_change ); -#endif return IVAS_ERR_OK; } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 4e017dd052..acace009be 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -1006,10 +1006,6 @@ void ivas_qmetadata_enc_sid_encode( IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ const int16_t masa_sid_descriptor, /* i : description of MASA SID coding structure */ const int16_t ivas_format /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ) { int16_t b, m; @@ -1025,21 +1021,8 @@ void ivas_qmetadata_enc_sid_encode( if ( ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ -#ifndef SBA_MODE_CLEAN_UP - } - else - { - /* keep 13.2 and 16.4 SID bitrate as 4.4 kbps for now*/ - /* TODO: still use old sid frame size to keep bitexactness */ - metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; - } -#endif } else { @@ -1078,11 +1061,7 @@ void ivas_qmetadata_enc_sid_encode( /* sanity checks*/ assert( q_metadata->no_directions == 1 && "Qmetadata SID: only one direction supported!" ); -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { assert( ( q_direction->cfg.nbands == DIRAC_DTX_BANDS ) && "Qmetadata SID: only 2 bands supported!" ); } @@ -1091,11 +1070,7 @@ void ivas_qmetadata_enc_sid_encode( assert( ( q_direction->cfg.nbands == 5 ) && "Qmetadata SID: only 5 bands supported!" ); } -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode != SBA_MODE_SPAR ) -#else if ( ivas_format != SBA_FORMAT ) -#endif { /* Signalling 2D*/ push_next_indice( hMetaData, ( q_direction->not_in_2D > 0 ), 1 ); /*2D flag*/ @@ -1232,19 +1207,7 @@ void ivas_qmetadata_enc_sid_encode( #endif /* TODO: temporary to keep BE */ -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_format == SBA_FORMAT ) - { - if ( sba_mode != SBA_MODE_SPAR ) - { - /* keep 13.2 and 16.4 SID bitrate as 4.4 kbps for now*/ - metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - 1; /* -1 for spar/dirac indicator*/ - } - } - else -#else if ( ivas_format != SBA_FORMAT ) -#endif { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } @@ -1272,10 +1235,6 @@ void reset_metadata_spatial( int32_t *total_brate, /* o : total bitrate */ const int32_t core_brate, /* i : core bitrate */ const int16_t nb_bits_metadata /* i : number of meatdata bits */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ) { int16_t i, next_ind_sid, last_ind_sid; @@ -1289,11 +1248,7 @@ void reset_metadata_spatial( { if ( ( ivas_format == SBA_FORMAT || ivas_format == MASA_FORMAT ) && core_brate != FRAME_NO_DATA ) { -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { #ifdef DEBUGGING assert( hMetaData->ind_list[0].nb_bits == 1 ); @@ -1376,11 +1331,7 @@ void reset_metadata_spatial( *total_brate = element_brate; } -#ifndef SBA_MODE_CLEAN_UP - else if ( sba_mode != SBA_MODE_SPAR ) -#else else if ( ivas_format != SBA_FORMAT ) -#endif { /* Reset SID metadata bits*/ while ( hMetaData->nb_bits_tot > nb_bits_metadata ) diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index a1a505f67a..1d6256b021 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -200,17 +200,6 @@ ivas_error ivas_sba_enc_reconfigure( } ivas_spar_config( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); -#ifndef SBA_MODE_CLEAN_UP - for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) - { - if ( hDirAC->sba_synchro_buffer[n] != NULL ) - { - free( hDirAC->sba_synchro_buffer[n] ); - hDirAC->sba_synchro_buffer[n] = NULL; - } - } - hDirAC->num_samples_synchro_delay = 0; -#endif hSpar = st_ivas->hSpar; if ( st_ivas->nchan_transport == 1 ) @@ -237,11 +226,7 @@ ivas_error ivas_sba_enc_reconfigure( return error; } } -#ifndef SBA_MODE_CLEAN_UP - hEncoderConfig->spar_reconfig_flag = spar_reconfig_flag; -#else st_ivas->hSpar->spar_reconfig_flag = spar_reconfig_flag; -#endif if ( ( error = ivas_dirac_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -262,9 +247,6 @@ ivas_error ivas_sba_enc_reconfigure( } } } -#ifndef SBA_MODE_CLEAN_UP - mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); -#endif hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; /*-----------------------------------------------------------------* * Allocate, initialize, and configure SCE/CPE/MCT handles @@ -293,11 +275,7 @@ int16_t ivas_sba_get_max_md_bits( max_bits = 500; } max_md_bits = min( st_ivas->hQMetaData->metadata_max_bits + 1, max_bits ); // TODO: remove 500 once max MD bits has been defined at all bitrates in DirAC -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT ) -#endif { max_md_bits += st_ivas->hSpar->hMdEnc->spar_md_cfg.max_md_bits_spar; } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 87c0e8e9d3..3dde94fd33 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -205,12 +205,8 @@ ivas_error ivas_sce_enc( * Reset metadata *----------------------------------------------------------------*/ -#ifndef SBA_MODE_CLEAN_UP - reset_metadata_spatial( ivas_format, hSCE->hMetaData, hSCE->element_brate, &st->total_brate, st->core_brate, nb_bits_metadata, st_ivas->sba_mode ); -#else reset_metadata_spatial( ivas_format, hSCE->hMetaData, hSCE->element_brate, &st->total_brate, st->core_brate, nb_bits_metadata ); -#endif /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index d9dd0880c5..4fbb34497d 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -84,9 +84,7 @@ ivas_error ivas_spar_enc_open( } } -#ifdef SBA_MODE_CLEAN_UP hSpar->spar_reconfig_flag = 0; -#endif input_Fs = hEncoderConfig->input_Fs; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); nchan_inp = ivas_sba_get_nchan_metadata( sba_order_internal, @@ -126,13 +124,8 @@ ivas_error ivas_spar_enc_open( /* set FB config. */ active_w_mixing = ivas_spar_br_table_consts[table_idx].active_w; -#ifndef SBA_MODE_CLEAN_UP - ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_inp, nchan_transport, active_w_mixing, input_Fs, - nchan_fb_in ); -#else ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, nchan_inp, nchan_transport, active_w_mixing, input_Fs, nchan_fb_in ); -#endif fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; /* FB mixer handle */ @@ -350,34 +343,6 @@ ivas_error ivas_spar_enc( hEncoderConfig = st_ivas->hEncoderConfig; /* check last sba_mode */ -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_sba_mode_select() == SBA_MODE_DIRAC ) - { - Encoder_State *sts[MCT_MAX_BLOCKS]; - - /* initializations */ - for ( int16_t sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - sts[sce_id] = st_ivas->hSCE[sce_id]->hCoreCoder[0]; - } - - for ( int16_t cpe_id = 0, i = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( int16_t ch = 0; ch < CPE_CHANNELS; ch++ ) - { - sts[i] = st_ivas->hCPE[cpe_id]->hCoreCoder[ch]; - i++; - } - } - - /* update FB prior input */ - for ( int16_t i = 0; i < st_ivas->nchan_transport; i++ ) - { - mvr2r( ( sts[i]->input_buff + NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS ) ), - ( st_ivas->hSpar->hFbMixer->ppFilterbank_prior_input[i] + st_ivas->hSpar->hFbMixer->fb_cfg->prior_input_length - input_frame ), input_frame ); - } - } -#endif /* front VAD */ if ( ( error = front_vad_spar( st_ivas->hSpar, data_f[0], hEncoderConfig, input_frame ) ) != IVAS_ERR_OK ) @@ -436,18 +401,10 @@ static ivas_error ivas_spar_enc_process( const int16_t *order; SPAR_ENC_HANDLE hSpar = st_ivas->hSpar; IVAS_QMETADATA_HANDLE hQMetaData = st_ivas->hQMetaData; -#ifndef SBA_MODE_CLEAN_UP - int16_t ts, l_ts, orig_dirac_bands, num_del_samples; -#else int16_t ts, l_ts, num_del_samples; -#endif float *ppIn_FR_real[IVAS_SPAR_MAX_CH], *ppIn_FR_imag[IVAS_SPAR_MAX_CH]; float wyzx_del_buf[FOA_CHANNELS][IVAS_FB_1MS_48K_SAMP]; -#ifndef SBA_MODE_CLEAN_UP - float dir[3], avg_dir[3]; - float energySum, vecLen; -#endif int16_t nchan_fb_in; /*Commented for now*/ @@ -561,94 +518,7 @@ static ivas_error ivas_spar_enc_process( hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); -#ifndef SBA_MODE_CLEAN_UP - ivas_dirac_param_est_enc( st_ivas->hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, st_ivas->sba_mode, hodirac_flag, hodirac_flag ? HOA2_CHANNELS : FOA_CHANNELS ); - - if ( hQMetaData->q_direction->cfg.nbands > 0 ) - { - orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - - if ( dtx_vad == 1 ) - { - /* WB 4TC mode bit : disable for now*/ - push_next_indice( hMetaData, 0, 1 ); - - ivas_qmetadata_enc_encode( hMetaData, hQMetaData, hodirac_flag ); - } - else - { - hQMetaData->q_direction[0].cfg.nbands = DIRAC_DTX_BANDS; - - /* compute directions */ - for ( i = 0; i < hQMetaData->q_direction[0].cfg.nblocks; i++ ) - { - set_zero( dir, 3 ); - set_zero( avg_dir, 3 ); - energySum = 0.0f; - - /* combine all DirAC bands except the last one, handle last band separately, last band covers BW above WB */ - for ( j = 0; j < orig_dirac_bands - 1; j++ ) - { - ivas_qmetadata_azimuth_elevation_to_direction_vector( hQMetaData->q_direction[0].band_data[j].azimuth[i], hQMetaData->q_direction[0].band_data[j].elevation[i], &dir[0] ); - vecLen = hQMetaData->q_direction[0].band_data[j].energy_ratio[i] * st_ivas->hDirAC->buffer_energy[i * orig_dirac_bands + j]; - - avg_dir[0] += dir[0] * vecLen; - avg_dir[1] += dir[1] * vecLen; - avg_dir[2] += dir[2] * vecLen; - - energySum += st_ivas->hDirAC->buffer_energy[i * orig_dirac_bands + j]; - } - - ivas_qmetadata_direction_vector_to_azimuth_elevation( &avg_dir[0], &hQMetaData->q_direction[0].band_data[0].azimuth[i], &hQMetaData->q_direction[0].band_data[0].elevation[i] ); - hQMetaData->q_direction[0].band_data[0].energy_ratio[i] = sqrtf( dotp( avg_dir, avg_dir, 3 ) ) / ( energySum + EPSILON ); - - hQMetaData->q_direction[0].band_data[1].azimuth[i] = hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i]; - hQMetaData->q_direction[0].band_data[1].elevation[i] = hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i]; - hQMetaData->q_direction[0].band_data[1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i]; - } - - /* 1 bit to indicate mode MD coding : temp solution*/ - push_next_indice( hMetaData, 1, 1 ); - - /* encode SID parameters */ - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, st_ivas->sba_mode ); - } - - for ( b = hQMetaData->q_direction->cfg.start_band; b < hQMetaData->q_direction->cfg.nbands; b++ ) - { - for ( i_ts = 0; i_ts < ( ( dtx_vad == 1 ) ? hQMetaData->q_direction[0].cfg.nblocks : 1 ); i_ts++ ) - { - hQMetaData->q_direction->band_data[b].azimuth[i_ts] = hQMetaData->q_direction->band_data[b].q_azimuth[i_ts]; - hQMetaData->q_direction->band_data[b].elevation[i_ts] = hQMetaData->q_direction->band_data[b].q_elevation[i_ts]; - hQMetaData->q_direction[0].band_data[b].energy_ratio[0] = 1.0f - diffuseness_reconstructions[hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0]]; - } - } - - if ( dtx_vad == 0 ) - { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } - } - - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; - } - } -#else ivas_dirac_enc( st_ivas->hDirAC, hQMetaData, hMetaData, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, dtx_vad, hEncoderConfig->ivas_format, hodirac_flag ); -#endif /*-----------------------------------------------------------------------------------------* * Set SPAR bitrates *-----------------------------------------------------------------------------------------*/ @@ -658,11 +528,7 @@ static ivas_error ivas_spar_enc_process( if ( hSpar->hMdEnc->table_idx != table_idx ) { hSpar->hMdEnc->table_idx = table_idx; -#ifndef SBA_MODE_CLEAN_UP - if ( ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) && ( !hEncoderConfig->spar_reconfig_flag ) ) -#else if ( ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) && ( !hSpar->spar_reconfig_flag ) ) -#endif { if ( ( error = ivas_spar_md_enc_init( hSpar->hMdEnc, hEncoderConfig, sba_order ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index fe520a0817..4f2f375af7 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -589,10 +589,6 @@ typedef struct ivas_dirac_enc_data_structure PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ IVAS_FB_MIXER_HANDLE hFbMixer; -#ifndef SBA_MODE_CLEAN_UP - float *sba_synchro_buffer[DIRAC_MAX_ANA_CHANS]; - int16_t num_samples_synchro_delay; -#endif /* DirAC parameter estimation */ float **direction_vector[DIRAC_NUM_DIMS]; @@ -610,9 +606,6 @@ typedef struct ivas_dirac_enc_data_structure float azi_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; float ele_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; -#ifndef SBA_MODE_CLEAN_UP - int16_t dirac_to_spar_md_bands[DIRAC_MAX_NBANDS]; -#endif /* diffuseness */ int16_t index_buffer_intensity; @@ -711,9 +704,7 @@ typedef struct ivas_spar_enc_lib_t FRONT_VAD_ENC_HANDLE hFrontVad; /* front-VAD handle */ ENC_CORE_HANDLE hCoreCoderVAD; /* core-coder handle for front-VAD module */ -#ifdef SBA_MODE_CLEAN_UP int16_t spar_reconfig_flag; -#endif int16_t front_vad_flag; int16_t front_vad_dtx_flag; int16_t force_front_vad; @@ -1119,9 +1110,6 @@ typedef struct encoder_config_structure /* temp. development parameters */ int16_t Opt_PCA_ON; /* flag indicating PCA operation in SBA */ -#ifndef SBA_MODE_CLEAN_UP - int16_t spar_reconfig_flag; - #endif #ifdef DEBUGGING /* debugging options */ int16_t stereo_mode_cmdl; /* stereo mode forced from the command-line */ @@ -1180,9 +1168,6 @@ typedef struct LFE_ENC_HANDLE hLFE; /* LFE data handle */ ISM_MODE ism_mode; /* ISM format mode */ -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE sba_mode; /* SBA format mode */ -#endif MC_MODE mc_mode; /* MC format mode */ /* Stereo downmix for EVS module */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 1fe61ef2bf..544ea32ade 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -197,9 +197,6 @@ ivas_error IVAS_ENC_Open( /* set high-level parameters */ st_ivas->mc_mode = MC_MODE_NONE; st_ivas->ism_mode = ISM_MODE_NONE; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = SBA_MODE_NONE; -#endif st_ivas->sba_analysis_order = 0; return IVAS_ERR_OK; @@ -927,11 +924,7 @@ static ivas_error configureEncoder( } #ifdef DEBUG_AGC_ENCODER_CMD_OPTION -#ifndef SBA_MODE_CLEAN_UP - if ( hEncoderConfig->Opt_AGC_ON == SBA_AGC_FORCE_ENABLE && !( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_sba_mode_select() == SBA_MODE_SPAR ) ) -#else if ( hEncoderConfig->Opt_AGC_ON == SBA_AGC_FORCE_ENABLE && !( hEncoderConfig->ivas_format == SBA_FORMAT ) ) -#endif { return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "AGC supported in SBA format at bitrates >= 24.4 kbps only." ); } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index c520c5631e..03c38b9f49 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -440,11 +440,7 @@ void ivas_dirac_dec_binaural( } ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { ivas_spar_dec_set_render_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); } @@ -636,11 +632,7 @@ static void ivas_dirac_dec_binaural_internal( } } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { st_ivas->hDirAC->hDiffuseDist = &diffuseDistData; @@ -1098,11 +1090,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } else /* When rendering binaural, ambience has frequency dependent ICC. */ { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) -#else if ( st_ivas->ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) -#endif { float diffuseFieldCoherence; diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 0bac2513c0..e879f923a3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2212,9 +2212,6 @@ static ivas_error initMasaDummyDecForMcOut( decDummy->sba_analysis_order = 1; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ -#ifndef SBA_MODE_CLEAN_UP - decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ -#endif decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ ivas_output_init( &( decDummy->hOutSetup ), output_config ); @@ -2297,9 +2294,6 @@ static ivas_error initMasaDummyDecForSbaOut( decDummy->hDecoderConfig->output_config = output_config; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ -#ifndef SBA_MODE_CLEAN_UP - decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ -#endif decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ decDummy->sba_analysis_order = 1; @@ -2373,9 +2367,6 @@ static ivas_error initMasaDummyDecForBinauralOut( decDummy->sba_analysis_order = 1; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ -#ifndef SBA_MODE_CLEAN_UP - decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ -#endif decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ ivas_output_init( &( decDummy->hOutSetup ), output_config ); -- GitLab From 0fe671ec47b7df330bf8cd1a30e25be0dd547349 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:22:38 +0200 Subject: [PATCH 46/53] [cleanup] accept FIX_502_IND_LIST_SIZE --- lib_com/bitstream.c | 36 ------------------------------------ lib_com/options.h | 1 - 2 files changed, 37 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index b4a42e0b2e..84411b49bb 100755 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -803,59 +803,31 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else if ( ivas_total_brate <= IVAS_32k ) { -#ifdef FIX_502_IND_LIST_SIZE return 125; -#else - return 110; -#endif } else if ( ivas_total_brate <= IVAS_48k ) { -#ifdef FIX_502_IND_LIST_SIZE return 205; -#else - return 180; -#endif } else if ( ivas_total_brate <= IVAS_96k ) { -#ifdef FIX_502_IND_LIST_SIZE return 240; -#else - return 200; -#endif } else if ( ivas_total_brate <= IVAS_128k ) { -#ifdef FIX_502_IND_LIST_SIZE return 305; -#else - return 250; -#endif } else if ( ivas_total_brate <= IVAS_160k ) { -#ifdef FIX_502_IND_LIST_SIZE return 425; -#else - return 320; -#endif } else if ( ivas_total_brate <= IVAS_192k ) { -#ifdef FIX_502_IND_LIST_SIZE return 630; -#else - return 430; -#endif } else if ( ivas_total_brate <= IVAS_256k ) { -#ifdef FIX_502_IND_LIST_SIZE return 850; -#else - return 600; -#endif } else if ( ivas_total_brate <= IVAS_384k ) { @@ -863,11 +835,7 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else { -#ifdef FIX_502_IND_LIST_SIZE return 1750; -#else - return 1500; -#endif } } else if ( ivas_format == MC_FORMAT ) @@ -882,11 +850,7 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else if ( ivas_total_brate <= IVAS_64k ) { -#ifdef FIX_502_IND_LIST_SIZE return 210; -#else - return 200; -#endif } else if ( ivas_total_brate <= IVAS_96k ) { diff --git a/lib_com/options.h b/lib_com/options.h index 46bce4c1c8..72122d7930 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,7 +154,6 @@ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ -#define FIX_502_IND_LIST_SIZE /* Fix issue #502: insufficient index buffer sizes */ #define FIX_505_MASA_SPHGRID_REUSE /* Nokia: Fix issue #505: MASA spherical grid reuse fix */ -- GitLab From 1165de2e090c1013e57797795ec657ae239d7ddc Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:23:25 +0200 Subject: [PATCH 47/53] [cleanup] accept FIX_505_MASA_SPHGRID_REUSE --- lib_com/options.h | 1 - lib_enc/ivas_masa_enc.c | 30 ------------------------------ 2 files changed, 31 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 72122d7930..d227d1fd44 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -155,7 +155,6 @@ -#define FIX_505_MASA_SPHGRID_REUSE /* Nokia: Fix issue #505: MASA spherical grid reuse fix */ #define FIX_481_UNUSED_VARIABLES /* Nokia: Fix issue #481: Unused debug variables */ diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 0307d3f61d..55308a448b 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -64,10 +64,8 @@ static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_H static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] , const SPHERICAL_GRID_DATA *sphGrid -#ifdef FIX_505_MASA_SPHGRID_REUSE , const uint8_t useSphGrid -#endif ); static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); @@ -496,9 +494,6 @@ ivas_error ivas_masa_enc_config( uint8_t maxBand; int16_t maxBin, sf; ivas_error error; -#ifndef FIX_505_MASA_SPHGRID_REUSE - SPHERICAL_GRID_DATA *sphGrid; -#endif error = IVAS_ERR_OK; @@ -519,31 +514,12 @@ ivas_error ivas_masa_enc_config( if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) { -#ifndef FIX_505_MASA_SPHGRID_REUSE - if ( ( sphGrid = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA spherical grid\n" ) ); - } - - if ( ivas_total_brate == IVAS_512k ) - { - generate_gridEq( sphGrid ); - } - else - { - sphGrid->no_theta = 0; - } -#endif /* average over sub-frames */ average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy , -#ifdef FIX_505_MASA_SPHGRID_REUSE &( hMasa->data.Sph_Grid16 ), ivas_total_brate == IVAS_512k ? TRUE : FALSE -#else - sphGrid -#endif ); } @@ -1810,10 +1786,8 @@ static void average_masa_metadata( float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] , const SPHERICAL_GRID_DATA *Sph_Grid16 -#ifdef FIX_505_MASA_SPHGRID_REUSE , const uint8_t useSphGrid -#endif ) { int16_t i, j, k; @@ -1861,11 +1835,7 @@ static void average_masa_metadata( j = 0; hMeta->directional_meta[i].azimuth[j][k] = atan2f( y_sum, x_sum ) / EVS_PI * 180.0f; hMeta->directional_meta[i].elevation[j][k] = atan2f( z_sum, sqrtf( x_sum * x_sum + y_sum * y_sum ) ) / EVS_PI * 180.0f; -#ifdef FIX_505_MASA_SPHGRID_REUSE if ( useSphGrid == TRUE ) -#else - if ( Sph_Grid16->no_theta > 0 ) -#endif { hMeta->directional_meta[i].spherical_index[j][k] = index_theta_phi_16( &( hMeta->directional_meta[i].elevation[j][k] ), &( hMeta->directional_meta[i].azimuth[j][k] ), Sph_Grid16 ); -- GitLab From ba18ed9d069ca6a7b91099949126507eb7a00698 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:24:15 +0200 Subject: [PATCH 48/53] [cleanup] accept FIX_481_UNUSED_VARIABLES --- lib_com/options.h | 1 - lib_dec/ivas_qmetadata_dec.c | 40 ------------------------------------ lib_enc/ivas_qmetadata_enc.c | 16 --------------- 3 files changed, 57 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d227d1fd44..e2311ed87c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -156,7 +156,6 @@ -#define FIX_481_UNUSED_VARIABLES /* Nokia: Fix issue #481: Unused debug variables */ #define FIX_483 /* FhG: fix issue 483, division by zero in nois_est */ #define FIX_483b /* FhG: fix issue 483, uninitialized values in ivas_mct_core_enc */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 73043ec78e..d3b66c6523 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -780,22 +780,14 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( ) { int16_t d, b, m; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA int16_t bits_diff_sum; -#endif -#else - int16_t bits_diff_sum; #endif int16_t nbands, start_band; IVAS_QDIRECTION *q_direction; int16_t start_index_0; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA int16_t bits_no_dirs_coh, bits_sur_coherence; -#endif -#else - int16_t bits_no_dirs_coh, bits_sur_coherence; #endif uint16_t all_coherence_zero; int16_t p[MASA_MAXIMUM_CODING_SUBBANDS], dif_p[MASA_MAXIMUM_CODING_SUBBANDS]; @@ -875,24 +867,16 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->q_direction[0].cfg.nbands = codedBands; /*Coherence flag decoding*/ -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh = 0; -#endif -#else - bits_no_dirs_coh = 0; #endif all_coherence_zero = 1; if ( hQMetaData->coherence_flag ) { /* read if coherence is zero */ all_coherence_zero = bitstream[( *index )--]; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += 1; -#endif -#else - bits_no_dirs_coh += 1; #endif } @@ -923,12 +907,8 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( p[b] = p[b - 1] + dif_p[b] + 1; hQMetaData->twoDirBands[p[b]] = 1; } -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += ( d - *index ); -#endif -#else - bits_no_dirs_coh += ( d - *index ); #endif } @@ -940,23 +920,15 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->q_direction[1].cfg.nbands = codedBands; } } -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_diff_sum = -#endif -#else - bits_diff_sum = #endif ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[0] ) ); if ( hQMetaData->no_directions == 2 ) { -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_diff_sum += -#endif -#else - bits_diff_sum += #endif ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); } @@ -1007,23 +979,15 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( if ( all_coherence_zero == 0 ) { -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_sur_coherence = -#endif -#else - bits_sur_coherence = #endif read_surround_coherence_hr( bitstream, index, hQMetaData ); } else { -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_sur_coherence = 0; -#endif -#else - bits_sur_coherence = 0; #endif /*Surround coherence*/ for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) @@ -1034,13 +998,9 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += bits_sur_coherence; #endif -#else - bits_no_dirs_coh += bits_sur_coherence; -#endif for ( d = 0; d < hQMetaData->no_directions; d++ ) { diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index acace009be..d9833ee060 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -740,12 +740,8 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( int16_t nbands, nblocks, start_band; int16_t ndirections, d; int16_t all_coherence_zero; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA int16_t bits_no_dirs_coh; -#endif -#else - int16_t bits_no_dirs_coh; #endif int16_t bits_ec; float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -783,12 +779,8 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( /* Check if coherence should be encoded */ all_coherence_zero = 1; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh = 0; -#endif -#else - bits_no_dirs_coh = 0; #endif if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { @@ -805,24 +797,16 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( { all_coherence_zero = hQMetaData->all_coherence_zero; push_next_indice( hMetaData, all_coherence_zero, 1 ); /* signal coherence */ -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += 1; -#endif -#else - bits_no_dirs_coh += 1; #endif } /* encode 2 direction subbands position */ if ( ndirections == 2 && bits_sph_idx == 11 ) { -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += -#endif -#else - bits_no_dirs_coh += #endif write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); -- GitLab From bbb81c1cf5a9651a9dfdfe020c8e0ce6995773c8 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:25:30 +0200 Subject: [PATCH 49/53] [cleanup] accept FIX_483, FIX_483b --- lib_com/bitstream.c | 4 ---- lib_com/options.h | 2 -- lib_enc/ivas_mct_core_enc.c | 8 -------- lib_enc/ivas_mct_enc_mct.c | 2 -- lib_enc/ivas_stereo_mdct_core_enc.c | 8 -------- lib_enc/ivas_stereo_mdct_stereo_enc.c | 6 ------ lib_enc/nois_est.c | 10 ---------- lib_enc/stat_enc.h | 2 -- 8 files changed, 42 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 84411b49bb..bf588d24dd 100755 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -772,11 +772,7 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else if ( ivas_total_brate <= IVAS_256k ) { -#ifdef FIX_483b return 1050; -#else - return 1000; -#endif } else if ( ivas_total_brate <= IVAS_384k ) { diff --git a/lib_com/options.h b/lib_com/options.h index e2311ed87c..7bd5e60037 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,8 +157,6 @@ -#define FIX_483 /* FhG: fix issue 483, division by zero in nois_est */ -#define FIX_483b /* FhG: fix issue 483, uninitialized values in ivas_mct_core_enc */ #define FIX_506_WARNINGS /* FhG/Eri/Dlb/VA: Issue 508, Warnings on MacOS */ #define FIX_170_DTX_MASA /* Nokia: Fix issue 170, relaxing the use of DTX in MASA format */ #define FIX_296_CFG_LFE_SCENE_DESC /* FhG: Fix issue 296 - add configurable LFE handling to the scene description file */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 40153a3c69..5298e39f39 100755 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -264,10 +264,8 @@ void ivas_mct_core_enc( sp_aud_decision0[i] = hCPE[cpe_id]->hCoreCoder[0]->sp_aud_decision0; -#ifdef FIX_483b sts[i]->hTcxEnc->tns_ms_flag[0] = 0; sts[i]->hTcxEnc->tns_ms_flag[1] = 0; -#endif i++; } @@ -343,11 +341,7 @@ void ivas_mct_core_enc( for ( n = 0; n < nSubframes; n++ ) { -#ifdef FIX_483b if ( sts[ch]->hTcxEnc->tns_ms_flag[n] ) -#else - if ( !sts[ch]->hTcxEnc->fUseTns[n] /*!sts[0]->fUseTns[n] && !sts[1]->fUseTns[n]*/ ) -#endif { /* power spectrum: MDCT^2 + MDST^2 */ for ( i = 0; i < L_subframeTCX; i++ ) @@ -358,9 +352,7 @@ void ivas_mct_core_enc( } else { -#ifdef FIX_483b if ( hMCT->currBlockDataCnt > 0 ) -#endif { /* power spectrum: MDCT^2 + MDST^2 */ powerSpecMsInv[ch][n][0] = inv_spectrum[ch][n][0] * inv_spectrum[ch][n][0]; diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index 50982e2e52..08ed294a56 100755 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -700,9 +700,7 @@ void apply_MCT_enc( { v_multc( sts[ch]->hTcxEnc->spectrum[k], qratio, sts[ch]->hTcxEnc->spectrum[k], L_subframeTCX ); v_multc( mdst_spectrum[ch][k], qratio, mdst_spectrum[ch][k], L_subframeTCX ); -#ifdef FIX_483b set_zero( inv_spectrum[ch][k], L_subframeTCX ); -#endif } hMCT->mc_global_ild[ch] = 0; } diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index c8e3dcfcd4..3c274b149e 100755 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -223,10 +223,8 @@ void stereo_mdct_core_enc( inv_spectrum[ch][1] = quantized_spectrum[ch][1]; mdst_spectrum[ch][0] = mdst_spectrum_long[ch]; mdst_spectrum[ch][1] = mdst_spectrum_long[ch] + N_TCX10_MAX; -#ifdef FIX_483b sts[ch]->hTcxEnc->tns_ms_flag[0] = 0; sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; -#endif } @@ -279,11 +277,7 @@ void stereo_mdct_core_enc( for ( n = 0; n < nSubframes; n++ ) { -#ifdef FIX_483b if ( sts[ch]->hTcxEnc->tns_ms_flag[n] ) -#else - if ( !sts[ch]->hTcxEnc->fUseTns[n] ) -#endif { /* power spectrum: MDCT^2 + MDST^2 */ for ( i = 0; i < L_subframeTCX; i++ ) @@ -294,9 +288,7 @@ void stereo_mdct_core_enc( } else { -#ifdef FIX_483b if ( hStereoMdct->mdct_stereo_mode[n] != SMDCT_DUAL_MONO ) -#endif { /* power spectrum: MDCT^2 + MDST^2 */ powerSpecMsInv[ch][n][0] = inv_spectrum[ch][n][0] * inv_spectrum[ch][n][0]; diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index 97c9ebe7ff..b8ab5398ec 100755 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -430,10 +430,8 @@ void stereo_coder_tcx( if ( !sts[0]->hTcxEnc->fUseTns[k] && !sts[1]->hTcxEnc->fUseTns[k] ) { -#ifdef FIX_483b sts[0]->hTcxEnc->tns_ms_flag[k] = 1; sts[1]->hTcxEnc->tns_ms_flag[k] = 1; -#endif ms_inv_mask_processing( hStereoMdct, sts, ms_mask, k, mdst_spectrum[0][k], mdst_spectrum[1][k], inv_mdst_spectrum[0][k], inv_mdst_spectrum[1][k], -1 ); ms_processing( hStereoMdct, sts, ms_mask, k, mdst_spectrum[0][k], mdst_spectrum[1][k], sfbConf->sfbCnt ); } @@ -563,12 +561,10 @@ void ms_inv_mask_processing( { int16_t sfb; STEREO_MDCT_BAND_PARAMETERS *sfbConf; -#ifdef FIX_483b int16_t nSubframes, L_subframeTCX; nSubframes = ( sts[0]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframeTCX = sts[0]->hTcxEnc->L_frameTCX / nSubframes; -#endif sfbConf = ( sts[0]->core == TCX_20_CORE ) ? &hStereoMdct->stbParamsTCX20 : &hStereoMdct->stbParamsTCX10; if ( sts[0]->last_core == ACELP_CORE ) @@ -593,14 +589,12 @@ void ms_inv_mask_processing( } } -#ifdef FIX_483b /* set rest of inverse spectrum to zero */ if ( L_subframeTCX > sfbConf->sfbOffset[maxSfb] ) { set_zero( &x_inv_0[sfbConf->sfbOffset[maxSfb]], L_subframeTCX - sfbConf->sfbOffset[maxSfb] ); set_zero( &x_inv_1[sfbConf->sfbOffset[maxSfb]], L_subframeTCX - sfbConf->sfbOffset[maxSfb] ); } -#endif return; } diff --git a/lib_enc/nois_est.c b/lib_enc/nois_est.c index bf506cd9db..b35b3612b5 100644 --- a/lib_enc/nois_est.c +++ b/lib_enc/nois_est.c @@ -378,7 +378,6 @@ void noise_est( { if ( st->hSpMusClas != NULL ) { -#ifdef FIX_483 float E; E = mean( lf_E, 8 ); @@ -391,15 +390,6 @@ void noise_est( st->hSpMusClas->ener_RAT = 10.0f * (float) log10( E ); st->hSpMusClas->ener_RAT /= ( Etot + 0.01f ); } -#else - st->hSpMusClas->ener_RAT = 10.0f * (float) log10( mean( lf_E, 8 ) ); - st->hSpMusClas->ener_RAT /= ( Etot + 0.01f ); - - if ( st->hSpMusClas->ener_RAT < 0.0f ) - { - st->hSpMusClas->ener_RAT = 0.0f; - } -#endif if ( st->hSpMusClas->ener_RAT > 1.0 ) { diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 1a5c893dbd..762b8f6066 100755 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1121,9 +1121,7 @@ typedef struct tcx_enc_structure float *acelp_zir; float tcx_target_bits_fac; -#ifdef FIX_483b int16_t tns_ms_flag[2]; -#endif } TCX_ENC_DATA, *TCX_ENC_HANDLE; /*----------------------------------------------------------------------------------* -- GitLab From a1d47617e5ef25af540ec5f62c5f77763a98156c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:26:07 +0200 Subject: [PATCH 50/53] [cleanup] accept FIX_170_DTX_MASA --- lib_com/options.h | 1 - lib_enc/lib_enc.c | 7 ------- 2 files changed, 8 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 7bd5e60037..c0301db0e3 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -158,7 +158,6 @@ #define FIX_506_WARNINGS /* FhG/Eri/Dlb/VA: Issue 508, Warnings on MacOS */ -#define FIX_170_DTX_MASA /* Nokia: Fix issue 170, relaxing the use of DTX in MASA format */ #define FIX_296_CFG_LFE_SCENE_DESC /* FhG: Fix issue 296 - add configurable LFE handling to the scene description file */ #define FIX_510 /* FhG: fix issue 510, misleading error message for invalid input format */ #define FIX_509 /* FhG: fix issue 509, too low number of bitsream indices in SBA */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 544ea32ade..28a733d3a3 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -908,17 +908,10 @@ static ivas_error configureEncoder( return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "8kHz input sampling rate is not supported in IVAS." ); } -#ifdef FIX_170_DTX_MASA if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && ( ( 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 ) ) -#else - if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && - ( ( 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 ) || - hEncoderConfig->ivas_format == MC_FORMAT ) ) -#endif { return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." ); } -- GitLab From 75a3bf0e2eb0127d6361e0fd838695141b3cfee7 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:27:25 +0200 Subject: [PATCH 51/53] [cleanup] accept FIX_509 --- lib_com/bitstream.c | 8 -------- lib_com/ivas_error.h | 4 ---- lib_com/options.h | 2 -- lib_dec/lib_dec.c | 4 ---- 4 files changed, 18 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index bf588d24dd..81b734b400 100755 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -776,19 +776,11 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else if ( ivas_total_brate <= IVAS_384k ) { -#ifdef FIX_509 return 2000; -#else - return 1500; -#endif } else { -#ifdef FIX_509 return 2500; -#else - return 2000; -#endif } } else if ( ivas_format == MASA_FORMAT ) diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 56e09c558d..0fae8ff215 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -235,11 +235,7 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; case IVAS_ERR_INVALID_INPUT_FORMAT: -#ifdef FIX_510 return "Invalid input format"; -#else - return "Invalid format of input bitstream"; -#endif case IVAS_ERR_INVALID_INDEX: return "Invalid index"; default: diff --git a/lib_com/options.h b/lib_com/options.h index c0301db0e3..33adbd6eb6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,8 +159,6 @@ #define FIX_506_WARNINGS /* FhG/Eri/Dlb/VA: Issue 508, Warnings on MacOS */ #define FIX_296_CFG_LFE_SCENE_DESC /* FhG: Fix issue 296 - add configurable LFE handling to the scene description file */ -#define FIX_510 /* FhG: fix issue 510, misleading error message for invalid input format */ -#define FIX_509 /* FhG: fix issue 509, too low number of bitsream indices in SBA */ #define FIX_519_JBM_ACCESS_NULL_TC_BUFFER /* FhG: fix issue 519, accessing a yet uninitialized TC Buffer in frame 0*/ #ifdef IND_LIST_DYN #define FIX_545_ASSERT /* VA: fix issue 545, replace assert() with warning message when hitting memory limit in the buffer of indices */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 09cf754979..2ee010a43f 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2927,11 +2927,7 @@ static ivas_error input_format_API_to_internal( *sdp_hf_only = 1; break; default: -#ifdef FIX_510 return IVAS_ERR_INVALID_BITSTREAM; -#else - return IVAS_ERR_INVALID_INPUT_FORMAT; -#endif break; } -- GitLab From 94844670c3df25ddf217edde83fbfe25c44c2996 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:35:15 +0200 Subject: [PATCH 52/53] formatting --- apps/decoder.c | 3 +- apps/renderer.c | 3 +- lib_com/ivas_cov_smooth.c | 5 +- lib_com/ivas_dirac_com.c | 126 +++++----- lib_com/ivas_fb_mixer.c | 10 +- lib_com/ivas_masa_com.c | 11 +- lib_com/ivas_spar_com.c | 3 +- lib_com/ivas_td_decorr.c | 6 +- lib_com/ivas_tools.c | 2 +- lib_com/options.h | 7 - lib_dec/ivas_binRenderer_internal.c | 16 +- lib_dec/ivas_cpe_dec.c | 6 +- lib_dec/ivas_dec.c | 8 +- lib_dec/ivas_dirac_dec.c | 202 ++++++++------- lib_dec/ivas_dirac_output_synthesis_cov.c | 22 +- lib_dec/ivas_dirac_output_synthesis_dec.c | 7 +- lib_dec/ivas_init_dec.c | 72 +++--- lib_dec/ivas_ism_dec.c | 3 +- lib_dec/ivas_ism_param_dec.c | 1 - lib_dec/ivas_ism_renderer.c | 4 +- lib_dec/ivas_jbm_dec.c | 1 - lib_dec/ivas_masa_dec.c | 13 +- lib_dec/ivas_mc_param_dec.c | 42 ++-- lib_dec/ivas_objectRenderer_internal.c | 4 +- lib_dec/ivas_out_setup_conversion.c | 6 +- lib_dec/ivas_qmetadata_dec.c | 73 ++---- lib_dec/ivas_sba_dirac_stereo_dec.c | 6 +- lib_dec/ivas_sba_rendering_internal.c | 20 +- lib_dec/ivas_spar_decoder.c | 249 +++++++++---------- lib_dec/ivas_spar_md_dec.c | 6 +- lib_dec/ivas_stat_dec.h | 24 +- lib_dec/ivas_stereo_dft_dec.c | 6 +- lib_dec/jbm_pcmdsp_apa.c | 11 +- lib_dec/lib_dec.c | 27 +- lib_enc/ivas_cpe_enc.c | 6 +- lib_enc/ivas_dirac_enc.c | 8 +- lib_enc/ivas_enc.c | 20 +- lib_enc/ivas_enc_cov_handler.c | 2 +- lib_enc/ivas_entropy_coder.c | 30 +-- lib_enc/ivas_init_enc.c | 8 +- lib_enc/ivas_masa_enc.c | 22 +- lib_enc/ivas_mct_enc.c | 4 +- lib_enc/ivas_qmetadata_enc.c | 71 ++---- lib_enc/ivas_qspherical_enc.c | 3 +- lib_enc/ivas_spar_encoder.c | 6 +- lib_enc/ivas_spar_md_enc.c | 3 +- lib_enc/ivas_stereo_dft_enc.c | 6 +- lib_enc/ivas_stereo_dft_enc_itd.c | 4 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 2 - lib_rend/ivas_limiter.c | 8 +- lib_rend/ivas_objectRenderer.c | 18 +- lib_rend/ivas_objectRenderer_sources.c | 3 +- lib_rend/ivas_orient_trk.c | 2 +- lib_rend/ivas_reverb.c | 14 +- lib_rend/ivas_rotation.c | 26 +- lib_rend/lib_rend.c | 8 +- lib_util/masa_file_reader.c | 2 - 57 files changed, 575 insertions(+), 706 deletions(-) mode change 100755 => 100644 lib_dec/ivas_cpe_dec.c mode change 100755 => 100644 lib_dec/ivas_dirac_output_synthesis_dec.c mode change 100755 => 100644 lib_dec/ivas_spar_decoder.c mode change 100755 => 100644 lib_dec/ivas_spar_md_dec.c diff --git a/apps/decoder.c b/apps/decoder.c index db3aad3740..fd659b74ae 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2255,8 +2255,7 @@ static ivas_error decodeVoIP( /* decode and get samples */ - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms - , + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, &nSamplesAvailableNext #ifdef SUPPORT_JBM_TRACEFILE , diff --git a/apps/renderer.c b/apps/renderer.c index 640899679b..d285499e22 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1467,8 +1467,7 @@ static bool parseDiegeticPan( static bool parseOrientationTracking( char *value, - int8_t *orientation_tracking -) + int8_t *orientation_tracking ) { to_upper( value ); diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index b466351e02..430e33e343 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -51,8 +51,7 @@ static void ivas_set_up_cov_smoothing( ivas_cov_smooth_state_t *hCovState, ivas_filterbank_t *pFb, const float max_update_rate, - const int16_t min_pool_size - , + const int16_t min_pool_size, const COV_SMOOTHING_TYPE smooth_mode /* i : flag multichannel vs SPAR */ , const int32_t ivas_total_brate ) @@ -154,7 +153,7 @@ ivas_error ivas_spar_covar_smooth_enc_open( const int16_t nchan_inp /* i : number of input channels */ , COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_cov_smooth_state_t *hCovState; diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index e799d42c56..1cd2aa3ab9 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -180,20 +180,20 @@ ivas_error ivas_dirac_config( } - hConfig->dec_param_estim = TRUE; - if ( hConfig->dec_param_estim == TRUE ) - { - hConfig->enc_param_start_band = spar_dirac_split_band; - } + hConfig->dec_param_estim = TRUE; + if ( hConfig->dec_param_estim == TRUE ) + { + hConfig->enc_param_start_band = spar_dirac_split_band; + } - if ( ivas_get_hodirac_flag( ivas_total_brate, sba_order ) ) - { - hConfig->dec_param_estim = FALSE; - hConfig->enc_param_start_band = 0; + if ( ivas_get_hodirac_flag( ivas_total_brate, sba_order ) ) + { + hConfig->dec_param_estim = FALSE; + hConfig->enc_param_start_band = 0; - set_c( (int8_t *) hQMetaData->twoDirBands, (int8_t) 1, hQMetaData->q_direction[0].cfg.nbands ); - hQMetaData->numTwoDirBands = (uint8_t) hQMetaData->q_direction[0].cfg.nbands; - } + set_c( (int8_t *) hQMetaData->twoDirBands, (int8_t) 1, hQMetaData->q_direction[0].cfg.nbands ); + hQMetaData->numTwoDirBands = (uint8_t) hQMetaData->q_direction[0].cfg.nbands; + } } if ( ivas_format == SBA_FORMAT ) @@ -383,10 +383,10 @@ void ivas_get_dirac_sba_max_md_bits( ivas_error ivas_dirac_sba_config( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - int16_t *element_mode, /* i/o: element mode of the core coder */ - int32_t sba_total_brate, /* i : SBA total bitrate */ - const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const int16_t nbands /* i : number of frequency bands */ + int16_t *element_mode, /* i/o: element mode of the core coder */ + int32_t sba_total_brate, /* i : SBA total bitrate */ + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int16_t nbands /* i : number of frequency bands */ ) { int16_t nbands_coded; @@ -397,65 +397,65 @@ ivas_error ivas_dirac_sba_config( hQMetaData->is_masa_ivas_format = 0; hodirac_flag = ivas_get_hodirac_flag( sba_total_brate, sba_order ); - /* map the bitrate for SID frame */ - if ( sba_total_brate == IVAS_SID_5k2 ) - { - if ( *element_mode == IVAS_SCE ) - { - sba_total_brate = ACELP_24k40; - } - else - { - sba_total_brate = ACELP_48k; - } - } - - ivas_set_qmetadata_maxbit_req( hQMetaData, SBA_FORMAT ); - - if ( sba_total_brate <= IVAS_16k4 ) + /* map the bitrate for SID frame */ + if ( sba_total_brate == IVAS_SID_5k2 ) + { + if ( *element_mode == IVAS_SCE ) { - hQMetaData->useLowerRes = 1; + sba_total_brate = ACELP_24k40; } else { - hQMetaData->useLowerRes = 0; + sba_total_brate = ACELP_48k; } + } + + ivas_set_qmetadata_maxbit_req( hQMetaData, SBA_FORMAT ); + + if ( sba_total_brate <= IVAS_16k4 ) + { + hQMetaData->useLowerRes = 1; + } + else + { + hQMetaData->useLowerRes = 0; + } - nbands_coded = nbands; - if ( sba_total_brate <= (int32_t) ( (float) IVAS_192k / (float) SPAR_DIRAC_SPLIT_START_BAND ) ) + nbands_coded = nbands; + if ( sba_total_brate <= (int32_t) ( (float) IVAS_192k / (float) SPAR_DIRAC_SPLIT_START_BAND ) ) + { + hQMetaData->useLowerBandRes = 1; + nbands_coded = nbands / 2 + nbands % 2; + } + else + { + hQMetaData->useLowerBandRes = 0; + if ( hodirac_flag == 0 ) { - hQMetaData->useLowerBandRes = 1; - nbands_coded = nbands / 2 + nbands % 2; + nbands_coded = nbands - 1; /* always combine the last two bands */ } - else + } + + { + int16_t no_dirs = 1; + if ( hodirac_flag ) { - hQMetaData->useLowerBandRes = 0; - if ( hodirac_flag == 0 ) - { - nbands_coded = nbands - 1; /* always combine the last two bands */ - } + no_dirs = 2; } + if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, nbands_coded, no_dirs, 0 ) ) != IVAS_ERR_OK ) { - int16_t no_dirs = 1; - if ( hodirac_flag ) - { - no_dirs = 2; - } - - if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, nbands_coded, no_dirs, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } - ivas_get_dirac_sba_max_md_bits( - sba_total_brate, - &hQMetaData->bits_frame_nominal, - &hQMetaData->metadata_max_bits, - &hQMetaData->qmetadata_max_bit_req, - hQMetaData->q_direction[0].cfg.nbands ); - - return error; + } + ivas_get_dirac_sba_max_md_bits( + sba_total_brate, + &hQMetaData->bits_frame_nominal, + &hQMetaData->metadata_max_bits, + &hQMetaData->qmetadata_max_bit_req, + hQMetaData->q_direction[0].cfg.nbands ); + + return error; } @@ -691,7 +691,7 @@ void deindex_spherical_component( *-----------------------------------------------------------------*/ void calculate_hodirac_sector_parameters( - DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ + DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector (L+1)^2 x N_bins, real part */ float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector, imaginary part */ const float beta, /* i : forgetting factor for average filtering */ diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index c9edff81db..4dd3c588e4 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -99,8 +99,8 @@ static int16_t ivas_get_num_bands( *---------------------------------------------------------------------*/ ivas_error ivas_fb_set_cfg( - IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ - const int16_t ivas_format, /* i : IVAS format */ + IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ + const int16_t ivas_format, /* i : IVAS format */ const int16_t num_in_chans, /* i : number of FB input channels */ const int16_t num_out_chans, /* i : number of FB output channels */ const int16_t active_w_mixing, /* i : active_w_mixing flag */ @@ -134,9 +134,9 @@ ivas_error ivas_fb_set_cfg( { pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS ); - pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_4_NS ); - pFb_cfg->prior_input_length = NS2SA( sampling_rate, FRAME_SIZE_NS ); - pFb_cfg->windowed_fr_offset = (int16_t) ( (float) ( sampling_rate / FRAMES_PER_SEC ) * 3.0f / 4.0f ) - NS2SA( sampling_rate, DELAY_DIRAC_SPAR_ENC_CMP_NS ); + pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_4_NS ); + pFb_cfg->prior_input_length = NS2SA( sampling_rate, FRAME_SIZE_NS ); + pFb_cfg->windowed_fr_offset = (int16_t) ( (float) ( sampling_rate / FRAMES_PER_SEC ) * 3.0f / 4.0f ) - NS2SA( sampling_rate, DELAY_DIRAC_SPAR_ENC_CMP_NS ); } else if ( ivas_format == MASA_FORMAT ) { diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index a962e45a81..8c821d99fd 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -62,7 +62,6 @@ static int16_t quantize_theta_masa( float x, const int16_t no_cb, float *xhat ); static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *phi_hat, const int16_t n ); - /*--------------------------------------------------------------- * ivas_masa_setup() * @@ -321,11 +320,11 @@ void ivas_masa_set_coding_config( *---------------------------------------------------------------*/ void masa_sample_rate_band_correction( - MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ - int16_t *band_mapping, /* i/o: Band mapping used and modified */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ - const uint8_t maxBand, /* i : max band */ - uint8_t is_encoder, /* i: signals if called at encoder */ + MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ + int16_t *band_mapping, /* i/o: Band mapping used and modified */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ + const uint8_t maxBand, /* i : max band */ + uint8_t is_encoder, /* i: signals if called at encoder */ MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ) { diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 8be61ea768..d00b802cd7 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -2130,8 +2130,7 @@ void ivas_spar_set_bitrate_config( const int16_t dirac2spar_md_flag, const int16_t enc_flag, const int16_t pca_flag, - const int16_t agc_flag -) + const int16_t agc_flag ) { int32_t ivas_total_brate; int16_t i, total_bits, max_bits, code, length; diff --git a/lib_com/ivas_td_decorr.c b/lib_com/ivas_td_decorr.c index afba0c3d24..4bf813ac35 100644 --- a/lib_com/ivas_td_decorr.c +++ b/lib_com/ivas_td_decorr.c @@ -469,9 +469,9 @@ static void ivas_td_decorr_APD_sections( void ivas_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */ - float *pcm_in[], /* i : input audio channels */ - float **ppOut_pcm, /* o : output audio channels */ - const int16_t output_frame /* i : output frame length */ + float *pcm_in[], /* i : input audio channels */ + float **ppOut_pcm, /* o : output audio channels */ + const int16_t output_frame /* i : output frame length */ ) { int16_t i, j; diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index b7fe5821e3..45c87e4ff5 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -122,7 +122,7 @@ void mvc2c( /*! r: number of clipped samples */ uint32_t ivas_syn_output( - float *synth[], /* i/o: float synthesis signal */ + float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ int16_t *synth_out /* o : integer 16 bits synthesis signal */ diff --git a/lib_com/options.h b/lib_com/options.h index 33adbd6eb6..1098f65a05 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,14 +149,7 @@ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ - - #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ - - - - - #define FIX_506_WARNINGS /* FhG/Eri/Dlb/VA: Issue 508, Warnings on MacOS */ #define FIX_296_CFG_LFE_SCENE_DESC /* FhG: Fix issue 296 - add configurable LFE handling to the scene description file */ #define FIX_519_JBM_ACCESS_NULL_TC_BUFFER /* FhG: fix issue 519, accessing a yet uninitialized TC Buffer in frame 0*/ diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index bac1a69d56..2e0c4f7829 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -59,8 +59,8 @@ static void ivas_binRenderer_filterModule( float out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : imag part of Binaural signals */ float CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : real part of LS signals */ float CLDFB_imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : imag part of LS signals */ - const int16_t numTimeSlots, /* i : number of time slots to process */ - BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ + const int16_t numTimeSlots, /* i : number of time slots to process */ + BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { int16_t bandIdx, k, chIdx, tapIdx; @@ -945,8 +945,8 @@ void ivas_binRenderer_close( void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ - float *input_f[], /* i : transport channels */ - float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ + float *input_f[], /* i : transport channels */ + float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ ) { int16_t render_lfe, idx_lfe; @@ -993,7 +993,7 @@ void ivas_binaural_add_LFE( void ivas_binaural_cldfb( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -1161,9 +1161,9 @@ void ivas_binaural_cldfb_sf( *-------------------------------------------------------------------------*/ void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ - const int16_t numTimeSlots, /* i : number of time slots to render*/ + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ + const int16_t numTimeSlots, /* i : number of time slots to render*/ float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c old mode 100755 new mode 100644 index f0d550649d..948b475c74 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -405,10 +405,8 @@ ivas_error ivas_cpe_dec( } else { - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 - , - MAX_PARAM_SPATIAL_SUBFRAMES - ); + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, + MAX_PARAM_SPATIAL_SUBFRAMES ); } /* synthesis iFFT */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 5c34af0a36..e53e11037e 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -276,10 +276,10 @@ ivas_error ivas_dec( { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; - if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) + { + return error; + } } else if ( st_ivas->ivas_format == SBA_FORMAT ) { diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 0b795ddd31..098aa348eb 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -1010,7 +1010,6 @@ ivas_error ivas_dirac_dec_config( { hDirAC->render_to_md_map[map_idx] = map_idx; } - } else if ( st_ivas->ivas_format == MASA_FORMAT ) { @@ -1028,16 +1027,16 @@ ivas_error ivas_dirac_dec_config( int16_t num_slots_in_subfr; num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; #ifdef FIX_393_459_460_SBA_MD - hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); - hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; - hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; + hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); + hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; + hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; #else hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ) * num_slots_in_subfr; hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; #endif - hDirAC->dirac_read_idx = 0; - hDirAC->dirac_estimator_idx = 0; + hDirAC->dirac_read_idx = 0; + hDirAC->dirac_estimator_idx = 0; set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); #ifdef FIX_393_459_460_SBA_MD @@ -1699,8 +1698,8 @@ void ivas_dirac_dec_read_BS( DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata */ int16_t *nb_bits, /* o : number of bits read */ - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t i, j, b, dir, orig_dirac_bands; @@ -1717,38 +1716,38 @@ void ivas_dirac_dec_read_BS( if ( b == 1 ) /* WB 4TCs condition, no other metadata to read*/ { - orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; + orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - hQMetaData->sba_inactive_mode = 1; + hQMetaData->sba_inactive_mode = 1; - /* if we start with a SID frame, we need to init the azi/ele arrays.*/ - if ( st->ini_frame == 0 ) + /* if we start with a SID frame, we need to init the azi/ele arrays.*/ + if ( st->ini_frame == 0 ) + { + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { - for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) - { - set_zero( hQMetaData->q_direction[0].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[0].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - } + set_zero( hQMetaData->q_direction[0].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); + set_zero( hQMetaData->q_direction[0].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); } + } *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; + } + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + for ( j = orig_dirac_bands - 2; j >= 0; j-- ) { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } + hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; + hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; + hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; } + } - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; + hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; } else { @@ -1799,23 +1798,23 @@ void ivas_dirac_dec_read_BS( } *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; + } + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + for ( j = orig_dirac_bands - 2; j >= 0; j-- ) { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } + hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; + hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; + hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; } + } - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; + hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; st->next_bit_pos = next_bit_pos_orig; } @@ -1842,9 +1841,9 @@ void ivas_qmetadata_to_dirac( DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t block, band; @@ -2490,12 +2489,11 @@ void ivas_dirac_dec_render( *------------------------------------------------------------------------*/ void ivas_dirac_dec_render_sf( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] -) + float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) { int16_t i, ch, idx_in, idx_lfe; DIRAC_DEC_HANDLE hDirAC; @@ -2629,8 +2627,7 @@ void ivas_dirac_dec_render_sf( set_zero( onset_filter_subframe, hDirAC->num_freq_bands ); } - if ( st_ivas->hHeadTrackData - ) + if ( st_ivas->hHeadTrackData ) { QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); @@ -2645,10 +2642,10 @@ void ivas_dirac_dec_render_sf( rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); } #else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - rotateAziEle_DirAC( azimuth[slot_idx], elevation[slot_idx], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); - } + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + rotateAziEle_DirAC( azimuth[slot_idx], elevation[slot_idx], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); + } #endif } } @@ -2939,8 +2936,6 @@ void ivas_dirac_dec_render_sf( diffuseness_vector[slot_idx] #endif ); - - } #ifdef DEBUG_MODE_DIRAC @@ -3062,52 +3057,52 @@ void ivas_dirac_dec_render_sf( } /*Compute PSDs*/ - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, + if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) + { + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, #ifdef FIX_393_459_460_SBA_MD - azimuth, - elevation, - hDirAC->diffuseness_vector[md_idx], + azimuth, + elevation, + hDirAC->diffuseness_vector[md_idx], #else - azimuth[slot_idx], - elevation[slot_idx], - diffuseness_vector[slot_idx], + azimuth[slot_idx], + elevation[slot_idx], + diffuseness_vector[slot_idx], #endif - hDirAC, - st_ivas->hHeadTrackData->shd_rot_max_order, - p_Rmat, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag - - ); - } - else - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, + hDirAC, + st_ivas->hHeadTrackData->shd_rot_max_order, + p_Rmat, + st_ivas->hVBAPdata, + hDirAC->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag + + ); + } + else + { + ivas_dirac_dec_output_synthesis_process_slot( reference_power, + p_onset_filter, #ifdef FIX_393_459_460_SBA_MD - azimuth, - elevation, - hDirAC->diffuseness_vector[md_idx], + azimuth, + elevation, + hDirAC->diffuseness_vector[md_idx], #else - azimuth[slot_idx], - elevation[slot_idx], - diffuseness_vector[slot_idx], + azimuth[slot_idx], + elevation[slot_idx], + diffuseness_vector[slot_idx], #endif - hDirAC, - 0, - 0, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag ); - } + hDirAC, + 0, + 0, + st_ivas->hVBAPdata, + hDirAC->hOutSetup, + nchan_transport, + md_idx, + hodirac_flag ); + } #ifdef FIX_393_459_460_SBA_MD if ( hDirAC->hConfig->dec_param_estim ) @@ -3121,7 +3116,6 @@ void ivas_dirac_dec_render_sf( { v_add( reference_power, reference_power_smooth, reference_power_smooth, hDirAC->num_freq_bands ); } - } ivas_dirac_dec_output_synthesis_get_interpolator( &hDirAC->h_output_synthesis_psd_params, hDirAC->subframe_nbslots[subframe_idx] ); @@ -3177,7 +3171,7 @@ void ivas_dirac_dec_render_sf( #ifdef FIX_393_459_460_SBA_MD diffuseness_vector, #else - md_idx, + md_idx, #endif hodirac_flag ); } @@ -3388,9 +3382,9 @@ void ivas_dirac_dec_render_sf( hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; hDirAC->subframes_rendered++; -pop_wmops(); + pop_wmops(); -return; + return; } diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index cc08a6faca..d71d816557 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -307,8 +307,8 @@ void ivas_dirac_dec_output_synthesis_cov_close( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( - float *RealBuffer, /* i : input channel filter bank samples (real part) */ - float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ + float *RealBuffer, /* i : input channel filter bank samples (real part) */ + float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ @@ -362,17 +362,17 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( - float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ - float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ + float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ + float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ - float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ - float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ - const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ - const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ - const int16_t nX, /* i : number of input channels */ - const int16_t nY, /* i : number of output channels */ - PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ + float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ + float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ + const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const int16_t nX, /* i : number of input channels */ + const int16_t nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ ) { int16_t param_band_idx, band, ch_idx; diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c old mode 100755 new mode 100644 index 7bdaea9d3c..61682fca44 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -546,8 +546,7 @@ void ivas_dirac_dec_output_synthesis_process_slot( const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ const int16_t nchan_transport /* i : number of transport channels*/ , - const int16_t md_idx - , + const int16_t md_idx, const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { @@ -775,7 +774,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t nbslots, /* i : number of slots to process */ + const int16_t nbslots, /* i : number of slots to process */ const float *onset_filter, #ifdef FIX_393_459_460_SBA_MD float *diffuseness, @@ -1232,7 +1231,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ - const int16_t nbslots, /* i : number of slots to process */ + const int16_t nbslots, /* i : number of slots to process */ #ifdef FIX_393_459_460_SBA_MD float *diffuseness_vector, #else diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d4699a7273..0f0365d437 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -853,55 +853,55 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->ivas_format == SBA_FORMAT ) { - if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) + { + if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } + } - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) - { - if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( ( error = ivas_dirac_sba_config( + st_ivas->hQMetaData, + &st_ivas->element_mode_init, + ivas_total_brate, + st_ivas->sba_analysis_order, + ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = ivas_dirac_sba_config( - st_ivas->hQMetaData, - &st_ivas->element_mode_init, - ivas_total_brate, - st_ivas->sba_analysis_order, - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) + { + if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } - if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + } + else + { + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; - } - else + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) { - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; + st_ivas->hSpar->enc_param_start_band = 0; - st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) - { - st_ivas->hSpar->enc_param_start_band = 0; - - set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); - st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; - } - - 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 ); + set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); + st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); + + 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 ); + } + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); } if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 3276d9488d..1ee468dc80 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -359,8 +359,7 @@ ivas_error ivas_ism_dec_config( const ISM_MODE last_ism_mode /* i/o: last ISM mode */ , uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ - int16_t *data -) + int16_t *data ) { int32_t ivas_total_brate; ivas_error error; diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 3a9d7f625c..1e28d2ea34 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -286,7 +286,6 @@ static void ivas_param_ism_compute_mixing_matrix( } - static void ivas_param_ism_render_slot( DIRAC_DEC_HANDLE hDirAC, float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX], diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 915b545a59..c6ca4b3b7b 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -109,8 +109,8 @@ ivas_error ivas_ism_renderer_open( *-------------------------------------------------------------------------*/ void ivas_ism_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output_f[], /* i/o: core-coder transport channels/object output */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t output_frame /* i : output frame length per channel */ ) { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index a0dd0aad18..fd0375e7be 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -46,7 +46,6 @@ #include "wmc_auto.h" - /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 87ddae3a5c..45f56875ff 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -195,17 +195,13 @@ ivas_error ivas_masa_decode( { if ( ivas_total_brate >= IVAS_512k ) { - *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 16, 4 - , - hMasa->config.numCodingBands - ); + *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 16, 4, + hMasa->config.numCodingBands ); } else { - *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 11, 3 - , - hMasa->config.numCodingBands - ); + *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 11, 3, + hMasa->config.numCodingBands ); } } else @@ -1114,7 +1110,6 @@ ivas_error ivas_masa_dec_reconfigure( } - void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 32c332ec53..2745481402 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -631,9 +631,9 @@ ivas_error ivas_param_mc_dec_reconfig( #endif } - /*-----------------------------------------------------------------* - * set input parameters - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; @@ -1923,11 +1923,11 @@ static void ivas_param_mc_dec_init( *------------------------------------------------------------------------*/ static void param_mc_protoSignalComputation( - float *RealBuffer, /* i : CLDFB samples of the transport channels (real part) */ - float *ImagBuffer, /* i : CLDFB samples of the transport channels (imaginary part) */ + float *RealBuffer, /* i : CLDFB samples of the transport channels (real part) */ + float *ImagBuffer, /* i : CLDFB samples of the transport channels (imaginary part) */ float *proto_frame_f, /* o : interleaved complex prototype CLDFB samples */ const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, /* i : prototype generation information */ - const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ + const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ ) { int16_t band; @@ -2203,12 +2203,12 @@ static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ - float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ - float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ - const int16_t nY_intern, /* i : number of channels in the transported format */ - const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ - const int16_t nX, /* i : number of transport channels */ - const int16_t nY_cov /* i : number of covariance synthesis output channels */ + float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ + float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ + const int16_t nY_intern, /* i : number of channels in the transported format */ + const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ + const int16_t nX, /* i : number of transport channels */ + const int16_t nY_cov /* i : number of covariance synthesis output channels */ ) { int16_t param_band_idx; @@ -2457,11 +2457,11 @@ static void ivas_param_mc_get_mixing_matrices( static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : transport channel covariance for all parameter bands */ - float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ - float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ - const int16_t nY_intern, /* i : number of channels of the transport format */ - const int16_t nX, /* i : number of transport channels */ - const int16_t nY_cov ) /* i : number of output channels */ + float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ + float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ + const int16_t nY_intern, /* i : number of channels of the transport format */ + const int16_t nX, /* i : number of transport channels */ + const int16_t nY_cov ) /* i : number of output channels */ { int16_t param_band_idx; float Cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -2577,10 +2577,10 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: Parametric MC handle */ - float *mixing_matrix[], /* i : direct mixing matrices for the frame just processed */ - float *mixing_matrix_res[], /* i : residual mixing matrices for the frame just processed */ - const uint16_t nX, /* i : number of transport channels */ - const uint16_t nY ) /* i : number of synthesis channels */ + float *mixing_matrix[], /* i : direct mixing matrices for the frame just processed */ + float *mixing_matrix_res[], /* i : residual mixing matrices for the frame just processed */ + const uint16_t nX, /* i : number of transport channels */ + const uint16_t nY ) /* i : number of synthesis channels */ { uint16_t param_band_idx; diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 363fedaca2..df210f2f8a 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -66,8 +66,8 @@ ivas_error ivas_td_binaural_open( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float *output[], /* i/o: SCE channels / Binaural synthesis */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ) { diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index ae113204aa..153764c98a 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -498,8 +498,8 @@ void ivas_ls_setup_conversion( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ const int16_t input_chans, /* i : number of input channels to the renderer */ const int16_t output_frame, /* i : frame length */ - float *input[], /* i : LS input/output synthesis signal */ - float *output[] /* i/o: LS input/output synthesis signal */ + float *input[], /* i : LS input/output synthesis signal */ + float *output[] /* i/o: LS input/output synthesis signal */ ) { int16_t chInIdx, chOutIdx, idx; @@ -1159,7 +1159,7 @@ void ivas_lssetupconversion_process_param_mc( set_s( channel_active, 0, outChannels ); -/* Loop over each time slots and compute dmx for each time slot */ + /* Loop over each time slots and compute dmx for each time slot */ for ( slotIdx = 0; slotIdx < num_timeslots; slotIdx++ ) { /* copy buffers */ diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index d3b66c6523..d3ecf47b52 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -49,15 +49,9 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness( uint16_t *bitstream, i static int16_t ivas_qmetadata_entropy_decode_df_ratio( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction, int16_t *dfRatio_bits ); -static int16_t ivas_qmetadata_entropy_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band - , - const int16_t hrmasa_flag -); +static int16_t ivas_qmetadata_entropy_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t hrmasa_flag ); -static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const int16_t nbands, const int16_t start_band - , - const int16_t hrmasa_flag -); +static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const int16_t nbands, const int16_t start_band, const int16_t hrmasa_flag ); static uint16_t ivas_qmetadata_DecodeQuasiUniform( const uint16_t *bitstream, int16_t *index, const uint16_t alphabet_size ); @@ -83,17 +77,11 @@ static int16_t read_truncGR_azimuth( uint16_t *bitstream, IVAS_QDIRECTION *q_dir static ivas_error read_huf( int16_t *num_bits_read, const uint16_t *bitstream, uint16_t *out, const int16_t start_pos, const int16_t len, const int16_t *huff_code, const int16_t max_len ); -static int16_t read_coherence_data( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir - , - const int16_t hrmasa_flag -); +static int16_t read_coherence_data( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir, const int16_t hrmasa_flag ); static int16_t read_surround_coherence( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData ); -static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, int16_t idx_d, const int16_t no_frames - , - const int16_t hrmasa_flag -); +static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, int16_t idx_d, const int16_t no_frames, const int16_t hrmasa_flag ); static void decode_combined_index( uint64_t comb_index, const int16_t *no_cv_vec, uint16_t *index, const int16_t len ); @@ -452,10 +440,8 @@ int16_t ivas_qmetadata_dec_decode( if ( all_coherence_zero == 0 ) { - bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d - , - 0 - ); + bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d, + 0 ); } else { @@ -503,17 +489,13 @@ int16_t ivas_qmetadata_dec_decode( if ( raw_flag[0] == 0 ) { - bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band - , - 0 - ); + bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band, + 0 ); } else { - bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band - , - 0 - ); + bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band, + 0 ); } } /* Decode quantized directions band-wise */ @@ -533,10 +515,8 @@ int16_t ivas_qmetadata_dec_decode( { if ( raw_flag[b] == 0 ) { - bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b - , - 0 - ); + bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b, + 0 ); } else { @@ -580,10 +560,8 @@ int16_t ivas_qmetadata_dec_decode( { if ( raw_flag[b] ) { - bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b - , - 0 - ); + bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b, + 0 ); } } } @@ -617,10 +595,8 @@ int16_t ivas_qmetadata_dec_decode( { if ( nblocks > 1 ) { - decode_spread_coherence( hQMetaData, d, nblocks - , - 0 - ); + decode_spread_coherence( hQMetaData, d, nblocks, + 0 ); } } else @@ -774,10 +750,8 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( int16_t *index, /* i/o: bitstream position */ const SPHERICAL_GRID_DATA *sph_grid16, /* i : spherical grid for deindexing */ const int16_t bits_sph_idx, - const int16_t bits_sp_coh - , - uint8_t ncoding_bands_config -) + const int16_t bits_sp_coh, + uint8_t ncoding_bands_config ) { int16_t d, b, m; #ifdef DEBUG_MODE_QMETADATA @@ -1170,7 +1144,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } - /*-----------------------------------------------------------------------* * ivas_qmetadata_dec_sid_decode() * @@ -1215,8 +1188,8 @@ int16_t ivas_qmetadata_dec_sid_decode( if ( ivas_format == SBA_FORMAT ) { - /* TODO: still use old sid frame size to keep bitexactness */ - metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ + /* TODO: still use old sid frame size to keep bitexactness */ + metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ } else { @@ -1780,8 +1753,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir( int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, - const int16_t start_band - , + const int16_t start_band, const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ ) { @@ -2195,8 +2167,7 @@ static int16_t ivas_qmetadata_raw_decode_dir( uint16_t *bitstream, /* i : bitstream */ int16_t *index, const int16_t nbands, - const int16_t start_band - , + const int16_t start_band, const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ ) { diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index f96fdb694a..aca7ce78f9 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -885,10 +885,8 @@ void ivas_sba_dirac_stereo_dec( stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, - st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport - , - ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) - ); + st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 5415609d80..17d231a6d3 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -65,8 +65,8 @@ void ivas_sba2mc_cldfb( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ const int16_t nb_channels_out, /* i : nb of output channels */ const int16_t nb_bands, /* i : nb of CLDFB bands to process */ - const int16_t nb_timeslots, /* i : number of time slots to process */ - const float *hoa_dec_mtx /* i : HOA decoding mtx */ + const int16_t nb_timeslots, /* i : number of time slots to process */ + const float *hoa_dec_mtx /* i : HOA decoding mtx */ ) { int16_t iBlock, iBand, n, m; @@ -137,11 +137,11 @@ void ivas_sba2mc_cldfb( void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ - float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ - float *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const float gain_lfe /* i : gain for LFE, 0 = ignore LFE */ + float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ + float *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const float gain_lfe /* i : gain for LFE, 0 = ignore LFE */ ) { int16_t i, j, k; @@ -273,7 +273,7 @@ int16_t ivas_sba_remapTCs( *-------------------------------------------------------------------------*/ void ivas_ism2sba( - float *buffer_td[], /* i/o: TD signal buffers */ + float *buffer_td[], /* i/o: TD signal buffers */ ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ const int16_t nchan_ism, /* i : number of objects */ @@ -429,7 +429,7 @@ void ivas_sba_upmixer_renderer( *-------------------------------------------------------------------*/ static void ivas_sba_mtx_mult( - float *output_f[], /* i/o: synthesized core-corder transport channels/DirAC output */ + float *output_f[], /* i/o: synthesized core-corder transport channels/DirAC output */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : Number of ambisonic channels */ const IVAS_OUTPUT_SETUP output_setup, /* i : Output configuration */ @@ -489,7 +489,7 @@ static void ivas_sba_mtx_mult( *-------------------------------------------------------------------*/ ivas_error ivas_sba_linear_renderer( - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : number of input ambisonics channels */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c old mode 100755 new mode 100644 index df0bb993da..d7b3aba54f --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -1555,187 +1555,186 @@ void ivas_spar_dec_upmixer_sf( ivas_spar_dump_signal_wav( output_frame, p_tc, NULL, numch_in, spar_foa_dec_wav[4], "ivas_spar_upmixer()" ); #endif - /* CLDFB analysis of incoming frame */ - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + /* CLDFB analysis of incoming frame */ + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + { + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) - { - cldfbAnalysis_ts( - &p_tc[in_ch][ts * num_cldfb_bands], - cldfb_in_ts_re[in_ch][ts], - cldfb_in_ts_im[in_ch][ts], - num_cldfb_bands, - st_ivas->cldfbAnaDec[in_ch] ); - } + cldfbAnalysis_ts( + &p_tc[in_ch][ts * num_cldfb_bands], + cldfb_in_ts_re[in_ch][ts], + cldfb_in_ts_im[in_ch][ts], + num_cldfb_bands, + st_ivas->cldfbAnaDec[in_ch] ); } + } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) - { - ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf ); - } + if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) + { + ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf ); + } - for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) + { + md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; + ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); + if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) { - md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; - ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) + for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { - for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - mixer_mat[out_ch][in_ch][spar_band] = ( 1 - hSpar->hMdDec->smooth_fac[spar_band] ) * mixer_mat[out_ch][in_ch][spar_band] + hSpar->hMdDec->smooth_fac[spar_band] * hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band]; - hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band] = mixer_mat[out_ch][in_ch][spar_band]; - } + mixer_mat[out_ch][in_ch][spar_band] = ( 1 - hSpar->hMdDec->smooth_fac[spar_band] ) * mixer_mat[out_ch][in_ch][spar_band] + hSpar->hMdDec->smooth_fac[spar_band] * hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band]; + hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band] = mixer_mat[out_ch][in_ch][spar_band]; } } } + } + + for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) + { + float out_re[IVAS_SPAR_MAX_CH]; + float out_im[IVAS_SPAR_MAX_CH]; + float cldfb_par; + ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; - for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { - float out_re[IVAS_SPAR_MAX_CH]; - float out_im[IVAS_SPAR_MAX_CH]; - float cldfb_par; - ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; + out_re[out_ch] = 0.0f; + out_im[out_ch] = 0.0f; - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - out_re[out_ch] = 0.0f; - out_im[out_ch] = 0.0f; - - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + if ( b_skip_mat[out_ch][in_ch] == 0 ) { - if ( b_skip_mat[out_ch][in_ch] == 0 ) + if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ { - if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ - { - spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; - cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; - } - else + spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; + cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; + } + else + { + cldfb_par = 0.0f; + for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) { - cldfb_par = 0.0f; - for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) - { - /* accumulate contributions from all SPAR bands */ - cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; - } + /* accumulate contributions from all SPAR bands */ + cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; } - - out_re[out_ch] += cldfb_in_ts_re[in_ch][ts][cldfb_band] * cldfb_par; - out_im[out_ch] += cldfb_in_ts_im[in_ch][ts][cldfb_band] * cldfb_par; } + + out_re[out_ch] += cldfb_in_ts_re[in_ch][ts][cldfb_band] * cldfb_par; + out_im[out_ch] += cldfb_in_ts_im[in_ch][ts][cldfb_band] * cldfb_par; } } + } - /*update CLDFB data with the parameter-modified data*/ - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) - { - cldfb_in_ts_re[out_ch][ts][cldfb_band] = out_re[out_ch]; - cldfb_in_ts_im[out_ch][ts][cldfb_band] = out_im[out_ch]; - } + /*update CLDFB data with the parameter-modified data*/ + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + cldfb_in_ts_re[out_ch][ts][cldfb_band] = out_re[out_ch]; + cldfb_in_ts_im[out_ch][ts][cldfb_band] = out_im[out_ch]; } + } - if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) + if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) + { + /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ + int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; + split_band = SPAR_DIRAC_SPLIT_START_BAND; + md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? md_sf : 0; + if ( split_band < IVAS_MAX_NUM_BANDS ) { - /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ - int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; - split_band = SPAR_DIRAC_SPLIT_START_BAND; - md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? md_sf : 0; - if ( split_band < IVAS_MAX_NUM_BANDS ) - { - mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + for ( b = 0; b < num_spar_bands; b++ ) { - for ( b = 0; b < num_spar_bands; b++ ) - { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; - } + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; } } - hSpar->i_subframe++; - hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); } + hSpar->i_subframe++; + hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); } } + } - if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) - { - ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); - } + if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) + { + ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); + } - if ( st_ivas->hDirAC != NULL ) - { - int16_t outchannels, idx_in, idx_lfe, ch; - idx_in = 0; - idx_lfe = 0; + if ( st_ivas->hDirAC != NULL ) + { + int16_t outchannels, idx_in, idx_lfe, ch; + idx_in = 0; + idx_lfe = 0; - outchannels = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - for ( ch = 0; ch < outchannels; ch++ ) + outchannels = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( st_ivas->hOutSetup.num_lfe > 0 ) && ( st_ivas->hOutSetup.index_lfe[idx_lfe] == ch ) ) { - if ( ( st_ivas->hOutSetup.num_lfe > 0 ) && ( st_ivas->hOutSetup.index_lfe[idx_lfe] == ch ) ) + set_zero( output[ch], hSpar->subframe_nbslots[hSpar->subframes_rendered] * num_cldfb_bands ); + if ( idx_lfe < ( st_ivas->hDirAC->hOutSetup.num_lfe - 1 ) ) { - set_zero( output[ch], hSpar->subframe_nbslots[hSpar->subframes_rendered] * num_cldfb_bands ); - if ( idx_lfe < ( st_ivas->hDirAC->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } + idx_lfe++; } - else + } + else + { + if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { - if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) - { - cldfbSynthesis( - &cldfb_in_ts_re[idx_in][ts], - &cldfb_in_ts_im[idx_in][ts], - &output[ch][ts * num_cldfb_bands], - num_cldfb_bands, - st_ivas->cldfbSynDec[idx_in] ); - } + cldfbSynthesis( + &cldfb_in_ts_re[idx_in][ts], + &cldfb_in_ts_im[idx_in][ts], + &output[ch][ts * num_cldfb_bands], + num_cldfb_bands, + st_ivas->cldfbSynDec[idx_in] ); } - idx_in++; } + idx_in++; } + } #ifdef DEBUG_SBA_AUDIO_DUMP - hSpar->numOutChannels = outchannels; + hSpar->numOutChannels = outchannels; #endif - } - else + } + else + { + /* CLDFB to time synthesis (overwrite mixer output) */ + for ( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { - /* CLDFB to time synthesis (overwrite mixer output) */ - for ( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) - { - cldfbSynthesis( - &cldfb_in_ts_re[out_ch][ts], - &cldfb_in_ts_im[out_ch][ts], - &output[out_ch][ts * num_cldfb_bands], - num_cldfb_bands, - st_ivas->cldfbSynDec[out_ch] ); - } + cldfbSynthesis( + &cldfb_in_ts_re[out_ch][ts], + &cldfb_in_ts_im[out_ch][ts], + &output[out_ch][ts * num_cldfb_bands], + num_cldfb_bands, + st_ivas->cldfbSynDec[out_ch] ); } + } #ifdef DEBUG_SBA_AUDIO_DUMP - hSpar->numOutChannels = numch_out_dirac; + hSpar->numOutChannels = numch_out_dirac; #endif - } + } #ifdef DEBUG_SBA_AUDIO_DUMP - /* Dump audio signal after cldfbSynthesis */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, hSpar->numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); + /* Dump audio signal after cldfbSynthesis */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, hSpar->numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); #endif - hSpar->slots_rendered += hSpar->subframe_nbslots[hSpar->subframes_rendered]; hSpar->subframes_rendered++; diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c old mode 100755 new mode 100644 index dc76babe9c..9ef40b928e --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -486,11 +486,9 @@ ivas_error ivas_spar_md_dec_init( ivas_sba_get_spar_hoa_ch_ind( num_channels, hDecoderConfig->ivas_total_brate, hMdDec->HOA_md_ind ); hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, hMdDec->spar_md.num_bands - , + ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, hMdDec->spar_md.num_bands, hMdDec->spar_hoa_dirac2spar_md_flag, - 0, 0, 0 - ); + 0, 0, 0 ); nchan_transport = hMdDec->spar_md_cfg.nchan_transport; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index bb96d8bcba..ba8f573364 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1174,19 +1174,19 @@ typedef struct ivas_masa_decoder_struct typedef struct decoder_config_structure { - int32_t ivas_total_brate; /* IVAS total bitrate in bps */ - int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ - int32_t output_Fs; /* output signal sampling frequency in Hz */ - int16_t nchan_out; /* number of output audio channels */ - AUDIO_CONFIG output_config; /* output audio configuration */ - int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ - int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ - int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ - int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ + int32_t ivas_total_brate; /* IVAS total bitrate in bps */ + int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ + int32_t output_Fs; /* output signal sampling frequency in Hz */ + int16_t nchan_out; /* number of output audio channels */ + AUDIO_CONFIG output_config; /* output audio configuration */ + int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ + int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ + int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ + int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */ - int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ - float non_diegetic_pan_gain; /* non diegetic panning gain*/ - int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ + int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ + float non_diegetic_pan_gain; /* non diegetic panning gain*/ + int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ /* temp. development parameters */ #ifdef DEBUGGING diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index de232e8fa8..08caff6233 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1210,10 +1210,8 @@ void stereo_dft_dec( ivas_sba_dirac_stereo_smooth_parameters( hStereoDft, hMdDec, cross_fade_start_offset, - output_Fs - , - num_md_sub_frames - ); + output_Fs, + num_md_sub_frames ); } else { diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 89d6cb3e59..1242004fc8 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -553,12 +553,12 @@ bool apa_exit( ******************************************************************************** */ uint8_t apa_exec( - apa_state_t *ps, /* i/o: state struct */ - const float a_in[], /* i : input samples */ + apa_state_t *ps, /* i/o: state struct */ + const float a_in[], /* i : input samples */ uint16_t l_in, /* i : number of input samples */ uint16_t maxScaling, /* i : allowed number of inserted/removed samples */ - float a_out[], /* o : output samples */ - uint16_t *l_out /* o : number of output samples */ + float a_out[], /* o : output samples */ + uint16_t *l_out /* o : number of output samples */ ) { uint16_t i; @@ -1179,8 +1179,7 @@ static bool shrink_frm( xtract -= ps->l_ts; } } - else - if ( maxScaling != 0U && s_end > maxScaling + 1 ) + else if ( maxScaling != 0U && s_end > maxScaling + 1 ) { xtract = maxScaling; } diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 2ee010a43f..673c030abf 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -55,7 +55,7 @@ struct IVAS_DEC_VOIP JB4_HANDLE hJBM; PCMDSP_APA_HANDLE hTimeScaler; uint16_t lastDecodedWasActive; - float *apaExecBuffer; /* Buffer for APA scaling */ + float *apaExecBuffer; /* Buffer for APA scaling */ JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ uint16_t *bs_conversion_buf; /* Buffer for bitstream conversion from packed to serial */ #ifdef VARIABLE_SPEED_DECODING @@ -398,17 +398,17 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ - const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ - const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const uint32_t sampleRate, /* i : output sampling frequency */ + const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ + const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ + const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ + const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ const HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ - const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ - const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ - const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ - const int16_t delayCompensationEnabled /* i : enable delay compensation */ + const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ + const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ + const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ + const int16_t delayCompensationEnabled /* i : enable delay compensation */ ) { Decoder_Struct *st_ivas; @@ -516,7 +516,6 @@ ivas_error IVAS_DEC_EnableVoIP( if ( hDecoderConfig->output_config != AUDIO_CONFIG_EXTERNAL ) { hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); - } #ifdef VARIABLE_SPEED_DECODING else @@ -1926,7 +1925,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { return error; } - } #ifdef VARIABLE_SPEED_DECODING @@ -2171,8 +2169,7 @@ ivas_error IVAS_DEC_VoIP_Flush( bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ , - const int16_t nSamplesAsked -) + const int16_t nSamplesAsked ) { return ( ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 ) && ( hIvasDec->hVoIP->nSamplesAvailableNext < nSamplesAsked ) ); } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 6bea810953..50be346797 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -333,10 +333,8 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode == IVAS_CPE_DFT ) { - stereo_dft_hybrid_ITD_flag( hCPE->hStereoDft->hConfig, input_Fs - , - hCPE->hStereoDft->hItd->hybrid_itd_max - ); + stereo_dft_hybrid_ITD_flag( hCPE->hStereoDft->hConfig, input_Fs, + hCPE->hStereoDft->hItd->hybrid_itd_max ); /* Time Domain ITD compensation using extrapolation */ #ifdef DEBUG_MODE_DFT diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index f364137bdf..70cbbb2043 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -96,7 +96,7 @@ ivas_error ivas_dirac_enc_open( } /* set FB config. */ - hDirAC->hFbMixer = NULL; + hDirAC->hFbMixer = NULL; for ( i = 0; i < DIRAC_MAX_NBANDS + 1; i++ ) { @@ -161,7 +161,7 @@ ivas_error ivas_dirac_enc_open( hDirAC->index_buffer_intensity = 0; st_ivas->hDirAC = hDirAC; - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; return error; } @@ -401,8 +401,8 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ - const IVAS_FORMAT ivas_format, /* i : ivas_format */ - int16_t ref_power_w /* i : use 0 if hodirac is enabled */ + const IVAS_FORMAT ivas_format, /* i : ivas_format */ + int16_t ref_power_w /* i : use 0 if hodirac is enabled */ , const int16_t nchan_ana /* i : number of analysis channels */ ) diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 9939384c76..66942eaec3 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -219,16 +219,16 @@ ivas_error ivas_enc( if ( st_ivas->hQMetaData != NULL && ivas_format != SBA_FORMAT ) { - ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ - if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - 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 ) - { - return error; - } + ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ + if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + 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 ) + { + return error; + } } else if ( ivas_format == SBA_FORMAT ) { diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 40db2d4f75..b40b9d1e42 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -69,7 +69,7 @@ ivas_error ivas_spar_covar_enc_open( const int16_t nchan_inp /* i : number of input channels */ , COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_enc_cov_handler_state_t *hCovState; diff --git a/lib_enc/ivas_entropy_coder.c b/lib_enc/ivas_entropy_coder.c index 02f3f1bea2..32e55d85b7 100644 --- a/lib_enc/ivas_entropy_coder.c +++ b/lib_enc/ivas_entropy_coder.c @@ -132,10 +132,8 @@ static int16_t ivas_arith_encode_array( int16_t *pInput, ivas_arith_t *pArith, BSTR_ENC_HANDLE hMetaData, - const int16_t in_len - , - int32_t wc_strat_arith -) + const int16_t in_len, + int32_t wc_strat_arith ) { int16_t model_index, i, ind; int16_t *pCum_freq = NULL; @@ -190,10 +188,8 @@ static int16_t ivas_arithCoder_encode_array_diff( int16_t *pIn_new, int16_t *pIn_old_scratch, const int16_t length, - BSTR_ENC_HANDLE hMetaData - , - int32_t wc_strat_arith -) + BSTR_ENC_HANDLE hMetaData, + int32_t wc_strat_arith ) { int16_t n; int16_t arith_result; @@ -253,10 +249,8 @@ static int16_t arith_encode_cell_array( BSTR_ENC_HANDLE hMetaData, const int16_t nB, ivas_arith_t *pArith, - int16_t *pSymbol - , - int32_t wc_strat_arith -) + int16_t *pSymbol, + int32_t wc_strat_arith ) { int16_t total_symbol_len = 0; int16_t i; @@ -297,10 +291,8 @@ static int16_t arith_encode_cell_array_diff( int16_t nB, ivas_arith_t *pArith_diff, int16_t *pSymbol_old, - int16_t *pSymbol - , - int32_t wc_strat_arith -) + int16_t *pSymbol, + int32_t wc_strat_arith ) { int16_t i, total_symbol_len; int16_t arith_result; @@ -344,10 +336,8 @@ int16_t ivas_arith_encode_cmplx_cell_array( int16_t *pSymbol_old_re, ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, - const int16_t any_diff - , - int32_t wc_strat_arith -) + const int16_t any_diff, + int32_t wc_strat_arith ) { int16_t input_old[IVAS_MAX_INPUT_LEN]; int16_t input_new[IVAS_MAX_INPUT_LEN]; diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index e1f6d72493..a69cc2d9fc 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -513,10 +513,10 @@ ivas_error ivas_init_encoder( { st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); - if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } + if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } if ( ( error = ivas_dirac_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 55308a448b..802654c02c 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -61,12 +61,7 @@ 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 ); -static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] - , - const SPHERICAL_GRID_DATA *sphGrid - , - const uint8_t useSphGrid -); +static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const SPHERICAL_GRID_DATA *sphGrid, const uint8_t useSphGrid ); static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); @@ -516,11 +511,9 @@ ivas_error ivas_masa_enc_config( { /* average over sub-frames */ - average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy - , + average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy, &( hMasa->data.Sph_Grid16 ), - ivas_total_brate == IVAS_512k ? TRUE : FALSE - ); + ivas_total_brate == IVAS_512k ? TRUE : FALSE ); } /* Inspect metadata for parameter changes that affect coding. */ @@ -1783,12 +1776,9 @@ void ivas_masa_enc_reconfigure( static void average_masa_metadata( MASA_METADATA_FRAME *hMeta, - float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] - , - const SPHERICAL_GRID_DATA *Sph_Grid16 - , - const uint8_t useSphGrid -) + float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + const SPHERICAL_GRID_DATA *Sph_Grid16, + const uint8_t useSphGrid ) { int16_t i, j, k; float azi_rad, ele_rad; diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 9bd4b4132c..20f5c9da29 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -60,8 +60,8 @@ static ivas_error ivas_mc_enc_reconfig( Encoder_Struct *st_ivas, const int16_t l static void set_mct_enc_params( MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS_FORMAT */ - const uint16_t b_nchan_change /* i : flag indicating different channel count */ + const IVAS_FORMAT ivas_format, /* i : IVAS_FORMAT */ + const uint16_t b_nchan_change /* i : flag indicating different channel count */ ) { int16_t n; diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index d9833ee060..26f46e943f 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -60,10 +60,7 @@ static void ivas_qmetadata_reorder_2dir_bands( IVAS_QMETADATA_HANDLE hQMetaData static int16_t ivas_qmetadata_entropy_encode_df_ratio( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, int16_t *df_ratio_bits ); -static int16_t ivas_qmetadata_entropy_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, int16_t max_bits - , - const int16_t hrmasa_flag -); +static int16_t ivas_qmetadata_entropy_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, int16_t max_bits, const int16_t hrmasa_flag ); static int16_t ivas_qmetadata_raw_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t nbands, const int16_t start_band ); @@ -91,17 +88,11 @@ static ivas_error write_ec_direction( int16_t *num_bits_written, BSTR_ENC_HANDLE static int16_t write_fixed_rate_direction( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t j_idx, const int16_t len ); -static int16_t ivas_qmetadata_quantize_coherence( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t write_flag, int16_t *indice_coherence - , - const int16_t hrmasa_flag -); +static int16_t ivas_qmetadata_quantize_coherence( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t write_flag, int16_t *indice_coherence, const int16_t hrmasa_flag ); static void dct4_transform( uint8_t *v, float *dct_v ); -static float quantize_DCT_0_coh( const float x, const int16_t j, const float *coherence_cb, const float delta_var, const int16_t no_cb, IVAS_QDIRECTION *q_direction, uint16_t *idx_x, int16_t *p_no_cb - , - const int16_t hrmasa_flag -); +static float quantize_DCT_0_coh( const float x, const int16_t j, const float *coherence_cb, const float delta_var, const int16_t no_cb, IVAS_QDIRECTION *q_direction, uint16_t *idx_x, int16_t *p_no_cb, const int16_t hrmasa_flag ); static int16_t encode_coherence_indexesDCT0( uint16_t *idx_dct, const int16_t len, int16_t *no_cb_vec, BSTR_ENC_HANDLE hMetaData, const int16_t indice_coherence, const int16_t nbits, const int16_t nbits1 ); @@ -415,10 +406,8 @@ ivas_error ivas_qmetadata_enc_encode( if ( all_coherence_zero == 0 ) { - bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence - , - 0 - ); + bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence, + 0 ); } if ( q_direction->cfg.mc_ls_setup == MC_LS_SETUP_5_1 || q_direction->cfg.mc_ls_setup == MC_LS_SETUP_7_1 ) @@ -430,10 +419,8 @@ ivas_error ivas_qmetadata_enc_encode( else { /* Quantize directions*/ - quantize_direction_frame( q_direction, azimuth_orig, elevation_orig - , - 0 - ); + quantize_direction_frame( q_direction, azimuth_orig, elevation_orig, + 0 ); } /* Signalling 2D*/ @@ -467,10 +454,8 @@ ivas_error ivas_qmetadata_enc_encode( reduce_bits = hQMetaData->is_masa_ivas_format ? ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) - 1 ) : MASA_MAX_BITS; bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, - q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits - , - 0 - ); + q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits, + 0 ); if ( bits_ec < 0 ) { @@ -524,10 +509,8 @@ ivas_error ivas_qmetadata_enc_encode( bits_dir_bands[i] = ivas_qmetadata_raw_encode_dir( NULL, q_direction, i + 1, i ); /* Write ec bits */ - bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS - , - 0 - ); + bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS, + 0 ); if ( bits_ec >= 0 ) { @@ -630,10 +613,8 @@ ivas_error ivas_qmetadata_enc_encode( { bit_pos_start = hMetaData->nb_bits_tot; hMetaData->nb_bits_tot = bit_pos_start_coh; - ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence - , - 0 - ); + ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence, + 0 ); hMetaData->nb_bits_tot = bit_pos_start; } @@ -1005,8 +986,8 @@ void ivas_qmetadata_enc_sid_encode( if ( ivas_format == SBA_FORMAT ) { - /* TODO: still use old sid frame size to keep bitexactness */ - metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ + /* TODO: still use old sid frame size to keep bitexactness */ + metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ } else { @@ -2487,10 +2468,8 @@ static int16_t ivas_qmetadata_entropy_encode_dir( const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, - int16_t max_bits - , - const int16_t hrmasa_flag -) + int16_t max_bits, + const int16_t hrmasa_flag ) { uint16_t diff_idx_min; int16_t i, j; @@ -5346,7 +5325,6 @@ static int16_t encode_surround_coherence_hr( } - /*-------------------------------------------------------------------* * quantize_DCT_0_coh() * @@ -5583,8 +5561,7 @@ static int16_t ivas_qmetadata_quantize_coherence( const int16_t all_coherence_zero, /* i : all coherence is zero - flag */ BSTR_ENC_HANDLE hMetaData, /* i : metadata handle */ const int16_t write_flag, /* i : flag to actually write the data or not */ - int16_t *indice_coherence - , + int16_t *indice_coherence, const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ ) { @@ -5613,10 +5590,8 @@ static int16_t ivas_qmetadata_quantize_coherence( if ( hQMetaData->q_direction[idx_d].cfg.nblocks == 1 ) { - nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData - , - hrmasa_flag - ); + nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData, + hrmasa_flag ); return nbits; } @@ -5685,10 +5660,8 @@ static int16_t ivas_qmetadata_quantize_coherence( if ( write_flag ) { /* quantize first DCT parameter */ - dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j] - , - hrmasa_flag - ); + dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j], + hrmasa_flag ); } if ( coding_subbands < coding_subbands_0 ) diff --git a/lib_enc/ivas_qspherical_enc.c b/lib_enc/ivas_qspherical_enc.c index 00ca0f1cd6..e79c0a01a7 100644 --- a/lib_enc/ivas_qspherical_enc.c +++ b/lib_enc/ivas_qspherical_enc.c @@ -59,8 +59,7 @@ static float direction_distance_cp( float theta, float theta_hat, float theta_ha void quantize_direction_frame( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], - float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] - , + float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ ) { diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 4fbb34497d..2731fdaf40 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -538,12 +538,10 @@ static ivas_error ivas_spar_enc_process( else { ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, - ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND - , + ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, hSpar->hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, - hSpar->AGC_Enable - ); + hSpar->AGC_Enable ); } } /*-----------------------------------------------------------------------------------------* diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 38d9a52810..2776f65765 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -319,8 +319,7 @@ ivas_error ivas_spar_md_enc_init( table_idx = ivas_get_spar_table_idx( hEncoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, - ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND - , + ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, #ifndef DEBUG_AGC_ENCODER_CMD_OPTION diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 94ee7bddf6..e043fb4857 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -297,10 +297,8 @@ ivas_error stereo_dft_enc_create( stereo_dft_enc_open( hStereoDft_loc, input_Fs, max_bwidth ); - stereo_dft_hybrid_ITD_flag( hStereoDft_loc->hConfig, input_Fs - , - hStereoDft_loc->hItd->hybrid_itd_max - ); + stereo_dft_hybrid_ITD_flag( hStereoDft_loc->hConfig, input_Fs, + hStereoDft_loc->hItd->hybrid_itd_max ); *hStereoDft = hStereoDft_loc; diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index fd438bcd3f..669a4a0a12 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -121,9 +121,7 @@ void stereo_dft_hybrid_ITD_flag( { if ( hConfig != NULL ) { - if ( hConfig->res_cod_mode || ( hConfig->ada_wb_res_cod_mode && input_Fs == 16000 ) - || ( hybrid_itd_max == 1 ) - ) + if ( hConfig->res_cod_mode || ( hConfig->ada_wb_res_cod_mode && input_Fs == 16000 ) || ( hybrid_itd_max == 1 ) ) { hConfig->hybrid_itd_flag = 1; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 03c38b9f49..2e4dbbabcb 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -458,7 +458,6 @@ void ivas_dirac_dec_binaural( output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_output, decorr_signal, output_frame ); - } if ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) @@ -741,7 +740,6 @@ static void ivas_dirac_dec_decorrelate_slot( } - static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index 951d950211..106c433034 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -171,11 +171,11 @@ void ivas_limiter_close( *-------------------------------------------------------------------*/ void ivas_limiter_dec( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ + IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ - const int16_t num_channels, /* i : number of channels to be processed */ - const int16_t output_frame, /* i : number of samples per channel in the buffer */ - const int16_t BER_detect /* i : BER detect flag */ + const int16_t num_channels, /* i : number of channels to be processed */ + const int16_t output_frame, /* i : number of samples per channel in the buffer */ + const int16_t BER_detect /* i : BER detect flag */ ) { int16_t c; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 361d017629..4d324e60f3 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -263,9 +263,9 @@ ivas_error ivas_td_binaural_renderer_unwrap( const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ - const int16_t ism_md_subframe_update, /* i: Number of subframes to delay ism metadata to sync with audio */ - float *output[], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ + const int16_t ism_md_subframe_update, /* i: Number of subframes to delay ism metadata to sync with audio */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ ) { int16_t subframe_length; @@ -338,10 +338,10 @@ ivas_error ivas_td_binaural_renderer_unwrap( ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ - const int16_t subframe_length, /* i/o: subframe length */ - const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ - const int16_t ism_md_subframe_update /* Number of subframes to delay ism metadata to sync with audio */ + float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ + const int16_t subframe_length, /* i/o: subframe length */ + const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ + const int16_t ism_md_subframe_update /* Number of subframes to delay ism metadata to sync with audio */ ) { int16_t i; @@ -442,8 +442,8 @@ static void TDREND_Clear_Update_flags( void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ - const IVAS_FORMAT in_format, /* i : Format of input sources */ - const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ + const IVAS_FORMAT in_format, /* i : Format of input sources */ + const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ ) { TDREND_DirAtten_t *DirAtten_p; diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index a1cac4f1d3..456b406b1d 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -259,8 +259,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( int16_t *itd, /* o: ITD value */ float *Gain, /* o: Gain value */ TDREND_SRC_t *Src_p, /* i/o: Source pointer */ - const int16_t subframe_update_flag -) + const int16_t subframe_update_flag ) { TDREND_MIX_Listener_t *Listener_p; TDREND_HRFILT_FiltSet_t *HrFiltSet_p; diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 5fc4b7c45a..e05c8061dd 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -419,7 +419,7 @@ ivas_error ivas_orient_trk_Init( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ ) { diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 856914a58c..e5f0a0ac96 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1579,9 +1579,9 @@ ivas_error ivas_reverb_process( const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const int16_t mix_signals, /* i : add reverb to output signal */ - float *pcm_in[], /* i : the PCM audio to apply reverb on */ - float *pcm_out[], /* o : the PCM audio with reverb applied */ - const int16_t i_ts /* i : subframe index */ + float *pcm_in[], /* i : the PCM audio to apply reverb on */ + float *pcm_out[], /* o : the PCM audio with reverb applied */ + const int16_t i_ts /* i : subframe index */ ) { float tmp0[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp1[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp2[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -1617,9 +1617,9 @@ ivas_error ivas_reverb_process( *------------------------------------------------------------------------*/ void ivas_binaural_reverb_processSubframe( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int16_t numInChannels, /* i : num inputs to be processed */ - const int16_t numSlots, /* i : number of slots to be processed */ + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num inputs to be processed */ + const int16_t numSlots, /* i : number of slots to be processed */ float inReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ float inImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ float outReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ @@ -1750,7 +1750,7 @@ void ivas_binaural_reverb_processSubframe( { for ( sample = 0; sample < numSlots; sample++ ) { -/* Audio was in the temporally inverted order for convolution, re-invert audio to output */ + /* Audio was in the temporally inverted order for convolution, re-invert audio to output */ invertSampleIndex = numSlots - sample - 1; for ( bin = 0; bin < hReverb->numBins; bin++ ) diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 5f4a54a3c5..2ae0347fd3 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -250,10 +250,10 @@ void rotateAziEle( void rotateFrame_shd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const int16_t subframe_idx /* i : subframe index */ + float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const int16_t subframe_idx /* i : subframe index */ ) { int16_t i, l, n, m; @@ -353,11 +353,11 @@ void rotateFrame_shd( void rotateFrame_sd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ - float *output[], /* i/o: unrotated SD signal buffer in TD */ - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t subframe_idx /* i : subframe index */ + float *output[], /* i/o: unrotated SD signal buffer in TD */ + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + const int16_t subframe_idx /* i : subframe index */ ) { int16_t i, j; @@ -491,8 +491,8 @@ void rotateFrame_shd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ float Rmat[3][3], /* i : real-space rotation matrix */ const int16_t nInChannels, /* i : number of channels */ - const int16_t numTimeSlots, /* i : number of time slots to process */ - const int16_t shd_rot_max_order /* i : split-order rotation method */ + const int16_t numTimeSlots, /* i : number of time slots to process */ + const int16_t shd_rot_max_order /* i : split-order rotation method */ ) { int16_t n = 0; @@ -586,8 +586,8 @@ void rotateFrame_sd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t numTimeSlots, /* i : number of time slots to process */ - const int16_t nb_band /* i : number of CLDFB bands to process */ + const int16_t numTimeSlots, /* i : number of time slots to process */ + const int16_t nb_band /* i : number of CLDFB bands to process */ ) { int16_t iBlock, iBand, m, n; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e879f923a3..b4a0950c5f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2212,7 +2212,7 @@ static ivas_error initMasaDummyDecForMcOut( decDummy->sba_analysis_order = 1; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ - decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ + decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ ivas_output_init( &( decDummy->hOutSetup ), output_config ); ivas_output_init( &( decDummy->hIntSetup ), output_config ); @@ -2294,7 +2294,7 @@ static ivas_error initMasaDummyDecForSbaOut( decDummy->hDecoderConfig->output_config = output_config; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ - decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ + decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ decDummy->sba_analysis_order = 1; @@ -2367,7 +2367,7 @@ static ivas_error initMasaDummyDecForBinauralOut( decDummy->sba_analysis_order = 1; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ - decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ + decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ ivas_output_init( &( decDummy->hOutSetup ), output_config ); if ( output_config == AUDIO_CONFIG_BINAURAL ) @@ -3890,7 +3890,7 @@ ivas_error IVAS_REND_SetHeadRotation( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetOrientationTrackingMode( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ ) { diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 09cdf1b2d0..5fda0fcc3c 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -96,8 +96,6 @@ IVAS_MASA_METADATA_HANDLE MasaFileReader_getMetadataHandle( } - - /*------------------------------------------------------------------------- * MasaFileReader_readNextFrame() * -- GitLab From 42b3d834a3200e8167cdd18ed2cf48f3a22ac1cf Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Tue, 6 Jun 2023 22:43:21 +0200 Subject: [PATCH 53/53] move VARIABLE_SPEED_DECODING again to normal section - otherwise the instrumemnted builds fail --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 1098f65a05..3ff30c7505 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -127,7 +127,6 @@ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ //#define DEBUG_AGC_ENCODER_CMD_OPTION /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ #define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ -#define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality */ #endif /* #################### End DEBUGGING switches ############################ */ @@ -146,6 +145,7 @@ #define USE_HRIR_128_METH5_IRC_53_Q10_SYML_ITRP1_48000 /* Dolby (Orange, FhG) : Contribution 36 - SBA HRIR update */ #define UPDATE_SBA_FILTER /* Dolby (Orange, FhG) : Contribution 36 - SBA HRIR update */ +#define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ -- GitLab