From 71e8a35b95267d286e827e2fb69bc3be4399fee1 Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 6 Aug 2025 12:58:50 +1000 Subject: [PATCH] fix for issue 1862 --- lib_com/ivas_cnst.h | 2 ++ lib_com/ivas_filters_fx.c | 8 ++++++ lib_com/ivas_lfe_com_fx.c | 3 +++ lib_com/ivas_prot_fx.h | 4 +++ lib_com/ivas_rom_com.c | 3 +++ lib_com/ivas_rom_com.h | 3 +++ lib_com/ivas_rom_com_fx.c | 2 ++ lib_com/ivas_rom_com_fx.h | 2 ++ lib_com/options.h | 1 + lib_dec/ivas_init_dec_fx.c | 51 ++++++++++++++++++++++++++++++++++++++ lib_dec/ivas_lfe_dec_fx.c | 46 +++++++++++++++++++++++++++++++--- lib_dec/ivas_mct_dec_fx.c | 25 +++++++++++++++++++ 12 files changed, 147 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index a94ab1fbb..b5c0a7494 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1562,7 +1562,9 @@ typedef enum typedef enum { IVAS_FILTER_ORDER_1 = 1, +#ifndef NONBE_FIX_MC_LFE_LPF IVAS_FILTER_ORDER_2 = 2, +#endif IVAS_FILTER_ORDER_4 = 4, } ivas_filter_order; diff --git a/lib_com/ivas_filters_fx.c b/lib_com/ivas_filters_fx.c index 1e9aaf0c2..fca802cb0 100644 --- a/lib_com/ivas_filters_fx.c +++ b/lib_com/ivas_filters_fx.c @@ -64,7 +64,11 @@ void ivas_filters_init_fx( test(); +#ifdef NONBE_FIX_MC_LFE_LPF + IF( EQ_16( order, IVAS_FILTER_ORDER_1 ) ) +#else IF( EQ_16( order, IVAS_FILTER_ORDER_2 ) || EQ_16( order, IVAS_FILTER_ORDER_1 ) ) +#endif { filter_state->filt_len = add( order, 1 ); move16(); @@ -166,7 +170,9 @@ void ivas_filter_process_fx( SWITCH( filter_state->order ) { case IVAS_FILTER_ORDER_1: +#ifndef NONBE_FIX_MC_LFE_LPF case IVAS_FILTER_ORDER_2: +#endif set_val_Word16( pIn_Out_e, sub( Q31, q_factor ), length ); ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e ); /* Scale pIn_Out_fx back to input Q */ @@ -205,7 +211,9 @@ void ivas_filter_process_exp_fx( SWITCH( filter_state->order ) { case IVAS_FILTER_ORDER_1: +#ifndef NONBE_FIX_MC_LFE_LPF case IVAS_FILTER_ORDER_2: +#endif ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e ); /* Scale pIn_Out_fx back to input Q */ BREAK; diff --git a/lib_com/ivas_lfe_com_fx.c b/lib_com/ivas_lfe_com_fx.c index 3d1e7aee6..ba64b517f 100644 --- a/lib_com/ivas_lfe_com_fx.c +++ b/lib_com/ivas_lfe_com_fx.c @@ -58,6 +58,8 @@ void ivas_lfe_lpf_select_filt_coeff_fx( { SWITCH( order ) { + +#ifndef NONBE_FIX_MC_LFE_LPF case IVAS_FILTER_ORDER_2: SWITCH( sampling_rate ) { @@ -74,6 +76,7 @@ void ivas_lfe_lpf_select_filt_coeff_fx( BREAK; } BREAK; +#endif case IVAS_FILTER_ORDER_4: SWITCH( sampling_rate ) { diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 0b0c1a755..3aed309e6 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -864,7 +864,11 @@ void ivas_lfe_dec_close_fx( ivas_error ivas_create_lfe_dec_fx( LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */ const Word32 output_Fs, /* i : output sampling rate */ +#ifdef NONBE_FIX_MC_LFE_LPF + const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */ +#else const Word32 binauralization_delay_ns /* i : additional LFE delay to sync with binaural renderer */ +#endif ); void ivas_lfe_dec_fx( diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 5d4de33b4..183e61ca1 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -2585,6 +2585,9 @@ const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 8 const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; const Word16 ivas_lfe_lpf_delay_Q15[2] = { 57, 114 }; +#ifdef NONBE_FIX_MC_LFE_LPF +const Word32 ivas_lfe_lpf_delay_ns[2] = { 1750000, 3500000 }; +#endif const Word16 dirac_gains_P_idx[16] = { diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 865382410..4a227befb 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -279,6 +279,9 @@ extern const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP extern const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const ivas_lfe_freq_models ivas_str_lfe_freq_models; extern const Word16 ivas_lfe_lpf_delay_Q15[2]; +#ifdef NONBE_FIX_MC_LFE_LPF +extern const Word32 ivas_lfe_lpf_delay_ns[2]; +#endif extern const Word16 dirac_gains_P_idx[16]; diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index e3ee71ac9..1f51c6a6b 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -1807,6 +1807,7 @@ const Word16 ivas_lpf_4_butter_48k_sos_e[IVAS_BIQUAD_FILT_LEN << 2] = { -27, -26, -27, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; +#ifndef NONBE_FIX_MC_LFE_LPF const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */ 0xa4d0c, 0x149a17, 0xa4d0c, 0x40000000, 0x849e6300, 0x3b8ad140 }; @@ -1819,6 +1820,7 @@ const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */ const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */ 0x12c07, 0x2580d, 0x12c07, 0x40000000, 0x818a4580, 0x3e7a6a80 }; +#endif const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K] = { // Q31 0x0003a373, 0x000608f6, 0x000888a7, 0x000b3e1b, 0x000e34f1, 0x001174a2, 0x00150328, 0x0018e5e1, 0x001d21eb, 0x0021bc4d, 0x0026ba09, 0x002c202f, 0x0031f3dc, 0x00383a43, 0x003ef8ad, 0x0046347b, 0x004df325, 0x00563a3f, 0x005f0f74, 0x00687888, 0x00727b59, 0x007d1ddb, 0x0088661c, 0x00945a41, 0x00a10087, 0x00ae5f3d, 0x00bc7ccd, 0x00cb5fb3, 0x00db0e7d, 0x00eb8fd0, 0x00fcea61, 0x010f24f8, 0x0122466a, 0x013655a0, 0x014b598e, 0x01615936, 0x01785ba8, 0x01906800, 0x01a9855e, 0x01c3baf0, 0x01df0fee, 0x01fb8b90, 0x02193514, 0x023813c4, 0x02582ee4, 0x02798db8, 0x029c378c, 0x02c033a4, 0x02e58944, 0x030c3fa8, 0x03345e0c, 0x035deba0, 0x0388ef8c, 0x03b570f0, 0x03e376dc, 0x04130858, 0x04442c58, 0x0476e9b8, 0x04ab4760, 0x04e14c00, 0x0518fe48, 0x055264c8, 0x058d8600, 0x05ca6850, 0x06091200, 0x06498930, 0x068bd3f0, 0x06cff830, 0x0715fba8, 0x075de408, 0x07a7b6c8, 0x07f37940, 0x084130a0, 0x0890e200, 0x08e29220, 0x093645c0, 0x098c0150, 0x09e3c940, 0x0a3da180, 0x0a998e30, 0x0af792e0, 0x0b57b320, 0x0bb9f240, 0x0c1e5360, 0x0c84d940, 0x0ced8690, 0x0d585dc0, 0x0dc560f0, 0x0e349200, 0x0ea5f2b0, 0x0f198450, 0x0f8f4820, 0x10073f00, 0x10816980, 0x10fdc840, 0x117c5b00, 0x11fd21e0, 0x12801c60, 0x130549a0, 0x138ca8c0, 0x14163880, 0x14a1f740, 0x152fe320, 0x15bffa00, 0x16523980, 0x16e69ee0, 0x177d2700, 0x1815cec0, 0x18b09260, 0x194d6e00, 0x19ec5d60, 0x1a8d5c20, 0x1b306580, 0x1bd57440, 0x1c7c8300, 0x1d258c40, 0x1dd08a00, 0x1e7d7600, 0x1f2c49a0, 0x1fdcfe20, 0x208f8c40, 0x2143ed00, 0x21fa1840, 0x22b20680, 0x236baf40, 0x24270a00, 0x24e40e00, 0x25a2b280, 0x2662ee00, 0x2724b700, 0x27e80400, 0x28acca80, 0x297300c0, 0x2a3a9c00, 0x2b039180, 0x2bcdd680, 0x2c995fc0, 0x2d6621c0, 0x2e341140, 0x2f032240, 0x2fd34900, 0x30a47900, 0x3176a640, 0x3249c440, 0x331dc600, 0x33f29f40, 0x34c842c0, 0x359ea340, 0x3675b3c0, 0x374d66c0, 0x3825af00, 0x38fe7ec0, 0x39d7c880, 0x3ab17e40, 0x3b8b9240, 0x3c65f6c0, 0x3d409d80, 0x3e1b7880, 0x3ef679c0, 0x3fd19340, 0x40acb680, 0x4187d580, 0x4262e280, 0x433dce80, 0x44188c00, 0x44f30c80, 0x45cd4180, 0x46a71e00, 0x47809300, 0x48599300, 0x49320f80, 0x4a09fb80, 0x4ae14880, 0x4bb7e900, 0x4c8dcf80, 0x4d62ee80, 0x4e373880, 0x4f0aa080, 0x4fdd1900, 0x50ae9600, 0x517f0980, 0x524e6780, 0x531ca380, 0x53e9b100, 0x54b58400, 0x55801080, 0x56494b00, 0x57112800, 0x57d79c00, 0x589c9c00, 0x59601d00, 0x5a221480, 0x5ae27880, 0x5ba13e00, 0x5c5e5c00, 0x5d19c880, 0x5dd37a80, 0x5e8b6800, 0x5f418980, 0x5ff5d580, 0x60a84480, 0x6158ce00, 0x62076a80, 0x62b41280, 0x635ebf80, 0x64076a80, 0x64ae0d00, 0x6552a100, 0x65f52080, 0x66958680, 0x6733cd00, 0x67cff000, 0x6869ea80, 0x6901b880, 0x69975600, 0x6a2abf80, 0x6abbf200, 0x6b4aea80, 0x6bd7a680, 0x6c622300, 0x6cea5f80, 0x6d705900, 0x6df40f00, 0x6e758080, 0x6ef4ac80, 0x6f719300, 0x6fec3380, 0x70648f00, 0x70daa580, 0x714e7880, 0x71c00880, 0x722f5780, 0x729c6700, 0x73073980, 0x736fd100, 0x73d62f80, 0x743a5900, 0x749c5080, 0x74fc1880, 0x7559b600, 0x75b52b80, 0x760e7e80, 0x7665b280, 0x76bacc80, 0x770dd180, 0x775ec600, 0x77adb000, 0x77fa9480, 0x78457900, 0x788e6400, 0x78d55b80, 0x791a6500, 0x795d8780, 0x799ec900, 0x79de3100, 0x7a1bc580, 0x7a578d80, 0x7a919100, 0x7ac9d600, 0x7b006500, 0x7b354400, 0x7b687b80, 0x7b9a1300, 0x7bca1180, 0x7bf87f80, 0x7c256400, 0x7c50c780, 0x7c7ab180, 0x7ca32a00, 0x7cca3900, 0x7cefe600, 0x7d143900, 0x7d373a80, 0x7d58f280, 0x7d796800, 0x7d98a380, 0x7db6ad00, 0x7dd38c80, 0x7def4900, 0x7e09eb00, 0x7e237a00, 0x7e3bfd80, 0x7e537d80, 0x7e6a0180, 0x7e7f9080, 0x7e943200, 0x7ea7ed80, 0x7ebaca00, 0x7ecccf00, 0x7ede0300, 0x7eee6d00, 0x7efe1400, 0x7f0cfe80, 0x7f1b3380, 0x7f28b900, 0x7f359500, 0x7f41ce80, 0x7f4d6b80, 0x7f587180, 0x7f62e680, 0x7f6cd000, 0x7f763400, 0x7f7f1780, 0x7f878080, 0x7f8f7380, 0x7f96f580, 0x7f9e0b80, 0x7fa4bb00, 0x7fab0780, 0x7fb0f600, 0x7fb68b00, 0x7fbbca00, 0x7fc0b800, 0x7fc55880, 0x7fc9af80, 0x7fcdc080, 0x7fd18f00, 0x7fd51e80, 0x7fd87280, 0x7fdb8d80, 0x7fde7380, 0x7fe12700, 0x7fe3aa80, 0x7fe60100, 0x7fe82d00, 0x7fea3180, 0x7fec1000, 0x7fedcb00, 0x7fef6500, 0x7ff0e000, 0x7ff23e00, 0x7ff38080, 0x7ff4a980, 0x7ff5ba80, 0x7ff6b580, 0x7ff79c00, 0x7ff86e80, 0x7ff92f80, 0x7ff9e000, 0x7ffa8100, 0x7ffb1380, 0x7ffb9880, 0x7ffc1180, 0x7ffc7f80, 0x7ffce300, 0x7ffd3c80, 0x7ffd8d80, 0x7ffdd680, 0x7ffe1880, 0x7ffe5300, 0x7ffe8800, 0x7ffeb700, 0x7ffee100, 0x7fff0600, 0x7fff2700, 0x7fff4480, 0x7fff5e80, 0x7fff7500, 0x7fff8900, 0x7fff9a80, 0x7fffaa00, 0x7fffb780, 0x7fffc300, 0x7fffcd00, 0x7fffd580, 0x7fffdc80, 0x7fffe300, 0x7fffe880, 0x7fffec80, 0x7ffff080, 0x7ffff380, 0x7ffff680, 0x7ffff880, 0x7ffffa00, 0x7ffffb80, 0x7ffffc80, 0x7ffffd80, 0x7ffffe80, 0x7fffff00, 0x7fffff00, 0x7fffff80, 0x7fffff80, 0x7fffffff, 0x7fffffff diff --git a/lib_com/ivas_rom_com_fx.h b/lib_com/ivas_rom_com_fx.h index 04a86ed5b..4b3b36dfa 100644 --- a/lib_com/ivas_rom_com_fx.h +++ b/lib_com/ivas_rom_com_fx.h @@ -219,9 +219,11 @@ extern const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; extern const Word16 ivas_lpf_4_butter_32k_sos_e[IVAS_BIQUAD_FILT_LEN << 2]; extern const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2]; extern const Word16 ivas_lpf_4_butter_48k_sos_e[IVAS_BIQUAD_FILT_LEN << 2]; +#ifndef NONBE_FIX_MC_LFE_LPF extern const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1]; extern const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1]; extern const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1]; +#endif extern const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K]; // Q31 extern const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K]; // Q31 diff --git a/lib_com/options.h b/lib_com/options.h index 9d59d03d9..ffdebc813 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -115,6 +115,7 @@ #define CONF_DISTATT /* Eri: Make distance attenuation configurable */ #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ +#define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 4a8673aeb..aaff34f2f 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1257,7 +1257,11 @@ ivas_error ivas_init_decoder_fx( Word16 numCldfbAnalyses, numCldfbSyntheses; Word16 granularity, n_channels_transport_jbm; Word32 output_Fs, ivas_total_brate; +#ifdef NONBE_FIX_MC_LFE_LPF + Word32 delay_ns; +#else Word32 binauralization_delay_ns; +#endif AUDIO_CONFIG output_config; DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; @@ -2620,8 +2624,11 @@ ivas_error ivas_init_decoder_fx( } } + +#ifndef NONBE_FIX_MC_LFE_LPF /*-----------------------------------------------------------------* * LFE handles for rendering after rendering to adjust LFE delay to binaural filter delay + * LFE handles for rendering after rendering to adjust LFE delay to filter delay *-----------------------------------------------------------------*/ test(); IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) @@ -2653,6 +2660,7 @@ ivas_error ivas_init_decoder_fx( set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); } +#endif /*-----------------------------------------------------------------* * CLDFB handles for rendering @@ -2710,6 +2718,49 @@ ivas_error ivas_init_decoder_fx( move16(); } +#ifdef NONBE_FIX_MC_LFE_LPF + /*-----------------------------------------------------------------* + * LFE handles for rendering after rendering to adjust LFE delay to filter delay + *-----------------------------------------------------------------*/ + test(); + IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) + { + delay_ns = st_ivas->binaural_latency_ns; + move32(); + IF( st_ivas->hBinRenderer != NULL ) + { + IF( st_ivas->hBinRenderer->render_lfe ) + { + IF( NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) + { + /* Account for filterbank delay */ + delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); + } + } + ELSE + { + delay_ns = 0; + move32(); + } + } + ELSE + { + IF( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) ) + { + delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); + } + } + + IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, output_Fs, delay_ns ) ), IVAS_ERR_OK ) ) + { + return error; + } + + set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); + set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); + } +#endif + /*-----------------------------------------------------------------* * Allocate and initialize limiter struct *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c index d73030d56..11406a10b 100644 --- a/lib_dec/ivas_lfe_dec_fx.c +++ b/lib_dec/ivas_lfe_dec_fx.c @@ -295,6 +295,28 @@ static Word16 ivas_lfe_dec_dequant_fx( } +#ifdef NONBE_FIX_MC_LFE_LPF +/*------------------------------------------------------------------------- + * ivas_create_lfe_lpf_dec_fx() + * + * Create, allocate and initialize IVAS decoder LFE low pass filter state handle + *-------------------------------------------------------------------------*/ + +static void ivas_create_lfe_lpf_dec_fx( + ivas_filters_process_state_t *hLfeLpf, /* o : LFE LPF handle */ + const Word32 input_Fs /* i : input sampling rate */ +) +{ + const Word32 *filt_coeff; // 31 - filt_coeff_e + const Word16 *filt_coeff_e = NULL; + + ivas_lfe_lpf_select_filt_coeff_fx( input_Fs, IVAS_FILTER_ORDER_4, &filt_coeff, &filt_coeff_e ); + ivas_filters_init_fx( hLfeLpf, filt_coeff, filt_coeff_e, IVAS_FILTER_ORDER_4 ); + + return; +} +#endif + /*-----------------------------------------------------------------------------------------* * Function ivas_lfe_dec_fx() * @@ -406,9 +428,13 @@ void ivas_lfe_dec_fx( *-------------------------------------------------------------------------*/ ivas_error ivas_create_lfe_dec_fx( - LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */ - const Word32 output_Fs, /* i : output sampling rate Q0*/ - const Word32 binauralization_delay_ns /* i : additional LFE delay to sync with binaural renderer */ + LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */ + const Word32 output_Fs, /* i : output sampling rate Q0*/ +#ifdef NONBE_FIX_MC_LFE_LPF + const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */ +#else + const Word32 binauralization_delay_ns /* i : additional LFE delay to sync with binaural renderer */ +#endif ) { Word16 low_pass_delay_dec_out, block_offset_s; @@ -466,6 +492,16 @@ ivas_error ivas_create_lfe_dec_fx( move16(); low_pass_delay_dec_out = 0; // Q15 move16(); + +#ifdef NONBE_FIX_MC_LFE_LPF + if ( delay_ns > ivas_lfe_lpf_delay_ns[IVAS_FILTER_ORDER_4 - 3] ) + { + filt_order = 4; + low_pass_delay_dec_out = ivas_lfe_lpf_delay_Q15[IVAS_FILTER_ORDER_4 - 3]; + ivas_create_lfe_lpf_dec_fx( &( hLFE->filter_state ), output_Fs ); + } +#endif + hLFE->filter_state.order = filt_order; move16(); hLFE->lfe_block_delay_s_fx = add( hLFE->lfe_block_delay_s_fx, low_pass_delay_dec_out ); // Q15 @@ -495,7 +531,11 @@ ivas_error ivas_create_lfe_dec_fx( lfe_addl_delay_s = sub( block_offset_s, hLFE->lfe_block_delay_s_fx ); // Q15 lfe_addl_delay_s = s_max( 0, lfe_addl_delay_s ); +#ifdef NONBE_FIX_MC_LFE_LPF + add_delay_sa = (Word16) W_round64_L( W_mult0_32_32( L_shl( delay_ns, 1 ), output_fs_fx ) ); // Q0 +#else add_delay_sa = (Word16) W_round64_L( W_mult0_32_32( L_shl( binauralization_delay_ns, 1 ), output_fs_fx ) ); // Q0 +#endif move16(); hLFE->lfe_addl_delay = add( (Word16) L_shr( imult3216( output_Fs, lfe_addl_delay_s ), 15 ), add_delay_sa ); // Q0 move16(); diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index a27e8b3ea..10b9897b1 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -1340,23 +1340,48 @@ static ivas_error ivas_mc_dec_reconfig_fx( test(); IF( ( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) && st_ivas->hLFE == NULL ) { +#ifdef NONBE_FIX_MC_LFE_LPF + Word32 delay_ns = st_ivas->binaural_latency_ns; +#else Word32 binauralization_delay_ns = st_ivas->binaural_latency_ns; +#endif move32(); IF( st_ivas->hBinRenderer != NULL ) { IF( st_ivas->hBinRenderer->render_lfe ) { /* Account for filterbank delay */ +#ifdef NONBE_FIX_MC_LFE_LPF + delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); +#else binauralization_delay_ns = L_add( binauralization_delay_ns, IVAS_FB_DEC_DELAY_NS ); +#endif } ELSE { +#ifdef NONBE_FIX_MC_LFE_LPF + delay_ns = 0; +#else binauralization_delay_ns = 0; +#endif move32(); } } +#ifdef NONBE_FIX_MC_LFE_LPF + ELSE + { + IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) ) + { + delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS ); + } + } +#endif +#ifdef NONBE_FIX_MC_LFE_LPF + IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, delay_ns ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ), IVAS_ERR_OK ) ) +#endif { return error; } -- GitLab