diff --git a/apps/decoder.c b/apps/decoder.c index c3a0a6c4b1a9cdf2d06e82cdfe5b681b18b463c6..5e2297132b3221543697e63a749a30b75e407dd6 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -133,7 +133,6 @@ typedef struct bool applyPiData; char *piOutputFilename; bool rtpOutSR; - bool evsMode; IVAS_ROOM_SIZE_T roomSize; } DecArguments; @@ -901,7 +900,6 @@ static bool parseCmdlIVAS_dec( arg->output_Fs = IVAS_MAX_SAMPLING_RATE; arg->outputConfig = IVAS_AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; - arg->evsMode = false; arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; arg->voipMode = false; @@ -1395,7 +1393,6 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( argv_to_upper, "-EVS" ) == 0 ) { - arg->evsMode = true; arg->decMode = IVAS_DEC_MODE_EVS; i++; } @@ -1486,7 +1483,7 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } - else if ( arg->non_diegetic_pan_enabled && arg->outputConfig == IVAS_AUDIO_CONFIG_STEREO && arg->evsMode ) + else if ( arg->non_diegetic_pan_enabled && arg->outputConfig == IVAS_AUDIO_CONFIG_STEREO && arg->decMode == IVAS_DEC_MODE_EVS ) { fprintf( stderr, "Error: Both non-diegetic panning and stereo output specified!\n\n" ); usage_dec(); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 5e5d3c5bdca0188ca82a747cfa18ef8b0931f97d..def4c806b0c503d9d922a5721a416b32e19b959d 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1126,8 +1126,8 @@ void ivas_mono_stereo_downmix_mcmasa_fx( ); void ivas_apply_non_diegetic_panning_fx( - Word32 *input_f_fx, /* i : non-diegetic object */ - Word32 *output_fx[], /* i/o: core-coder transport mono channel/stereo output */ + Word32 *input_f_fx, /* i : non-diegetic object (mono channel) */ + Word32 *output_fx[], /* o : stereo output channels */ const Word16 non_diegetic_pan_gain_fx, /* i : non-diegetic panning gain */ const Word16 output_frame /* i : output frame length per channel */ ); @@ -3733,6 +3733,12 @@ void ivas_mc2sba_fx( const Word16 gain_lfe /* i : gain for LFE, 0 = ignore LFE */ ); +void ivas_stereo2sba_fx( + Word32 *input_fx[], /* i : core-coder transport stereo channels */ + Word32 *output_fx[], /* o : SBA output channels */ + const Word16 output_frame /* i : output frame length per channel */ +); + void ivas_param_mc_mc2sba_cldfb_fx( IVAS_OUTPUT_SETUP hTransSetup, /* i : transported MC Format */ Word32 *hoa_encoder, /* i : HOA3 encoder for the transported MC format */ @@ -3885,6 +3891,7 @@ void ivas_set_ism_importance_interformat_fx( const Word16 lp_noise_CPE_fx, /* i : LP filtered total noise estimation */ Word16 ism_imp[] /* o : ISM importance flags */ ); + void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( Decoder_Struct *st_ivas, Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ @@ -3894,7 +3901,6 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx( const Word16 subframe ); - void ivas_omasa_decode_masa_to_total_fx( UWord16 *bit_stream, Word16 *index, diff --git a/lib_com/options.h b/lib_com/options.h index 708e7f6334a83fd61299f17359b1e0e3e73a72d5..79e1dd01566b89e6fb52354cdc89520519925749 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -81,6 +81,9 @@ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ +#define FIX_1435_MOVE_STEREO_PANNING /* VA: issue 1435: do the EVS stereo panning in the renderer */ +#define FIX_1454_FIX_STEREO_TO_FOA_JBM /* VA: issue 1454: fix buggy stereo to FOA in JBM */ + /* #################### End BASOP porting switches ############################ */ #endif diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index de5d9e4707eb619e10ff2e38fbdc54431f34d629..78ef3baa4b66d77d67202a854633bdcebfda5e57 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -1136,6 +1136,7 @@ ivas_error ivas_dec_setup( * Initialize decoder in the first good frame based on IVAS format * and number of transport channels *-------------------------------------------------------------------*/ + test(); IF( st_ivas->ini_frame == 0 && NE_32( st_ivas->ivas_format, UNDEFINED_FORMAT ) ) { @@ -1579,7 +1580,6 @@ ivas_error ivas_init_decoder_front( * Allocate and initialize Binaural Renderer configuration handle *--------------------------------------------------------------------*/ - test(); test(); test(); @@ -1726,12 +1726,6 @@ ivas_error ivas_init_decoder_fx( move16(); } - test(); - IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) || EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) - { - st_ivas->transport_config = EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ? IVAS_AUDIO_CONFIG_MONO : IVAS_AUDIO_CONFIG_STEREO; - } - /* Only initialize transport setup if it is used */ IF( NE_32( st_ivas->transport_config, IVAS_AUDIO_CONFIG_INVALID ) ) { @@ -1897,6 +1891,8 @@ ivas_error ivas_init_decoder_fx( { st_ivas->nchan_transport = CPE_CHANNELS; move16(); + st_ivas->intern_config = IVAS_AUDIO_CONFIG_STEREO; + move32(); st_ivas->nSCE = 0; move16(); @@ -3955,6 +3951,7 @@ static ivas_error doSanityChecks_IVAS( { return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" ); } + test(); test(); IF( ( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) || EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) && @@ -3963,7 +3960,6 @@ static ivas_error doSanityChecks_IVAS( return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" ); } - test(); test(); IF( ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && NE_32( output_Fs, 48000 ) ) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index c968e81b843a93e29e9f04f4a6a2977b87e34a57..d2fd53cc9b230e047b90d244d31dfb557e231698 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -1719,6 +1719,11 @@ ivas_error ivas_jbm_dec_render_fx( /*----------------------------------------------------------------* * Rendering *----------------------------------------------------------------*/ + + *nSamplesRendered = s_min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + move16(); + + test(); test(); IF( EQ_32( st_ivas->ivas_format, UNDEFINED_FORMAT ) ) { @@ -1726,6 +1731,7 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_BUFFER ) ) { +#ifndef FIX_1435_MOVE_STEREO_PANNING Word16 slot_size, tmp, e; slot_size = st_ivas->hTcBuffer->n_samples_granularity; @@ -1734,37 +1740,29 @@ ivas_error ivas_jbm_dec_render_fx( /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ tmp = BASOP_Util_Divide1616_Scale( nSamplesAsked, slot_size, &e ); tmp = shr( tmp, sub( 15, e ) ); - +#endif ivas_jbm_dec_tc_buffer_playout_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output_fx ); } ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) || EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) { - *nSamplesRendered = s_min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); - move16(); - /* Rendering */ IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) ) { - ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc_fx, p_output_fx ); } +#ifdef FIX_1435_MOVE_STEREO_PANNING + ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) + { + ivas_apply_non_diegetic_panning_fx( p_tc_fx[0], p_output_fx, st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx, *nSamplesRendered ); + } +#endif ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) { - IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) - { - /* routed to W */ - ivas_jbm_dec_tc_buffer_playout_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output_fx ); - } - ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) - { - FOR( n = 0; n < *nSamplesRendered; n++ ) - { - Word32 tmp; - tmp = p_output_fx[0][n]; - p_output_fx[0][n] = L_shr( L_add( tmp, p_output_fx[1][n] ), 1 ); /* W = 0.5 * ( L + R ) */ - p_output_fx[1][n] = L_shr( L_sub( tmp, p_output_fx[1][n] ), 1 ); /* Y = 0.5 * ( L - R ) */ - } - } +#ifdef FIX_1454_FIX_STEREO_TO_FOA_JBM + ivas_stereo2sba_fx( p_tc_fx, p_output_fx, *nSamplesRendered ); +#else + ivas_stereo2sba_fx( p_output_fx, p_output_fx, *nSamplesRendered ); +#endif } } ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) @@ -1792,9 +1790,6 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE /* ISM_MODE_DISC */ { - *nSamplesRendered = s_min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); - move16(); - test(); test(); /* Loudspeaker or Ambisonics rendering */ @@ -1975,9 +1970,6 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OSBA_STEREO ) ) { - *nSamplesRendered = s_min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); - move16(); - test(); /* shift SBA channels to avoid overwrite by ISM upmix in 1 object case and non-TSM unified channel memory*/ IF( EQ_16( st_ivas->nchan_ism, 1 ) && EQ_16( st_ivas->hDecoderConfig->Opt_tsm, 0 ) ) @@ -2060,8 +2052,6 @@ ivas_error ivas_jbm_dec_render_fx( { Word16 crendInPlaceRotation = FALSE; move16(); - *nSamplesRendered = s_min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); - move16(); test(); test(); @@ -2156,9 +2146,6 @@ ivas_error ivas_jbm_dec_render_fx( } ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) ) { - *nSamplesRendered = s_min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); - move16(); - ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc_fx, p_output_fx ); } ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) @@ -3084,7 +3071,6 @@ Word16 ivas_jbm_dec_get_num_tc_channels_fx( Word32 ivas_total_brate; AUDIO_CONFIG output_config; - IF( EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) ) { num_tc = st_ivas->hDecoderConfig->nchan_out; @@ -3104,7 +3090,17 @@ Word16 ivas_jbm_dec_get_num_tc_channels_fx( test(); test(); test(); +#ifdef FIX_1435_MOVE_STEREO_PANNING + test(); + IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) + { + num_tc = 1; + move16(); + } + ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) && EQ_16( st_ivas->hDecoderConfig->nchan_out, 1 ) ) +#else IF( EQ_16( st_ivas->ivas_format, STEREO_FORMAT ) && EQ_16( st_ivas->hDecoderConfig->nchan_out, 1 ) ) +#endif { num_tc = 1; move16(); @@ -3246,11 +3242,13 @@ Word16 ivas_jbm_dec_get_num_tc_channels_fx( } } } +#ifndef FIX_1435_MOVE_STEREO_PANNING ELSE IF( EQ_16( st_ivas->ivas_format, MONO_FORMAT ) && EQ_16( st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) { num_tc = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; move16(); } +#endif return num_tc; } @@ -3771,6 +3769,9 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode_fx( buffer_mode = TC_BUFFER_MODE_BUFFER; move16(); BREAK; +#ifdef FIX_1435_MOVE_STEREO_PANNING + case RENDERER_NON_DIEGETIC_DOWNMIX: +#endif case RENDERER_TD_PANNING: case RENDERER_BINAURAL_OBJECTS_TD: case RENDERER_BINAURAL_FASTCONV: @@ -3789,6 +3790,7 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode_fx( buffer_mode = TC_BUFFER_MODE_RENDERER; move16(); BREAK; +#ifndef FIX_1435_MOVE_STEREO_PANNING case RENDERER_NON_DIEGETIC_DOWNMIX: IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) { @@ -3801,6 +3803,7 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode_fx( move16(); } break; +#endif case RENDERER_MC_PARAMMC: IF( EQ_32( st_ivas->hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) { diff --git a/lib_dec/ivas_mono_dmx_renderer_fx.c b/lib_dec/ivas_mono_dmx_renderer_fx.c index 6c64eee816fc5cfbb4db6c676a09e080e004d4bc..fffcfff2ec363dd5a5f5c9de844170207d7d87db 100644 --- a/lib_dec/ivas_mono_dmx_renderer_fx.c +++ b/lib_dec/ivas_mono_dmx_renderer_fx.c @@ -317,10 +317,10 @@ void ivas_mono_stereo_downmix_mcmasa_fx( *------------------------------------------------------------------------*/ void ivas_apply_non_diegetic_panning_fx( - Word32 *input_f_fx, /* i : non-diegetic object */ - Word32 *output_fx[], /* o: core-coder transport mono channel/stereo output */ - const Word16 non_diegetic_pan_gain_fx, /* i : non-diegetic panning gain Q15*/ - const Word16 output_frame /* i : output frame length per channel Q11*/ + Word32 *input_f_fx, /* i : non-diegetic object (mono channel) */ + Word32 *output_fx[], /* o : stereo output channels */ + const Word16 non_diegetic_pan_gain_fx, /* i : non-diegetic panning gain Q15*/ + const Word16 output_frame /* i : output frame length per channel */ ) { Word16 pan_left_fx, pan_right_fx; diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c index 48305b524007f5a031ec98af79f2ed468cc1da06..abf80add0da1b9f2af4f621c1d3680a42b573064 100644 --- a/lib_dec/ivas_output_config_fx.c +++ b/lib_dec/ivas_output_config_fx.c @@ -37,34 +37,13 @@ #include "wmc_auto.h" #include "ivas_prot_fx.h" -static void ms_bin_upmix_renderer_select( - const IVAS_FORMAT ivas_format, /* i : Decoder format */ - IVAS_AUDIO_CONFIG *internal_config, /* o : Internal configuration for rendering */ - RENDERER_TYPE *renderer_type /* o : Selected renderer type */ -) -{ - - *internal_config = EQ_32( ivas_format, MONO_FORMAT ) ? IVAS_AUDIO_CONFIG_MONO : IVAS_AUDIO_CONFIG_STEREO; - - IF( EQ_32( ivas_format, MONO_FORMAT ) ) - { - *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; - move16(); - } - ELSE - { - *renderer_type = RENDERER_DISABLE; - move16(); - } - return; -} - /*-------------------------------------------------------------------------* * ivas_renderer_select() * * Select and configure IVAS renderer parameters *-------------------------------------------------------------------------*/ + void ivas_renderer_select( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -110,9 +89,15 @@ void ivas_renderer_select( test(); test(); test(); - IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) || EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) + IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) + { + *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; + move16(); + } + ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) { - ms_bin_upmix_renderer_select( st_ivas->ivas_format, internal_config, renderer_type ); + *renderer_type = RENDERER_DISABLE; + move16(); } ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) { @@ -298,47 +283,43 @@ void ivas_renderer_select( * Non-binaural rendering configurations *-----------------------------------------------------------------*/ - ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) || EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) + ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) { - *internal_config = EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ? IVAS_AUDIO_CONFIG_MONO : IVAS_AUDIO_CONFIG_STEREO; - move16(); - - SWITCH( output_config ) + test(); + test(); + test(); + test(); + test(); + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { - case IVAS_AUDIO_CONFIG_FOA: - case IVAS_AUDIO_CONFIG_HOA2: - case IVAS_AUDIO_CONFIG_HOA3: - *renderer_type = RENDERER_SBA_LINEAR_ENC; - move16(); - BREAK; - case IVAS_AUDIO_CONFIG_5_1: - case IVAS_AUDIO_CONFIG_7_1: - case IVAS_AUDIO_CONFIG_5_1_2: - case IVAS_AUDIO_CONFIG_5_1_4: - case IVAS_AUDIO_CONFIG_7_1_4: - case IVAS_AUDIO_CONFIG_LS_CUSTOM: - *renderer_type = RENDERER_MC; - move16(); - BREAK; - case IVAS_AUDIO_CONFIG_MONO: - IF( EQ_32( *internal_config, IVAS_AUDIO_CONFIG_STEREO ) ) - { - /* stereo to mono downmix */ - *renderer_type = RENDERER_MC; - move16(); - } - BREAK; - case IVAS_AUDIO_CONFIG_STEREO: - IF( EQ_32( *internal_config, IVAS_AUDIO_CONFIG_MONO ) ) - { - /* mono to stereo upmix */ - *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; - move16(); - } - BREAK; - default: - /* RENDERER_DISABLE already set by default */ - BREAK; + *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX; + move16(); + } + ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + *renderer_type = RENDERER_MC; + move16(); + } + } + ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) ) + { + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) + { + *renderer_type = RENDERER_SBA_LINEAR_ENC; + move16(); + } + ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + { + *renderer_type = RENDERER_MC; + move16(); } } ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) ) diff --git a/lib_dec/ivas_sba_rendering_internal_fx.c b/lib_dec/ivas_sba_rendering_internal_fx.c index d9f7b26be0676b936f9d11c681b3001ed0332488..5d8724a19fb86c6aa84c2f1e09fa89d886408d50 100644 --- a/lib_dec/ivas_sba_rendering_internal_fx.c +++ b/lib_dec/ivas_sba_rendering_internal_fx.c @@ -212,6 +212,32 @@ void ivas_mc2sba_fx( } +/*-------------------------------------------------------------------------* + * ivas_stereo2sba() + * + * stereo signal is transformed into SBA in TD domain + *-------------------------------------------------------------------------*/ + +void ivas_stereo2sba_fx( + Word32 *input_fx[], /* i : core-coder transport stereo channels */ + Word32 *output_fx[], /* o : SBA output channels */ + const Word16 output_frame /* i : output frame length per channel */ +) +{ + Word16 n; + Word32 tmp; + + FOR( n = 0; n < output_frame; n++ ) + { + tmp = input_fx[0][n]; + output_fx[0][n] = L_shr( L_add( tmp, input_fx[1][n] ), 1 ); /* W = 0.5 * ( L + R ) */ + output_fx[1][n] = L_shr( L_sub( tmp, input_fx[1][n] ), 1 ); /* Y = 0.5 * ( L - R ) */ + } + + return; +} + + /*-------------------------------------------------------------------------* * ivas_param_mc_mc2sba_cldfb() * diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c index f33ca4b6610c360930c884c4a727d56aacb34b43..73ad8235a68f623db3a6e7e0c98effa4e3add174 100644 --- a/lib_dec/jbm_pcmdsp_apa_fx.c +++ b/lib_dec/jbm_pcmdsp_apa_fx.c @@ -690,7 +690,11 @@ UWord8 apa_exec_fx( ) { UWord16 i; +#ifdef FIX_1435_MOVE_STEREO_PANNING + Word16 frm_in[APA_BUF_PER_CHANNEL]; /* NOTE: this buffer could be smaller if alocated dynamically based on the actual sampling rate */ +#else Word16 frm_in[CPE_CHANNELS * APA_BUF / APA_MAX_NUM_CHANNELS]; /* in EVS, 2 output channels */ /* NOTE: this buffer could be smaller if alocated dynamically based on the actual sampling rate and number of channels */ +#endif UWord16 l_frm_out; Word16 l_rem; Word32 dl_scaled, dl_copied, l_frm_out_target; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 7954afd6905c9883c97087679645df5cd5e54354..9b849a0ae0fc81323afe7be00ed685c13bc39b31 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1048,6 +1048,8 @@ ivas_error IVAS_DEC_FeedFrame_Serial( { hIvasDec->st_ivas->hDecoderConfig->ivas_total_brate = ACELP_8k00; move32(); + hIvasDec->st_ivas->transport_config = IVAS_AUDIO_CONFIG_MONO; + move32(); IF( NE_32( ( error = ivas_init_decoder_fx( hIvasDec->st_ivas ) ), IVAS_ERR_OK ) ) { @@ -1651,6 +1653,9 @@ static ivas_error ivas_dec_setup_all( IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) ) { +#ifdef FIX_1435_MOVE_STEREO_PANNING + *nTransportChannels = 1; +#else IF( EQ_16( (Word16) hIvasDec->st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) { *nTransportChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; @@ -1659,6 +1664,7 @@ static ivas_error ivas_dec_setup_all( { *nTransportChannels = 1; } +#endif move16(); } ELSE @@ -3853,7 +3859,11 @@ static ivas_error apa_exec_evs_wrapper( { Word16 ch; UWord16 apa_buff_len; +#ifdef FIX_1435_MOVE_STEREO_PANNING + Word16 tmp_apaExecBuffer[APA_BUF_PER_CHANNEL]; +#else Word16 tmp_apaExecBuffer[CPE_CHANNELS * APA_BUF / APA_MAX_NUM_CHANNELS]; /* in EVS, 2 output channels */ +#endif DECODER_TC_BUFFER_HANDLE hTcBuffer; test(); @@ -5631,9 +5641,14 @@ static ivas_error evs_dec_main_fx( Decoder_Struct *st_ivas ) { DEC_CORE_HANDLE *hCoreCoder; +#ifndef FIX_1435_MOVE_STEREO_PANNING Word16 mixer_left_fx, mixer_right_fx; Word32 *p_output_fx[MAX_TRANSPORT_CHANNELS]; Word16 ch, i, nOutSamples; +#else + Word32 *p_output_fx[1]; + Word16 i, nOutSamples; +#endif Word16 output_16[L_FRAME48k]; ivas_error error; @@ -5647,6 +5662,9 @@ static ivas_error evs_dec_main_fx( mdct_switching_dec_fx( hCoreCoder[0] ); +#ifdef FIX_1435_MOVE_STEREO_PANNING + p_output_fx[0] = st_ivas->p_output_fx[0]; +#else FOR( ch = 0; ch < MAX_TRANSPORT_CHANNELS; ch++ ) { p_output_fx[ch] = st_ivas->p_output_fx[ch]; // Q0 @@ -5655,6 +5673,7 @@ static ivas_error evs_dec_main_fx( set_zero_fx( p_output_fx[ch], L_FRAME48k ); } } +#endif /* run the main EVS decoding routine */ IF( EQ_16( hCoreCoder[0]->codec_mode, MODE1 ) ) @@ -5706,6 +5725,7 @@ static ivas_error evs_dec_main_fx( st_ivas->BER_detect = hCoreCoder[0]->BER_detect; move16(); +#ifndef FIX_1435_MOVE_STEREO_PANNING IF( EQ_16( st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) ) { mixer_left_fx = add( shr( st_ivas->hDecoderConfig->non_diegetic_pan_gain_fx, Q1 ), ONE_IN_Q14 ); // Q14 @@ -5714,9 +5734,9 @@ static ivas_error evs_dec_main_fx( v_multc_fx_16( p_output_fx[0], mixer_right_fx, p_output_fx[1], nOutSamples ); /* Q11 */ v_multc_fx_16( p_output_fx[0], mixer_left_fx, p_output_fx[0], nOutSamples ); /* Q11 */ } +#endif - test(); - IF( st_ivas->hDecoderConfig->Opt_tsm && EQ_16( st_ivas->hDecoderConfig->nchan_out, 1 ) ) + /*if ( st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO )*/ { /* BE workaround: in order to keep EVS bit-exact wrt. TS 26.443, convert 'float' output data to 'short' before the TSM */ /* not applicable in BASOP */