diff --git a/apps/renderer.c b/apps/renderer.c index 2682dd96fa946680554b5dcfcd673d5eaf06725f..428ecc22cf74cb81715ac1200cb3c2cd71a08071 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -174,6 +174,10 @@ typedef struct char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; int8_t orientation_tracking; +#ifdef FIX_1135_EXT_RENDERER_HANDLES + int16_t Opt_Headrotation; + int16_t Opt_ExternalOrientation; +#endif int16_t nonDiegeticPan; float nonDiegeticPanGain; IVAS_REND_COMPLEXITY_LEVEL complexityLevel; @@ -979,7 +983,12 @@ int main( Word32 nonDiegeticPanGain_fx = ( args.nonDiegeticPanGain == 1.0f ) ? ONE_IN_Q31 : ( args.nonDiegeticPanGain == -1.0f ) ? L_negate( ONE_IN_Q31 ) : (Word32) ( args.nonDiegeticPanGain * ( 1LL << Q31 ) ); + +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) +#else IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) ); goto cleanup; @@ -2768,7 +2777,13 @@ static CmdlnArgs defaultArgs( clearString( args.renderConfigFilePath ); clearString( args.externalOrientationFilePath ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + args.Opt_Headrotation = 0; + args.Opt_ExternalOrientation = 0; +#endif + args.orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE; + args.nonDiegeticPan = 0; args.nonDiegeticPanGain = 0.f; @@ -2860,6 +2875,9 @@ static void parseOption( break; case CmdLnOptionId_trajFile: assert( numOptionValues == 1 ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + args->Opt_Headrotation = 1; +#endif strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; case CmdLnOptionId_outputMetadata: @@ -2880,6 +2898,9 @@ static void parseOption( break; case CmdLnOptionId_exteriorOrientationFile: assert( numOptionValues == 1 ); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + args->Opt_ExternalOrientation = 1; +#endif strncpy( args->externalOrientationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 ); break; case CmdLnOptionId_customHrtfFile: @@ -3013,6 +3034,13 @@ static CmdlnArgs parseCmdlnArgs( exit( -1 ); /* Error printout handled by failing function */ } +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + args.Opt_Headrotation = 1; + } +#endif + return args; } diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 77ce24079f60050f0d8ca1ae0b364dcea437d284..6b0883202967efa76cb103da4c7470c982f861e9 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -4461,8 +4461,6 @@ ivas_error read_indices_fx( st_ivas->BER_detect = 0; move16(); - st_ivas->num_bits = num_bits; - move16(); sts = reset_elements( st_ivas ); #ifdef DEBUGGING diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index dd253c9218715770748a00572e4884c26950f39e..91a157f246026e577c8b0cf818dee544c0b3f690 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -4027,12 +4027,14 @@ void sns_avq_dec_stereo_fx( Word32 *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ Word16 *q_l, Word32 *SNS_Qr, /* o : Quantized SNS vectors (right channe) */ - Word16 *q_r ); + Word16 *q_r +); void dequantize_sns_fx( Word16 indices[CPE_CHANNELS][NPRM_LPC_NEW], Word32 snsQ_out[CPE_CHANNELS][NB_DIV][M], - Decoder_State **sts ); + Decoder_State **sts +); void inverseMS_fx( const Word16 L_frame, /* i : frame length Q0*/ @@ -4141,7 +4143,8 @@ Word16 ivas_smc_gmm_fx( const Word16 flag_spitch, /* i : flag to indicate very short stable pitch */ Word16 Qfact_PS, Word16 Q_esp, - Word16 Qfact_PS_past ); + Word16 Qfact_PS_past +); void ivas_signaling_enc_fx( Encoder_State *st, /* i/o: encoder state structure */ @@ -4187,12 +4190,13 @@ void TonalMdctConceal_create_concealment_noise_ivas_fx( const Word16 subframe_idx, const Word16 core, const Word16 crossfade_gain, - const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode ); - + const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode +); Word16 rand_triangular_signed_fx( Word16 *seed, - Word16 *exp_fac ); + Word16 *exp_fac +); Word64 var_32_fx( const Word32 *x, /* i : input vector */ @@ -4202,7 +4206,8 @@ Word64 var_32_fx( ivas_error ivas_jbm_dec_tc_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *data_fx ); + Word32 *data_fx +); ivas_error ivas_jbm_dec_flush_renderer_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/options.h b/lib_com/options.h index ac4ec92a18b1faf6eec1835c2d57853c27a597c9..152c06d749b90abda220fc592376733d29d9f23a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -80,6 +80,7 @@ #define FIX_1917_DIRAC_RENDER_PTR_INCR /* FhG: fix wrong pointer increment in ivas_dirac_dec_render_sf_fx() for object rendering */ #define FIX_CDLFB_BUFFER_SCALING /* FhG: fix wrong buffer scaling in ivas_dirac_dec_render_sf_fx() for object rendering */ #define FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 1931 */ +#define NONBE_SVD_OPTIMIZATION /* FhG: reduce WMOPS of HouseHolderReduction() in ivas_svd_dec.c() by removing redundant mathematics and using 64 bit additions */ #define FIX_1766_TCX2ACELP_BWE_ISSUE /* VA : Fix rare BWE issue when switching from TCX to ACELP */ #define FIX_1781_SPECTRAL_GAPS /* FhG: Change internal calculation of tcx_noise_factor_ivas_fx() to 32-bit*/ #define FIX_ISSUE_1811_EXCEEDING_W_SHIFTS /* FhG: limit exceeding 64bit shifts */ @@ -105,7 +106,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_1052_SBA_EXT /* Dlb: SBA external output support */ -#define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ +#define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ #define FIX_1158_FASTCONV_REVERB_HRTF /* Philips: issue 1158: Rendering with FastConv to BINAURAL_ROOM_REVERB uses BRIR convolution instead of HRTF */ #define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ #define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */ @@ -131,7 +132,7 @@ #define NONBE_FIX_1141_OSBA_ROOM_RENDERING /* FhG: Fix for issue 1141: render objects in OSBA decoder with room effect */ #define NONBE_1360_LFE_DELAY /* Dlb: LFE delay alignment when rendering in CLDFB domain*/ #define NONBE_1229_FIX_ISM1_DPID /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */ -#define NONBE_SVD_OPTIMIZATION /* FhG: issue 1367 */ +#define FIX_1135_EXT_RENDERER_HANDLES /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */ #define FIX_1209_SID_SIGNALING /* VA: issue 1209: remove dead code in IVAS SID signaling */ #define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */ #define NONBE_1131_ACELP_OOB /* VA: issue 1131: fix division-by-zero in acelp gain decoding caused by wrong length of buffer update when switching from HQ core to ACELP core */ diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 40d41252c9cec758f42e6e9c295ca88742bbdd7d..1440185231b42a769bb1a905662ef804fd0f3bfe 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -3191,8 +3191,6 @@ ivas_error ivas_init_decoder_fx( * Allocate floating-point output audio buffers *-----------------------------------------------------------------*/ - st_ivas->p_out_len = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - move16(); FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { /* note: these are intra-frame heap memories */ @@ -3202,7 +3200,6 @@ ivas_error ivas_init_decoder_fx( } set32_fx( st_ivas->p_output_fx[n], 0, 48000 / FRAMES_PER_SEC ); } - FOR( ; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { st_ivas->p_output_fx[n] = NULL; diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index cdb117820fcdc7088d74bd34e430b0dec7f1b162..af49f142a309babb90858f9bb39f563eff3abf23 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -1503,7 +1503,10 @@ static ivas_error ivas_mc_dec_reconfig_fx( } ELSE IF( st_ivas->hBinRendererTd == NULL && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) { - IF( ( error = ivas_td_binaural_open_fx( st_ivas, &st_ivas->SrcInd[0], &st_ivas->num_src ) ) != IVAS_ERR_OK ) + Word16 num_src; + Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; + + IF( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, &num_src ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c index f4cfa0dc156cb6b1c874c5ed49d03974fdd4e53e..bc8b110bb5a03162fb89563a591f5c766d673c51 100644 --- a/lib_dec/ivas_objectRenderer_internal_fx.c +++ b/lib_dec/ivas_objectRenderer_internal_fx.c @@ -46,6 +46,7 @@ * * Open and initialize TD Object binaural renderer *---------------------------------------------------------------------*/ + ivas_error ivas_td_binaural_open_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Word16 *SrcInd, /*Temporarily used to store the updated value of SrcInd*/ @@ -53,12 +54,14 @@ ivas_error ivas_td_binaural_open_fx( { *num_src = st_ivas->nchan_transport; move16(); + test(); if ( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) { *num_src = st_ivas->nchan_ism; move16(); } + #ifdef CONF_DISTATT return ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, *num_src, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity_fx, st_ivas->hRenderConfig->distAtt_fx, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns, SrcInd ); #else diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index e8bdb908eace82ce166ce2f2be147924b8ab6a8f..a2aa551c2aa0aca1bdb71e81ce9365027dbe1d49 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1043,23 +1043,23 @@ typedef struct jbm_metadata_structure typedef struct decoder_config_structure { - Word32 ivas_total_brate; /* IVAS total bitrate in bps */ - Word32 last_ivas_total_brate; /* last IVAS total bitrate in bps */ - Word32 output_Fs; /* output signal sampling frequency in Hz */ - Word16 nchan_out; /* number of output audio channels */ - AUDIO_CONFIG output_config; /* output audio configuration */ - Word16 Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ - Word16 Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ - Word16 Opt_Headrotation; /* indicates whether head-rotation is used */ - Word16 Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ - IVAS_HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */ - Word16 Opt_non_diegetic_pan; /* indicates diegetic or not */ - Word16 non_diegetic_pan_gain_fx; /* non diegetic panning gain*/ /* Q15 */ - Word16 Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ - Word16 Opt_ExternalOrientation; /* indiates whether external orientations are used */ - Word16 Opt_dpid_on; /* indicates whether Directivity pattern option is used */ - Word16 Opt_aeid_on; /* indicates whether Acoustic environment option is used */ - Word16 Opt_tsm; /* indicates whether time scaling modification is activated */ + Word32 ivas_total_brate; /* IVAS total bitrate in bps */ + Word32 last_ivas_total_brate; /* last IVAS total bitrate in bps */ + Word32 output_Fs; /* output signal sampling frequency in Hz */ + Word16 nchan_out; /* number of output audio channels */ + AUDIO_CONFIG output_config; /* output audio configuration */ + Word16 Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ + Word16 Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ + Word16 Opt_Headrotation; /* indicates whether head-rotation is used */ + Word16 Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ + IVAS_HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */ + Word16 Opt_non_diegetic_pan; /* indicates diegetic or not */ + Word16 non_diegetic_pan_gain_fx; /* non diegetic panning gain, Q15 */ + Word16 Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ + Word16 Opt_ExternalOrientation; /* indicates whether external orientations are used */ + Word16 Opt_dpid_on; /* indicates whether Directivity pattern option is used */ + Word16 Opt_aeid_on; /* indicates whether Acoustic environment option is used */ + Word16 Opt_tsm; /* indicates whether time scaling modification is activated */ IVAS_RENDER_FRAMESIZE render_framesize; Word16 Opt_delay_comp; /* flag indicating delay compensation active */ @@ -1080,8 +1080,8 @@ typedef struct Decoder_Struct IVAS_FORMAT ivas_format; /* IVAS format */ IVAS_FORMAT last_ivas_format; /* last frame IVAS format */ - Word16 sid_format; /* IVAS format indicator from SID frame */ - Word16 nchan_transport; /* number of transport channels */ + Word16 sid_format; /* IVAS format indicator from SID frame */ + Word16 nchan_transport; /* number of transport channels */ IVAS_OUTPUT_SETUP hOutSetup; /* output setup structure */ AUDIO_CONFIG intern_config; /* internal audio configuration */ IVAS_OUTPUT_SETUP hIntSetup; /* internal setup structure */ @@ -1089,24 +1089,26 @@ typedef struct Decoder_Struct AUDIO_CONFIG transport_config; /* transport audio configuration */ IVAS_OUTPUT_SETUP hTransSetup; /* transport setup structure */ - Word16 element_mode_init; /* element mode used at initialization */ - Word16 codec_mode; /* Mode 1 or 2 */ - Word16 ini_frame; /* initialization frames counter */ - Word16 ini_active_frame; /* initialization active frames counter */ + Word16 element_mode_init; /* element mode used at initialization */ + Word16 codec_mode; /* Mode 1 or 2 */ + Word16 ini_frame; /* initialization frames counter */ + Word16 ini_active_frame; /* initialization active frames counter */ - Word16 bfi; /* FEC - bad frame indicator */ - Word16 BER_detect; /* BER detect flag */ - Word16 num_bits; /* BER detect flag */ + Word16 bfi; /* FEC - bad frame indicator */ + Word16 BER_detect; /* BER detect flag */ - UWord16 *bit_stream; /* Pointer to bitstream buffer */ - Word16 writeFECoffset; /* parameter for debugging JBM stuff */ + UWord16 *bit_stream; /* Pointer to bitstream buffer */ + Word16 writeFECoffset; /* parameter for debugging JBM stuff */ + + Word32 **mem_hp20_out_fx; /* output signals HP filter memories */ IVAS_LIMITER_HANDLE hLimiter; /* Limiter handle */ + Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* Word32-output audio buffers */ /* core-decoder modules */ - Word16 nSCE; /* number of total SCEs */ - Word16 nCPE; /* number of total CPEs */ - Word16 nCPE_old; /* number of total CPEs available in the last frame before bitrate switching */ + Word16 nSCE; /* number of total SCEs */ + Word16 nCPE; /* number of total CPEs */ + Word16 nCPE_old; /* number of total CPEs available in the last frame before bitrate switching */ SCE_DEC_HANDLE hSCE[MAX_SCE]; /* SCE handles */ CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS]; /* CPE handles */ @@ -1125,12 +1127,12 @@ typedef struct Decoder_Struct LFE_DEC_HANDLE hLFE; /* LFE handle */ ISM_MODE ism_mode; /* ISM format mode */ - Word16 nchan_ism; /* number of ISM channels */ + Word16 nchan_ism; /* number of ISM channels */ MC_MODE mc_mode; /* MC format mode */ - Word16 sba_order; /* Ambisonic (SBA) order */ - Word16 sba_planar; /* Ambisonic (SBA) planar flag */ - Word16 sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ - Word16 sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ + Word16 sba_order; /* Ambisonic (SBA) order */ + Word16 sba_planar; /* Ambisonic (SBA) planar flag */ + Word16 sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ + Word16 sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ /* rendering modules */ RENDERER_TYPE renderer_type; /* renderer type */ @@ -1174,11 +1176,6 @@ typedef struct Decoder_Struct Word32 last_active_ivas_total_brate; Word16 ism_extmeta_active; /* Extended metadata active in decoder */ Word16 ism_extmeta_cnt; /* Change frame counter for extended metadata */ - Word32 **mem_hp20_out_fx; - Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* Word32-output audio buffers */ - Word16 p_out_len; /*Stores the total no of channels for which memory is allocated to p_output_fx*/ - Word16 num_src; - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; } Decoder_Struct; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 651a8fc8b5584a574bf66976d3eae8e9556c0cfa..cd98a412b4ce9f17beed8d3294730901ae8ba567 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -564,6 +564,7 @@ ivas_error IVAS_DEC_Configure( { return IVAS_ERR_WRONG_PARAMS; } + IF( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_EXTERNAL ) ) { hDecoderConfig->render_framesize = IVAS_RENDER_FRAMESIZE_20MS; @@ -572,15 +573,15 @@ ivas_error IVAS_DEC_Configure( { hDecoderConfig->render_framesize = renderFramesize; } - move16(); +#ifndef FIX_1135_EXT_RENDERER_HANDLES IF( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) { hDecoderConfig->Opt_Headrotation = TRUE; move16(); } - +#endif /* Set decoder parameters to initial values */ IF( NE_32( ( error = ivas_init_decoder_front( st_ivas ) ), IVAS_ERR_OK ) ) { @@ -3946,11 +3947,10 @@ static ivas_error evs_dec_main_fx( hCoreCoder = st_ivas->hSCE[0]->hCoreCoder; hCoreCoder[0]->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - hCoreCoder[0]->total_num_bits = st_ivas->num_bits; - move16(); move32(); hCoreCoder[0]->output_frame_fx = extract_l( Mult_32_16( hCoreCoder[0]->output_Fs, 0x0290 /*Q0*/ ) ); // Q0 move16(); + mdct_switching_dec_fx( hCoreCoder[0] ); FOR( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ ) diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 4595dc2062b3dd27b39b6b6ad488546957e56f09..01261f78b0172fdaee80500db8481942759f53ce 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -11,7 +11,16 @@ #ifdef FIX_1766_TCX2ACELP_BWE_ISSUE -static void rem_offset( const Word16 *in, Word16 *out, Word16 l_subfr ) +/*-------------------------------------------------------------------* + * rem_offset() + * + * + *-------------------------------------------------------------------*/ + +static void rem_offset( + const Word16 *in, + Word16 *out, + const Word16 l_subfr ) { Word16 i; Word16 tmp; @@ -29,9 +38,12 @@ static void rem_offset( const Word16 *in, Word16 *out, Word16 l_subfr ) out[i] = sub( in[i], tmp ); move16(); } + + return; } #endif + /*======================================================================*/ /* FUNCTION : encod_gen_voic_fx() */ /*----------------------------------------------------------------------*/ @@ -229,6 +241,10 @@ void encod_gen_voic_fx( /* scaling of xn[] to limit dynamic at 12 bits */ Scale_sig( xn_fx, L_SUBFR, shift ); + /*----------------------------------------------------------------* + * Close-loop pitch search and quantization + *----------------------------------------------------------------*/ + *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf ); /* Q6 */ @@ -598,6 +614,11 @@ void encod_gen_voic_ivas_fx( rem_offset( cn_fx, cn_fx, L_SUBFR ); } #endif + + /*----------------------------------------------------------------* + * Close-loop pitch search and quantization + *----------------------------------------------------------------*/ + *pt_pitch_fx = pit_encode_ivas_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx, L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); /* Q6 */ move16(); diff --git a/lib_rend/ivas_objectRenderer_fx.c b/lib_rend/ivas_objectRenderer_fx.c index eca9692b55e00c04d08acce75cd0d4f141482fcf..d3c7b7002e2ab4a7bb1e50008dc8c4f30bbdbee8 100644 --- a/lib_rend/ivas_objectRenderer_fx.c +++ b/lib_rend/ivas_objectRenderer_fx.c @@ -422,13 +422,25 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( Word16 tmp_headRotEnabled; tmp_headRotEnabled = 0; move16(); - if ( enableCombinedOrientation != NULL ) +#ifdef FIX_1135_EXT_RENDERER_HANDLES + Word16 tmp_CombinedOrient_subframe_idx; + tmp_CombinedOrient_subframe_idx = 0; + move16(); +#endif + IF( enableCombinedOrientation != NULL ) { tmp_headRotEnabled = enableCombinedOrientation[hCombinedOrientationData->subframe_idx]; move16(); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + tmp_CombinedOrient_subframe_idx = hCombinedOrientationData->subframe_idx; +#endif } +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, &Quaternions[tmp_CombinedOrient_subframe_idx], &Pos[tmp_CombinedOrient_subframe_idx] ) ), IVAS_ERR_OK ) ) +#else IF( NE_32( ( error = TDREND_Update_listener_orientation_fx( hBinRendererTd, tmp_headRotEnabled, &Quaternions[hCombinedOrientationData->subframe_idx], &Pos[hCombinedOrientationData->subframe_idx] ) ), IVAS_ERR_OK ) ) +#endif { return error; } @@ -816,6 +828,7 @@ ivas_error TDREND_Update_listener_orientation_fx( * * *---------------------------------------------------------------------*/ + ivas_error ivas_td_binaural_open_ext_fx( TDREND_WRAPPER *pTDRend, AUDIO_CONFIG inConfig, @@ -830,7 +843,6 @@ ivas_error ivas_td_binaural_open_ext_fx( IVAS_FORMAT ivas_format; IVAS_OUTPUT_SETUP hTransSetup; ivas_error error; - #ifdef CONF_DISTATT Word32 *distAtt_fx = NULL; #endif @@ -879,12 +891,15 @@ ivas_error ivas_td_binaural_open_ext_fx( distAtt_fx = hRendCfg->distAtt_fx; #endif } + #ifdef CONF_DISTATT return ivas_td_binaural_open_unwrap_fx( pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity_fx, distAtt_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd ); #else return ivas_td_binaural_open_unwrap_fx( pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity_fx, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns, SrcInd ); #endif } + + /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_ext() * @@ -992,7 +1007,13 @@ ivas_error ivas_td_binaural_renderer_ext_fx( move16(); Word16 pos_q = Q25; move16(); + +#ifdef FIX_1135_EXT_RENDERER_HANDLES + test(); + IF( *hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->listenerPos != NULL ) +#else IF( ( *hCombinedOrientationData )->listenerPos != NULL ) +#endif { ( *hCombinedOrientationData )->listenerPos[idx].x_fx = L_shr( ( *hCombinedOrientationData )->listenerPos[idx].x_fx, sub( ( *hCombinedOrientationData )->listenerPos[idx].q_fact, pos_q ) ); move32(); diff --git a/lib_rend/ivas_prot_rend_fx.h b/lib_rend/ivas_prot_rend_fx.h index 7ed8780cf24f3eb21512baaa72779b532175895c..186d4d1a2ce3ecbee9cdc8b3dd420f210cf1e544 100644 --- a/lib_rend/ivas_prot_rend_fx.h +++ b/lib_rend/ivas_prot_rend_fx.h @@ -756,16 +756,18 @@ ivas_error TDREND_MIX_SRC_SetPos_fx( ); ivas_error TDREND_MIX_SRC_SetDir_fx( - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const Word16 SrcInd, /* i : Source index */ - const Word32 *Vec_p, /* i : Direction vector */ - const Word16 Vec_p_q /* i : Direction vector q */ + BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ + const Word16 SrcInd, /* i : Source index */ + const Word32 *Vec_p, /* i : Direction vector */ + const Word16 Vec_p_q /* i : Direction vector q */ ); + ivas_error TDREND_MIX_SRC_SetDirAtten_fx( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const Word16 SrcInd, /* i : Source index */ + const Word16 SrcInd, /* i : Source index */ const TDREND_DirAtten_t *DirAtten_p /* i : Directional attenuation specifier */ ); + #ifdef CONF_DISTATT ivas_error TDREND_MIX_SRC_SetDistAtten( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ @@ -773,9 +775,10 @@ ivas_error TDREND_MIX_SRC_SetDistAtten( const TDREND_DistAtten_t *DistAtten_p /* i : Distance attenuation specifier */ ); #endif + ivas_error TDREND_MIX_SRC_SetPlayState( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ - const Word16 SrcInd, /* i : Source index */ + const Word16 SrcInd, /* i : Source index */ const TDREND_PlayStatus_t PlayStatus /* i : Play state */ ); diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 26318818a8ec1e8d7f8182016572d9a1c3a0ab85..fee0fac6b375b85619e04eca5a920e4acf88f34b 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -109,13 +109,17 @@ typedef enum _IVAS_REND_COMPLEXITY_LEVEL /* Functions to be called before rendering */ ivas_error IVAS_REND_Open( - IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ - const Word32 outputSampleRate, /* i : output sampling rate */ - const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ - const bool asHrtfBinary, /* i : load hrtf binary file */ - const Word16 nonDiegeticPan, /* i : non-diegetic object flag */ - const Word32 nonDiegeticPanGain, /* i : non-diegetic panning gain Q31 */ - const Word16 num_subframes /* i : number of subframes */ + IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ + const Word32 outputSampleRate, /* i : output sampling rate */ + const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ + const bool asHrtfBinary, /* i : load hrtf binary file */ + const Word16 nonDiegeticPan, /* i : non-diegetic object flag */ + const Word32 nonDiegeticPanGain, /* i : non-diegetic panning gain Q31*/ +#ifdef FIX_1135_EXT_RENDERER_HANDLES + const Word16 Opt_Headrotation, /* i : indicates whether head-rotation is used */ + const Word16 Opt_ExternalOrientation, /* i : indicates whether external orientations are used */ +#endif + const Word16 num_subframes /* i : number of subframes */ ); /* Note: this will reset custom LFE routings set for any MC input */ @@ -181,11 +185,6 @@ ivas_error IVAS_REND_GetDelay_fx( Word16 *nSamples, /* o : Renderer delay in samples */ Word32 *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ ); -ivas_error IVAS_REND_GetDelay( - IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer handle */ - int16_t *nSamples, /* o : Renderer delay in samples */ - int32_t *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */ -); /*! r: error code */ ivas_error IVAS_REND_GetHrtfHandle( diff --git a/lib_rend/lib_rend_fx.c b/lib_rend/lib_rend_fx.c index 14813f619a116fe1eceeb7f871c92d6e73b98c59..281ba50c0fbdca41d0a95b1a03c3eb16a761125c 100644 --- a/lib_rend/lib_rend_fx.c +++ b/lib_rend/lib_rend_fx.c @@ -1213,7 +1213,12 @@ static void closeHeadRotation( IVAS_REND_HANDLE hIvasRend ) { test(); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + test(); + IF( hIvasRend != NULL && hIvasRend->headRotData.headRotEnabled && hIvasRend->headRotData.hOrientationTracker != NULL ) +#else IF( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) ) +#endif { free( hIvasRend->headRotData.hOrientationTracker ); } @@ -3287,13 +3292,18 @@ static void clearInputMasa( *------------------------------------------------------------------------*/ ivas_error IVAS_REND_Open( - IVAS_REND_HANDLE *phIvasRend, - const Word32 outputSampleRate, - const AUDIO_CONFIG outConfig, - const bool asHrtfBinary, - const Word16 nonDiegeticPan, - const Word32 nonDiegeticPanGain, /* Q31 */ - const Word16 num_subframes ) + IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */ + const Word32 outputSampleRate, /* i : output sampling rate */ + const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */ + const bool asHrtfBinary, /* i : load hrtf binary file */ + const Word16 nonDiegeticPan, /* i : non-diegetic object flag */ + const Word32 nonDiegeticPanGain, /* i : non-diegetic panning gain Q31*/ +#ifdef FIX_1135_EXT_RENDERER_HANDLES + const Word16 Opt_Headrotation, /* i : indicates whether head-rotation is used */ + const Word16 Opt_ExternalOrientation, /* i : indicates whether external orientations are used */ +#endif + const Word16 num_subframes /* i : number of subframes */ +) { Word16 i; Word16 j; @@ -3344,21 +3354,47 @@ ivas_error IVAS_REND_Open( } /* Initialize headrotation data */ - IF( NE_32( ( error = initHeadRotation_fx( hIvasRend ) ), IVAS_ERR_OK ) ) +#ifdef FIX_1135_EXT_RENDERER_HANDLES + hIvasRend->headRotData.headRotEnabled = 0; + IF( Opt_Headrotation ) { - return error; +#endif + IF( NE_32( ( error = initHeadRotation_fx( hIvasRend ) ), IVAS_ERR_OK ) ) + { + return error; + } +#ifdef FIX_1135_EXT_RENDERER_HANDLES } +#endif /* Initialize external orientation data */ - IF( NE_32( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ), IVAS_ERR_OK ) ) +#ifdef FIX_1135_EXT_RENDERER_HANDLES + hIvasRend->hExternalOrientationData = NULL; + IF( Opt_ExternalOrientation ) { - return error; +#endif + IF( NE_32( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ), IVAS_ERR_OK ) ) + { + return error; + } +#ifdef FIX_1135_EXT_RENDERER_HANDLES } +#endif + /* Initilize combined orientation data */ - IF( NE_32( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ), IVAS_ERR_OK ) ) +#ifdef FIX_1135_EXT_RENDERER_HANDLES + hIvasRend->hCombinedOrientationData = NULL; + IF( Opt_Headrotation || Opt_ExternalOrientation ) { - return error; +#endif + IF( NE_32( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ), IVAS_ERR_OK ) ) + { + return error; + } +#ifdef FIX_1135_EXT_RENDERER_HANDLES } +#endif + /* Initialize EFAP */ IF( NE_32( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ), IVAS_ERR_OK ) ) { @@ -3469,14 +3505,23 @@ ivas_error IVAS_REND_Open( return error; } } - IF( NE_32( ( error = ivas_HRTF_statistics_init( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ), IVAS_ERR_OK ) ) + +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( EQ_32( hIvasRend->outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - return error; +#endif + IF( NE_32( ( error = ivas_HRTF_statistics_init( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ), IVAS_ERR_OK ) ) + { + return error; + } +#ifdef FIX_1135_EXT_RENDERER_HANDLES } +#endif return IVAS_ERR_OK; } + static LSSETUP_CUSTOM_STRUCT makeCustomLsSetup( const IVAS_CUSTOM_LS_DATA rendCustomLsLayout ) { @@ -3816,11 +3861,11 @@ static ivas_error findFreeInputSlot_fx( Word32 *inputIndex ) { /* Using a void pointer and a separately provided size is a hack for this function - to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). - Assumptions: - - input_base is always the first member in the input struct - - provided size is correct - */ + to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). + Assumptions: + - input_base is always the first member in the input struct + - provided size is correct + */ Word32 i; bool canAddInput; @@ -4391,11 +4436,13 @@ ivas_error IVAS_REND_GetNumAllObjects( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_GetDelay() * * *-------------------------------------------------------------------*/ + ivas_error IVAS_REND_GetDelay_fx( IVAS_REND_CONST_HANDLE hIvasRend, /* i : Renderer state */ Word16 *nSamples, /* o : Renderer delay in samples */ @@ -4478,25 +4525,40 @@ ivas_error IVAS_REND_GetDelay_fx( { IF( NE_32( hIvasRend->inputsSba[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) { - if ( hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL ) +#ifdef FIX_1135_EXT_RENDERER_HANDLES + test(); + IF( hIvasRend->splitRendWrapper != NULL && hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL ) +#else + IF( hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL ) +#endif { - if ( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) + IF( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) { latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; + move32(); } - else + ELSE { - latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; + IF( ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ) + { + latency_ns = hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns; + } + ELSE + { + latency_ns = 0; + } + move32(); } - max_latency_ns = max( max_latency_ns, latency_ns ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); } - else if ( hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend != NULL ) + ELSE IF( hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend != NULL ) { latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; - latency_ns += IVAS_FB_DEC_DELAY_NS; - max_latency_ns = max( max_latency_ns, latency_ns ); + move32(); + latency_ns = L_add( latency_ns, IVAS_FB_DEC_DELAY_NS ); + max_latency_ns = L_max( max_latency_ns, latency_ns ); } - else + ELSE { IF( hIvasRend->inputsSba[i].crendWrapper != NULL ) { @@ -4512,7 +4574,6 @@ ivas_error IVAS_REND_GetDelay_fx( } } - FOR( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ ) { IF( NE_32( hIvasRend->inputsMasa[i].base.inConfig, IVAS_AUDIO_CONFIG_INVALID ) ) @@ -4523,7 +4584,6 @@ ivas_error IVAS_REND_GetDelay_fx( } } - //*nSamples = (Word16) roundf( (float) max_latency_ns * *timeScale / 1000000000.f ); Word32 temp = Mpy_32_32( *timeScale, 268436 ); // Q0 + Q31 - Q31 -> Q0, ( 1 / 8000 ) * 2 ^ 31 *nSamples = extract_l( Mpy_32_32_r( max_latency_ns, timescale_by_ns[temp] ) ); @@ -4532,6 +4592,7 @@ ivas_error IVAS_REND_GetDelay_fx( return IVAS_ERR_OK; } + /*-------------------------------------------------------------------* * IVAS_REND_FeedInputAudio() * @@ -5190,6 +5251,13 @@ ivas_error IVAS_REND_SetOrientationTrackingMode( const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ ) { +#ifdef FIX_1135_EXT_RENDERER_HANDLES + if ( hIvasRend->headRotData.headRotEnabled == 0 ) + { + return IVAS_ERR_OK; + } +#endif + return ivas_orient_trk_SetTrackingType_fx( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); } @@ -5338,15 +5406,15 @@ ivas_error IVAS_REND_CombineHeadAndExternalOrientation( * Local functions *-------------------------------------------------------------------*/ /* Take one channel from input buffer and copy it to each channel - in output buffer, with different gain applied per output channel. - This function takes 2 gain vectors - one for the beginning and one - for the end of the buffer. Gain values are lineraly interpolated - for all samples in between. */ + in output buffer, with different gain applied per output channel. + This function takes 2 gain vectors - one for the beginning and one + for the end of the buffer. Gain values are lineraly interpolated + for all samples in between. */ /* Take one channel from input buffer and copy it to each channel - in output buffer, with different gain applied per output channel. - This function takes 2 gain vectors - one for the beginning and one - for the end of the buffer. Gain values are lineraly interpolated - for all samples in between. */ + in output buffer, with different gain applied per output channel. + This function takes 2 gain vectors - one for the beginning and one + for the end of the buffer. Gain values are lineraly interpolated + for all samples in between. */ static void renderBufferChannelLerp_fx( const IVAS_REND_AudioBuffer inAudio, const Word32 inChannelIdx, @@ -5497,7 +5565,7 @@ static void renderBufferChannelLerp_fx( /* Take one channel from input buffer and copy it to each channel - in output buffer, with different gain applied per output channel */ + in output buffer, with different gain applied per output channel */ static void renderBufferChannel_fx( const IVAS_REND_AudioBuffer inAudio, const Word32 inChannelIdx, @@ -5938,7 +6006,11 @@ static ivas_error renderIsmToBinauralRoom( hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( *hCombinedOrientationData != NULL ) +#else IF( hCombinedOrientationData != NULL ) +#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -6081,8 +6153,6 @@ static ivas_error renderIsmToBinauralRoom( } } - move16(); - #ifdef FIX_1843_IO_QFACTOR_INIT *ismInput->crendWrapper->p_io_qfactor = *exp; #endif @@ -6752,17 +6822,23 @@ static ivas_error renderMcToBinaural( Word16 i; Word16 exp = *outAudio.pq_fact; move16(); + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpRendBuffer_fx[i] = tmpRendBuffer_fx[i]; } push_wmops( "renderMcToBinaural" ); + inConfig = mcInput->base.inConfig; move32(); hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( *hCombinedOrientationData != NULL ) +#else IF( hCombinedOrientationData != NULL ) +#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -6883,7 +6959,11 @@ static ivas_error renderMcToBinauralRoom( hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( *hCombinedOrientationData != NULL ) +#else IF( hCombinedOrientationData != NULL ) +#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -7007,7 +7087,11 @@ static ivas_error renderMcCustomLsToBinauralRoom( hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( *hCombinedOrientationData != NULL ) +#else IF( hCombinedOrientationData != NULL ) +#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -7712,7 +7796,6 @@ static ivas_error renderSbaToBinaural( } ELSE { - FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { output_fx[i] = output_buffer_fx[i]; @@ -7722,7 +7805,11 @@ static ivas_error renderSbaToBinaural( hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( *hCombinedOrientationData != NULL ) +#else IF( hCombinedOrientationData != NULL ) +#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -7734,6 +7821,7 @@ static ivas_error renderSbaToBinaural( } } } + /* apply rotation */ IF( combinedOrientationEnabled ) { @@ -7820,7 +7908,11 @@ static ivas_error renderSbaToBinauralRoom( hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData; combinedOrientationEnabled = 0; move16(); +#ifdef FIX_1135_EXT_RENDERER_HANDLES + IF( *hCombinedOrientationData != NULL ) +#else IF( hCombinedOrientationData != NULL ) +#endif { FOR( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ ) { @@ -9010,7 +9102,7 @@ ivas_error IVAS_REND_GetSplitBinauralBitstream( hIvasRend->splitRendEncBuffer.config.numSamplesPerChannel *= cldfb_in_flag ? 2 : 1; /* hIvasRend->splitRendEncBuffer used for BINAURAL_SPLIT_CODED output - outAudio used for BINAURAL_SPLIT_PCM output */ + outAudio used for BINAURAL_SPLIT_PCM output */ return getSamplesInternal( hIvasRend, outAudio, hBits ); }