Skip to content
...@@ -88,8 +88,7 @@ void ivas_mct_side_bits( ...@@ -88,8 +88,7 @@ void ivas_mct_side_bits(
for ( ch = 0; ch < nChannels; ch++ ) for ( ch = 0; ch < nChannels; ch++ )
{ {
st = sts[ch]; st = sts[ch];
if ( if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
st->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
{ {
continue; continue;
} }
...@@ -115,8 +114,7 @@ void ivas_mct_side_bits( ...@@ -115,8 +114,7 @@ void ivas_mct_side_bits(
{ {
st = sts[ch]; st = sts[ch];
if ( if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
st->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
{ {
chBitRatios[ch] = 0; chBitRatios[ch] = 0;
st->bits_frame_channel = 0; st->bits_frame_channel = 0;
...@@ -203,8 +201,7 @@ void ivas_mct_core_dec( ...@@ -203,8 +201,7 @@ void ivas_mct_core_dec(
for ( ch = 0, i = 0; ch < nChannels; ch++ ) for ( ch = 0, i = 0; ch < nChannels; ch++ )
{ {
if ( if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE )
{ {
continue; continue;
} }
......
...@@ -54,14 +54,12 @@ ...@@ -54,14 +54,12 @@
* Local function prototypes * Local function prototypes
*-----------------------------------------------------------------------*/ *-----------------------------------------------------------------------*/
static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, #ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, const PCM_RESOLUTION pcm_resolution, void *data );
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */
#else #else
int16_t *data /* o : output synthesis signal */ static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, int16_t *data );
#endif #endif
);
/*--------------------------------------------------------------------------* /*--------------------------------------------------------------------------*
* ivas_mct_dec() * ivas_mct_dec()
...@@ -378,6 +376,7 @@ ivas_error create_mct_dec( ...@@ -378,6 +376,7 @@ ivas_error create_mct_dec(
cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS; cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS;
} }
#endif #endif
/* indicate LFE for appropriate core-coder channel */ /* indicate LFE for appropriate core-coder channel */
for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{ {
...@@ -515,6 +514,7 @@ ivas_error mct_dec_reconfigure( ...@@ -515,6 +514,7 @@ ivas_error mct_dec_reconfigure(
cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS; cp_bitrate = st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS;
} }
#endif #endif
/* set correct nominal bitrates and igf config already here, otherwise we /* set correct nominal bitrates and igf config already here, otherwise we
* run into a number of problems */ * run into a number of problems */
for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
...@@ -657,7 +657,7 @@ ivas_error ivas_mc_dec_config( ...@@ -657,7 +657,7 @@ ivas_error ivas_mc_dec_config(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
const int16_t idx, /* i : LS config. index */ const int16_t idx, /* i : LS config. index */
uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -669,8 +669,6 @@ ivas_error ivas_mc_dec_config( ...@@ -669,8 +669,6 @@ ivas_error ivas_mc_dec_config(
MC_MODE last_mc_mode; MC_MODE last_mc_mode;
ivas_error error; ivas_error error;
error = IVAS_ERR_OK;
/* store last frame MC mode */ /* store last frame MC mode */
last_mc_mode = st_ivas->mc_mode; last_mc_mode = st_ivas->mc_mode;
...@@ -692,18 +690,22 @@ ivas_error ivas_mc_dec_config( ...@@ -692,18 +690,22 @@ 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 ) 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 )
{ {
ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, #ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
pcm_resolution, #else
if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK )
#endif #endif
data );
{
return error;
}
} }
} }
st_ivas->transport_config = signaled_config; st_ivas->transport_config = signaled_config;
} }
return error; return IVAS_ERR_OK;
} }
...@@ -716,7 +718,7 @@ ivas_error ivas_mc_dec_config( ...@@ -716,7 +718,7 @@ ivas_error ivas_mc_dec_config(
static ivas_error ivas_mc_dec_reconfig( static ivas_error ivas_mc_dec_reconfig(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -803,11 +805,11 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -803,11 +805,11 @@ static ivas_error ivas_mc_dec_reconfig(
tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs );
if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity )
{ {
if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, #ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
pcm_resolution, #else
if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ) != IVAS_ERR_OK )
#endif #endif
data ) ) != IVAS_ERR_OK )
{ {
return error; return error;
} }
...@@ -822,7 +824,6 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -822,7 +824,6 @@ static ivas_error ivas_mc_dec_reconfig(
} }
} }
if ( st_ivas->mc_mode == MC_MODE_MCT ) if ( st_ivas->mc_mode == MC_MODE_MCT )
{ {
st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) );
...@@ -962,11 +963,8 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -962,11 +963,8 @@ static ivas_error ivas_mc_dec_reconfig(
ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) ); ivas_mc_paramupmix_dec_close( &( st_ivas->hMCParamUpmix ) );
} }
if ( st_ivas->hLFE != NULL )
{
/* LFE handle */ /* LFE handle */
ivas_lfe_dec_close( &( st_ivas->hLFE ) ); ivas_lfe_dec_close( &( st_ivas->hLFE ) );
}
#endif #endif
} }
else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
...@@ -1010,11 +1008,8 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -1010,11 +1008,8 @@ static ivas_error ivas_mc_dec_reconfig(
} }
#ifdef NONBE_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX #ifdef NONBE_FIX_722_MEMORY_LEAK_IN_PARAMUPMIX
if ( st_ivas->hLFE != NULL )
{
/* LFE handle */ /* LFE handle */
ivas_lfe_dec_close( &( st_ivas->hLFE ) ); ivas_lfe_dec_close( &( st_ivas->hLFE ) );
}
#endif #endif
} }
...@@ -1063,7 +1058,6 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -1063,7 +1058,6 @@ static ivas_error ivas_mc_dec_reconfig(
if ( st->hHQ_core == NULL ) if ( st->hHQ_core == NULL )
{ {
if ( ( st->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL ) if ( ( st->hHQ_core = (HQ_DEC_HANDLE) malloc( sizeof( HQ_DEC_DATA ) ) ) == NULL )
{ {
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) ); return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) );
...@@ -1127,7 +1121,6 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -1127,7 +1121,6 @@ static ivas_error ivas_mc_dec_reconfig(
} }
} }
/*-----------------------------------------------------------------* /*-----------------------------------------------------------------*
* re-configure HP20 memories * re-configure HP20 memories
*-----------------------------------------------------------------*/ *-----------------------------------------------------------------*/
...@@ -1137,10 +1130,10 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -1137,10 +1130,10 @@ static ivas_error ivas_mc_dec_reconfig(
return error; return error;
} }
/*-----------------------------------------------------------------* /*-----------------------------------------------------------------*
* Allocate the LFE handle that is coded separately after the allocation of the core coders * Allocate the LFE handle that is coded separately after the allocation of the core coders
*-----------------------------------------------------------------*/ *-----------------------------------------------------------------*/
if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL ) if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL )
{ {
int32_t binauralization_delay_ns = st_ivas->binaural_latency_ns; int32_t binauralization_delay_ns = st_ivas->binaural_latency_ns;
...@@ -1226,12 +1219,12 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -1226,12 +1219,12 @@ static ivas_error ivas_mc_dec_reconfig(
if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hIntSetup.output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hIntSetup.output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) )
#endif #endif
{ {
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper )
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
, ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses );
st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses #else
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
#endif #endif
);
} }
if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) )
...@@ -1272,12 +1265,11 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -1272,12 +1265,11 @@ static ivas_error ivas_mc_dec_reconfig(
if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
{ {
if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
, if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper, 1 ) ) != IVAS_ERR_OK )
1 #else
if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK )
#endif #endif
) ) != IVAS_ERR_OK )
{ {
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" );
} }
...@@ -1301,12 +1293,11 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -1301,12 +1293,11 @@ static ivas_error ivas_mc_dec_reconfig(
} }
else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) )
{ {
if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs
#ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
, if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses #else
if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
#endif #endif
) ) != IVAS_ERR_OK )
{ {
return error; return error;
} }
...@@ -1347,6 +1338,7 @@ static ivas_error ivas_mc_dec_reconfig( ...@@ -1347,6 +1338,7 @@ static ivas_error ivas_mc_dec_reconfig(
/*-----------------------------------------------------------------* /*-----------------------------------------------------------------*
* Reconfigure TC buffer * Reconfigure TC buffer
*-----------------------------------------------------------------*/ *-----------------------------------------------------------------*/
if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) if ( st_ivas->hDecoderConfig->Opt_5ms == 1 )
{ {
int16_t tc_nchan_full_new; int16_t tc_nchan_full_new;
......
...@@ -99,8 +99,7 @@ void ivas_mct_dec_mct( ...@@ -99,8 +99,7 @@ void ivas_mct_dec_mct(
/*first get core and overlap info for all channels*/ /*first get core and overlap info for all channels*/
for ( ch = 0; ch < nchan; ch++ ) for ( ch = 0; ch < nchan; ch++ )
{ {
if ( if ( hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE )
hMCT->currBlockDataCnt && sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE )
{ {
hMCT->mc_global_ild[ch] = get_next_indice( sts[0], SMDCT_GLOBAL_ILD_BITS ); hMCT->mc_global_ild[ch] = get_next_indice( sts[0], SMDCT_GLOBAL_ILD_BITS );
} }
...@@ -124,8 +123,7 @@ void ivas_mct_dec_mct( ...@@ -124,8 +123,7 @@ void ivas_mct_dec_mct(
for ( ch = 0; ch < nchan; ch++ ) for ( ch = 0; ch < nchan; ch++ )
{ {
if ( if ( sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE )
sts[ch]->mct_chan_mode != MCT_CHAN_MODE_IGNORE )
{ {
nchan_active++; nchan_active++;
} }
...@@ -305,8 +303,7 @@ void mctStereoIGF_dec( ...@@ -305,8 +303,7 @@ void mctStereoIGF_dec(
if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE ) ) != 0 ) if ( sum_s( singleChEle, ( hMCT->nchan_out_woLFE ) ) != 0 )
{ {
for ( ch = 0; ch < ( hMCT->nchan_out_woLFE ); for ( ch = 0; ch < ( hMCT->nchan_out_woLFE ); ch++ )
ch++ )
{ {
if ( singleChEle[ch] ) if ( singleChEle[ch] )
{ {
......
...@@ -197,6 +197,7 @@ static void dec_prm_tcx_sidebits( ...@@ -197,6 +197,7 @@ static void dec_prm_tcx_sidebits(
getTCXparam( st, st0, hm_cfg, param, 0, 0, ( ( ch > 0 ) && ( tnsSize ) && ( tnsSize[0] + tnsSize[1] > 0 ) ? tnsSize : NULL ), p_param, nTnsBitsTCX10, 0 ); getTCXparam( st, st0, hm_cfg, param, 0, 0, ( ( ch > 0 ) && ( tnsSize ) && ( tnsSize[0] + tnsSize[1] > 0 ) ? tnsSize : NULL ), p_param, nTnsBitsTCX10, 0 );
st->side_bits_frame_channel = st0->next_bit_pos - start_bit_pos; st->side_bits_frame_channel = st0->next_bit_pos - start_bit_pos;
return; return;
} }
...@@ -523,7 +524,6 @@ void ivas_mdct_core_invQ( ...@@ -523,7 +524,6 @@ void ivas_mdct_core_invQ(
TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode_bfi; TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode_bfi;
push_wmops( "mdct_core_invQ" ); push_wmops( "mdct_core_invQ" );
sts = hCPE->hCoreCoder; sts = hCPE->hCoreCoder;
bfi = sts[0]->bfi; bfi = sts[0]->bfi;
noise_gen_mode_bfi = NOISE_GEN_MODE_UNDEF; noise_gen_mode_bfi = NOISE_GEN_MODE_UNDEF;
...@@ -1043,8 +1043,7 @@ void ivas_mdct_core_tns_ns( ...@@ -1043,8 +1043,7 @@ void ivas_mdct_core_tns_ns(
L_frameTCX_glob[ch] = st->hTcxDec->L_frameTCX / nSubframes[ch]; L_frameTCX_glob[ch] = st->hTcxDec->L_frameTCX / nSubframes[ch];
L_spec[ch] = st->hTcxCfg->tcx_coded_lines / nSubframes[ch]; L_spec[ch] = st->hTcxCfg->tcx_coded_lines / nSubframes[ch];
if ( if ( ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) || ( st->bfi && st->core == ACELP_CORE ) ) /* indicates LFE with no content, or odd number of channels */
( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) || ( st->bfi && st->core == ACELP_CORE ) ) /* indicates LFE with no content, or odd number of channels */
{ {
if ( st->hTonalMDCTConc != NULL ) if ( st->hTonalMDCTConc != NULL )
{ {
......
...@@ -187,6 +187,7 @@ void ivas_mono_stereo_downmix_mcmasa( ...@@ -187,6 +187,7 @@ void ivas_mono_stereo_downmix_mcmasa(
return; return;
} }
#ifdef FIX_764_HARM_CODE #ifdef FIX_764_HARM_CODE
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* ivas_apply_non_diegetic_panning() * ivas_apply_non_diegetic_panning()
......
...@@ -82,9 +82,7 @@ ivas_error ivas_td_binaural_renderer( ...@@ -82,9 +82,7 @@ ivas_error ivas_td_binaural_renderer(
int16_t ism_md_subframe_update; int16_t ism_md_subframe_update;
int16_t nchan_transport; int16_t nchan_transport;
nchan_transport = ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_SBA_MODE_DISC ) nchan_transport = ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ? st_ivas->nchan_ism : st_ivas->nchan_transport;
? st_ivas->nchan_ism
: st_ivas->nchan_transport;
if ( st_ivas->hDecoderConfig->Opt_delay_comp ) if ( st_ivas->hDecoderConfig->Opt_delay_comp )
{ {
...@@ -100,18 +98,11 @@ ivas_error ivas_td_binaural_renderer( ...@@ -100,18 +98,11 @@ ivas_error ivas_td_binaural_renderer(
ism_md_subframe_update = 2; ism_md_subframe_update = 2;
} }
return ivas_td_binaural_renderer_unwrap( return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData,
st_ivas->hReverb,
st_ivas->transport_config,
st_ivas->hBinRendererTd,
nchan_transport,
LFE_CHANNEL, st_ivas->ivas_format,
st_ivas->hIsmMetaData,
( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation : NULL, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation : NULL,
( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL,
( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL,
ism_md_subframe_update, output, output_frame, ism_md_subframe_update, output, output_frame, MAX_PARAM_SPATIAL_SUBFRAMES );
MAX_PARAM_SPATIAL_SUBFRAMES );
} }
...@@ -216,14 +207,20 @@ ivas_error ivas_td_binaural_renderer_sf( ...@@ -216,14 +207,20 @@ ivas_error ivas_td_binaural_renderer_sf(
} }
if ( subframe_idx == ism_md_subframe_update_jbm ) if ( subframe_idx == ism_md_subframe_update_jbm )
{ {
TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ); if ( ( error = TDREND_Update_object_positions( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK )
{
return error;
}
} }
/* Update the listener's location/orientation */ /* Update the listener's location/orientation */
TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, if ( ( error = TDREND_Update_listener_orientation( st_ivas->hBinRendererTd,
( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] : 0, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] : 0,
( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL, ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->Quaternions : NULL,
( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL ); ( st_ivas->hCombinedOrientationData != NULL ) ? st_ivas->hCombinedOrientationData->listenerPos : NULL ) ) != IVAS_ERR_OK )
{
return error;
}
if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) if ( st_ivas->hRenderConfig != NULL && st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
{ {
......
...@@ -92,7 +92,6 @@ ivas_error ivas_omasa_data_open( ...@@ -92,7 +92,6 @@ ivas_error ivas_omasa_data_open(
hMasaIsmData->q_azimuth_old[ch] = 0.0f; hMasaIsmData->q_azimuth_old[ch] = 0.0f;
} }
for ( obj_idx = 0; obj_idx < MAX_NUM_OBJECTS; obj_idx++ ) for ( obj_idx = 0; obj_idx < MAX_NUM_OBJECTS; obj_idx++ )
{ {
set_s( hMasaIsmData->azimuth_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR ); set_s( hMasaIsmData->azimuth_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
...@@ -154,7 +153,7 @@ void ivas_omasa_data_close( ...@@ -154,7 +153,7 @@ void ivas_omasa_data_close(
ivas_error ivas_omasa_dec_config( ivas_error ivas_omasa_dec_config(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
#if defined SPLIT_REND_WITH_HEAD_ROT #ifdef SPLIT_REND_WITH_HEAD_ROT
const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */ const PCM_RESOLUTION pcm_resolution, /* i : type for the decoded PCM resolution */
void *data /* o : output synthesis signal */ void *data /* o : output synthesis signal */
#else #else
...@@ -202,11 +201,11 @@ ivas_error ivas_omasa_dec_config( ...@@ -202,11 +201,11 @@ ivas_error ivas_omasa_dec_config(
{ {
st_ivas->hCPE[0]->nchan_out = 1; st_ivas->hCPE[0]->nchan_out = 1;
} }
else if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, #ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT else if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
pcm_resolution, #else
else if ( ( error = ivas_masa_dec_reconfigure( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK )
#endif #endif
data ) ) != IVAS_ERR_OK )
{ {
return error; return error;
} }
...@@ -632,8 +631,7 @@ void ivas_omasa_dirac_rend( ...@@ -632,8 +631,7 @@ void ivas_omasa_dirac_rend(
dirac_read_idx = st_ivas->hSpatParamRendCom->dirac_read_idx; dirac_read_idx = st_ivas->hSpatParamRendCom->dirac_read_idx;
ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, MAX_PARAM_SPATIAL_SUBFRAMES );
MAX_PARAM_SPATIAL_SUBFRAMES );
st_ivas->hSpatParamRendCom->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */ st_ivas->hSpatParamRendCom->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */
...@@ -706,8 +704,7 @@ ivas_error ivas_omasa_dirac_td_binaural( ...@@ -706,8 +704,7 @@ ivas_error ivas_omasa_dirac_td_binaural(
delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
} }
ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport, ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport, MAX_PARAM_SPATIAL_SUBFRAMES );
MAX_PARAM_SPATIAL_SUBFRAMES );
if ( ( error = ivas_td_binaural_renderer( st_ivas, p_sepobj, output_frame ) ) != IVAS_ERR_OK ) if ( ( error = ivas_td_binaural_renderer( st_ivas, p_sepobj, output_frame ) ) != IVAS_ERR_OK )
{ {
......
...@@ -43,6 +43,81 @@ ...@@ -43,6 +43,81 @@
#include "wmc_auto.h" #include "wmc_auto.h"
#ifdef FIX_782_OSBA_FUNCTION_NAMES
/*-------------------------------------------------------------------*
* ivas_osba_data_open()
*
* Allocate and initialize SBA_ISM rendering handle
*-------------------------------------------------------------------*/
ivas_error ivas_osba_data_open(
Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */
)
{
SBA_ISM_DATA_HANDLE hSbaIsmData;
int16_t i;
if ( ( hSbaIsmData = (SBA_ISM_DATA_HANDLE) malloc( sizeof( SBA_ISM_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OSBA data\n" ) );
}
hSbaIsmData->delayBuffer_nchan = st_ivas->nchan_ism;
hSbaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES );
if ( ( hSbaIsmData->delayBuffer = (float **) malloc( hSbaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for OSBA delay buffer \n" ) );
}
for ( i = 0; i < hSbaIsmData->delayBuffer_nchan; i++ )
{
if ( ( hSbaIsmData->delayBuffer[i] = (float *) malloc( hSbaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for OSBA delay buffer \n" ) );
}
set_zero( hSbaIsmData->delayBuffer[i], hSbaIsmData->delayBuffer_size );
}
st_ivas->hSbaIsmData = hSbaIsmData;
return IVAS_ERR_OK;
}
/*-------------------------------------------------------------------*
* ivas_osba_data_close()
*
* Deallocate SBA_ISM rendering handle
*-------------------------------------------------------------------*/
void ivas_osba_data_close(
SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */
)
{
int16_t i;
if ( hSbaIsmData == NULL || *hSbaIsmData == NULL )
{
return;
}
if ( ( *hSbaIsmData )->delayBuffer != NULL )
{
for ( i = 0; i < ( *hSbaIsmData )->delayBuffer_nchan; i++ )
{
free( ( *hSbaIsmData )->delayBuffer[i] );
}
free( ( *hSbaIsmData )->delayBuffer );
( *hSbaIsmData )->delayBuffer = NULL;
}
free( *hSbaIsmData );
*hSbaIsmData = NULL;
return;
}
#else
/*-------------------------------------------------------------------* /*-------------------------------------------------------------------*
* ivas_masa_ism_data_open() * ivas_masa_ism_data_open()
* *
...@@ -65,6 +140,8 @@ ivas_error ivas_masa_ism_data_open( ...@@ -65,6 +140,8 @@ ivas_error ivas_masa_ism_data_open(
return IVAS_ERR_OK; return IVAS_ERR_OK;
} }
/*-------------------------------------------------------------------* /*-------------------------------------------------------------------*
* ivas_masa_ism_data_close() * ivas_masa_ism_data_close()
* *
...@@ -127,15 +204,15 @@ ivas_error ivas_sba_ism_separate_object_renderer_open( ...@@ -127,15 +204,15 @@ ivas_error ivas_sba_ism_separate_object_renderer_open(
set_zero( st_ivas->hMasaIsmData->delayBuffer[i], st_ivas->hMasaIsmData->delayBuffer_size ); set_zero( st_ivas->hMasaIsmData->delayBuffer[i], st_ivas->hMasaIsmData->delayBuffer_size );
} }
return IVAS_ERR_OK; return IVAS_ERR_OK;
} }
#endif
/*--------------------------------------------------------------------------* /*--------------------------------------------------------------------------*
* ivas_osba_dirac_td_binaural() * ivas_osba_dirac_td_binaural()
* *
* Binaural rendering in OMASA format * Binaural rendering in OSBA format
*--------------------------------------------------------------------------*/ *--------------------------------------------------------------------------*/
ivas_error ivas_osba_dirac_td_binaural( ivas_error ivas_osba_dirac_td_binaural(
...@@ -146,7 +223,6 @@ ivas_error ivas_osba_dirac_td_binaural( ...@@ -146,7 +223,6 @@ ivas_error ivas_osba_dirac_td_binaural(
{ {
int16_t n; int16_t n;
float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];
ivas_error error; ivas_error error;
float *p_sepobj[MAX_NUM_OBJECTS]; float *p_sepobj[MAX_NUM_OBJECTS];
int16_t channel_offset; int16_t channel_offset;
...@@ -164,13 +240,16 @@ ivas_error ivas_osba_dirac_td_binaural( ...@@ -164,13 +240,16 @@ ivas_error ivas_osba_dirac_td_binaural(
} }
#ifdef OSBA_SPLIT_RENDERING #ifdef OSBA_SPLIT_RENDERING
if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif #endif
{ {
for ( n = 0; n < st_ivas->nchan_ism; n++ ) for ( n = 0; n < st_ivas->nchan_ism; n++ )
{ {
#ifdef FIX_782_OSBA_FUNCTION_NAMES
delay_signal( data_separated_objects[n], output_frame, st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hSbaIsmData->delayBuffer_size );
#else
delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); delay_signal( data_separated_objects[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
#endif
} }
} }
...@@ -183,8 +262,7 @@ ivas_error ivas_osba_dirac_td_binaural( ...@@ -183,8 +262,7 @@ ivas_error ivas_osba_dirac_td_binaural(
} }
else else
{ {
ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[channel_offset], st_ivas->nchan_transport, ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, &output[channel_offset], st_ivas->nchan_transport, MAX_PARAM_SPATIAL_SUBFRAMES );
MAX_PARAM_SPATIAL_SUBFRAMES );
} }
#ifdef DEBUG_OSBA #ifdef DEBUG_OSBA
...@@ -200,8 +278,7 @@ ivas_error ivas_osba_dirac_td_binaural( ...@@ -200,8 +278,7 @@ ivas_error ivas_osba_dirac_td_binaural(
} }
#endif #endif
#ifdef OSBA_SPLIT_RENDERING #ifdef OSBA_SPLIT_RENDERING
if ( ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{ {
int16_t slot_idx, num_cldfb_bands, b, nchan_transport_orig; int16_t slot_idx, num_cldfb_bands, b, nchan_transport_orig;
float Cldfb_RealBuffer[CLDFB_NO_CHANNELS_MAX]; float Cldfb_RealBuffer[CLDFB_NO_CHANNELS_MAX];
...@@ -266,6 +343,12 @@ ivas_error ivas_osba_dirac_td_binaural( ...@@ -266,6 +343,12 @@ ivas_error ivas_osba_dirac_td_binaural(
} }
/*-------------------------------------------------------------------------*
* ivas_osba_ism_metadata_dec()
*
* ISM metadata decoding in OSBA format.
*-------------------------------------------------------------------------*/
ivas_error ivas_osba_ism_metadata_dec( ivas_error ivas_osba_ism_metadata_dec(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
const int32_t ism_total_brate, /* i : ISM total bitrate */ const int32_t ism_total_brate, /* i : ISM total bitrate */
...@@ -280,7 +363,6 @@ ivas_error ivas_osba_ism_metadata_dec( ...@@ -280,7 +363,6 @@ ivas_error ivas_osba_ism_metadata_dec(
nchan_transport_ism = st_ivas->nchan_ism; nchan_transport_ism = st_ivas->nchan_ism;
*nchan_ism = st_ivas->nchan_ism; *nchan_ism = st_ivas->nchan_ism;
/* decode ISM metadata */ /* decode ISM metadata */
if ( ( error = ivas_ism_metadata_dec( ism_total_brate, *nchan_ism, &nchan_transport_ism, st_ivas->hIsmMetaData, NULL, st_ivas->bfi, if ( ( error = ivas_ism_metadata_dec( ism_total_brate, *nchan_ism, &nchan_transport_ism, st_ivas->hIsmMetaData, NULL, st_ivas->bfi,
nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt, st_ivas->hCPE[0]->hCoreCoder[0] ) ) != IVAS_ERR_OK ) nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL, &st_ivas->ism_extmeta_active, &st_ivas->ism_extmeta_cnt, st_ivas->hCPE[0]->hCoreCoder[0] ) ) != IVAS_ERR_OK )
...@@ -291,6 +373,7 @@ ivas_error ivas_osba_ism_metadata_dec( ...@@ -291,6 +373,7 @@ ivas_error ivas_osba_ism_metadata_dec(
return IVAS_ERR_OK; return IVAS_ERR_OK;
} }
/*-------------------------------------------------------------------------* /*-------------------------------------------------------------------------*
* ivas_osba_render() * ivas_osba_render()
* *
...@@ -329,7 +412,11 @@ ivas_error ivas_osba_render( ...@@ -329,7 +412,11 @@ ivas_error ivas_osba_render(
for ( n = 0; n < nchan_ism; n++ ) for ( n = 0; n < nchan_ism; n++ )
{ {
mvr2r( output_f[n], tmp_ism_out[n], output_frame ); mvr2r( output_f[n], tmp_ism_out[n], output_frame );
#ifdef FIX_782_OSBA_FUNCTION_NAMES
delay_signal( tmp_ism_out[n], output_frame, st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hSbaIsmData->delayBuffer_size );
#else
delay_signal( tmp_ism_out[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); delay_signal( tmp_ism_out[n], output_frame, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
#endif
} }
if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI ) if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI )
......
...@@ -1124,6 +1124,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( ...@@ -1124,6 +1124,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc(
return; return;
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* ivas_ls_setup_conversion_process_param_mc() * ivas_ls_setup_conversion_process_param_mc()
* *
...@@ -1149,7 +1150,6 @@ void ivas_lssetupconversion_process_param_mc( ...@@ -1149,7 +1150,6 @@ void ivas_lssetupconversion_process_param_mc(
LSSETUP_CONVERSION_HANDLE hLsSetUpConversion; LSSETUP_CONVERSION_HANDLE hLsSetUpConversion;
push_wmops( "LS_Renderer_Process_Param_MC" ); push_wmops( "LS_Renderer_Process_Param_MC" );
/* inits */ /* inits */
inChannels = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; inChannels = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe;
outChannels = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; outChannels = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe;
...@@ -1197,7 +1197,6 @@ void ivas_lssetupconversion_process_param_mc( ...@@ -1197,7 +1197,6 @@ void ivas_lssetupconversion_process_param_mc(
Cldfb_RealBuffer_InOut[chOutIdx][slotIdx][bandIdx] += tmpDMXSig; Cldfb_RealBuffer_InOut[chOutIdx][slotIdx][bandIdx] += tmpDMXSig;
targetEnergy[chOutIdx][bandIdx] += tmpDMXSig * tmpDMXSig; targetEnergy[chOutIdx][bandIdx] += tmpDMXSig * tmpDMXSig;
tmpDMXSig = dmxCoeff * Cldfb_ImagBuffer_tmp[chInIdx][bandIdx]; tmpDMXSig = dmxCoeff * Cldfb_ImagBuffer_tmp[chInIdx][bandIdx];
Cldfb_ImagBuffer_InOut[chOutIdx][slotIdx][bandIdx] += tmpDMXSig; Cldfb_ImagBuffer_InOut[chOutIdx][slotIdx][bandIdx] += tmpDMXSig;
targetEnergy[chOutIdx][bandIdx] += tmpDMXSig * tmpDMXSig; targetEnergy[chOutIdx][bandIdx] += tmpDMXSig * tmpDMXSig;
......
...@@ -362,8 +362,7 @@ void ivas_renderer_select( ...@@ -362,8 +362,7 @@ void ivas_renderer_select(
*renderer_type = RENDERER_DIRAC; *renderer_type = RENDERER_DIRAC;
ivas_format = ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_NONE ) ? SBA_FORMAT : st_ivas->ivas_format; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */ ivas_format = ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_NONE ) ? SBA_FORMAT : st_ivas->ivas_format; /* treat ISM_SBA_MODE_NONE just like SBA_FORMAT */
if ( ivas_format == SBA_FORMAT && if ( ivas_format == SBA_FORMAT && ( output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO ) )
( output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO ) )
{ {
if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA ) if ( output_config == IVAS_AUDIO_CONFIG_HOA2 || output_config == IVAS_AUDIO_CONFIG_FOA )
{ {
...@@ -481,6 +480,7 @@ void ivas_renderer_select( ...@@ -481,6 +480,7 @@ void ivas_renderer_select(
else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
{ {
*internal_config = output_config; *internal_config = output_config;
/* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */ /* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO ) if ( output_config == IVAS_AUDIO_CONFIG_MONO || output_config == IVAS_AUDIO_CONFIG_STEREO )
{ {
......
...@@ -200,7 +200,6 @@ void stereo_dft_dec_core_switching( ...@@ -200,7 +200,6 @@ void stereo_dft_dec_core_switching(
#if defined( DEBUG_MODE_DFT ) && defined( DEBUG_STEREO_DFT_NOCORE ) #if defined( DEBUG_MODE_DFT ) && defined( DEBUG_STEREO_DFT_NOCORE )
stereo_dft_dec_analyze( hCPE, output, DFT, 0, output_frame, output_frame, DFT_STEREO_DEC_ANA_NOCORE, 0, 0 ); stereo_dft_dec_analyze( hCPE, output, DFT, 0, output_frame, output_frame, DFT_STEREO_DEC_ANA_NOCORE, 0, 0 );
#else #else
/* resample DFT analysis memories in case of internal sampling rate change */ /* resample DFT analysis memories in case of internal sampling rate change */
if ( st->last_L_frame != st->L_frame && st->last_L_frame <= L_FRAME16k && st->L_frame <= L_FRAME16k ) if ( st->last_L_frame != st->L_frame && st->last_L_frame <= L_FRAME16k && st->L_frame <= L_FRAME16k )
{ {
...@@ -442,7 +441,6 @@ void stereo_dft_dec_core_switching( ...@@ -442,7 +441,6 @@ void stereo_dft_dec_core_switching(
} }
#endif #endif
/*----------------------------------------------------------------* /*----------------------------------------------------------------*
* enhanced stereo filling: allpass filter * enhanced stereo filling: allpass filter
*----------------------------------------------------------------*/ *----------------------------------------------------------------*/
......
...@@ -55,7 +55,6 @@ static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint ...@@ -55,7 +55,6 @@ static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint
static uint16_t ivas_qmetadata_DecodeQuasiUniform( const uint16_t *bitstream, int16_t *index, const uint16_t alphabet_size ); static uint16_t ivas_qmetadata_DecodeQuasiUniform( const uint16_t *bitstream, int16_t *index, const uint16_t alphabet_size );
static int16_t ivas_qmetadata_ReorderElevationDecoded( const int16_t elev_dist, const int16_t elev_avg, const int16_t elev_alph ); static int16_t ivas_qmetadata_ReorderElevationDecoded( const int16_t elev_dist, const int16_t elev_avg, const int16_t elev_alph );
static int16_t read_directions( IVAS_QDIRECTION *q_direction, const uint8_t coding_subbands, const uint8_t masa_subframes, uint16_t *bitstream, int16_t *pbit_pos, int16_t *ind_order ); static int16_t read_directions( IVAS_QDIRECTION *q_direction, const uint8_t coding_subbands, const uint8_t masa_subframes, uint16_t *bitstream, int16_t *pbit_pos, int16_t *ind_order );
...@@ -548,7 +547,6 @@ int16_t ivas_qmetadata_dec_decode( ...@@ -548,7 +547,6 @@ int16_t ivas_qmetadata_dec_decode(
#ifdef DEBUGGING #ifdef DEBUGGING
assert( ( diff_bits <= 0 ) || ( q_direction->not_in_2D == 0 ) ); assert( ( diff_bits <= 0 ) || ( q_direction->not_in_2D == 0 ) );
#endif #endif
/* Read raw-coded bits*/ /* Read raw-coded bits*/
for ( b = start_band; b < nbands; b++ ) for ( b = start_band; b < nbands; b++ )
{ {
...@@ -1075,7 +1073,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( ...@@ -1075,7 +1073,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512(
/* move 2 dir data to its correct subband */ /* move 2 dir data to its correct subband */
if ( bits_sph_idx == 11 ) if ( bits_sph_idx == 11 )
{ {
int16_t nblocks; int16_t nblocks;
d = hQMetaData->q_direction[1].cfg.nbands - 1; d = hQMetaData->q_direction[1].cfg.nbands - 1;
nblocks = hQMetaData->q_direction[0].cfg.nblocks; nblocks = hQMetaData->q_direction[0].cfg.nblocks;
...@@ -1316,7 +1313,6 @@ int16_t ivas_qmetadata_dec_sid_decode( ...@@ -1316,7 +1313,6 @@ int16_t ivas_qmetadata_dec_sid_decode(
} }
else else
{ {
/* Decode diffuseness*/ /* Decode diffuseness*/
for ( b = start_band; b < nbands; b++ ) for ( b = start_band; b < nbands; b++ )
{ {
...@@ -1351,9 +1347,7 @@ int16_t ivas_qmetadata_dec_sid_decode( ...@@ -1351,9 +1347,7 @@ int16_t ivas_qmetadata_dec_sid_decode(
q_direction->band_data[b].spherical_index[i] = value; q_direction->band_data[b].spherical_index[i] = value;
} }
deindex_spherical_component( q_direction->band_data[b].spherical_index[0], &avg_azimuth, &avg_elevation, deindex_spherical_component( q_direction->band_data[b].spherical_index[0], &avg_azimuth, &avg_elevation, &q_direction->band_data[b].azimuth_index[0], &q_direction->band_data[b].elevation_index[0], q_direction->band_data[b].bits_sph_idx[0], q_direction->cfg.mc_ls_setup );
&q_direction->band_data[b].azimuth_index[0], &q_direction->band_data[b].elevation_index[0], q_direction->band_data[b].bits_sph_idx[0],
q_direction->cfg.mc_ls_setup );
ivas_qmetadata_azimuth_elevation_to_direction_vector( avg_azimuth, avg_elevation, avg_direction_vector ); ivas_qmetadata_azimuth_elevation_to_direction_vector( avg_azimuth, avg_elevation, avg_direction_vector );
ivas_qmetadata_azimuth_elevation_to_direction_vector( q_direction->band_data[b].azimuth[nblocks - 1], q_direction->band_data[b].elevation[nblocks - 1], direction_vector ); ivas_qmetadata_azimuth_elevation_to_direction_vector( q_direction->band_data[b].azimuth[nblocks - 1], q_direction->band_data[b].elevation[nblocks - 1], direction_vector );
...@@ -1982,8 +1976,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir( ...@@ -1982,8 +1976,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir(
} }
/*decode elevation*/ /*decode elevation*/
q_direction->band_data[b].elevation[m] = deindex_elevation( &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->band_data[b].elevation[m] = deindex_elevation( &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->cfg.mc_ls_setup );
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2047,8 +2040,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir( ...@@ -2047,8 +2040,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir(
} }
/*decode elevation*/ /*decode elevation*/
q_direction->band_data[b].elevation[m] = deindex_elevation( &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->band_data[b].elevation[m] = deindex_elevation( &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->cfg.mc_ls_setup );
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2084,8 +2076,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir( ...@@ -2084,8 +2076,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir(
} }
/*decode elevation*/ /*decode elevation*/
q_direction->band_data[b].elevation[m] = deindex_elevation( &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->band_data[b].elevation[m] = deindex_elevation( &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->cfg.mc_ls_setup );
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2114,10 +2105,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir( ...@@ -2114,10 +2105,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir(
} }
else else
{ {
q_direction->band_data[b].azimuth[m] = deindex_azimuth( q_direction->band_data[b].azimuth_index[m], q_direction->band_data[b].azimuth[m] = deindex_azimuth( q_direction->band_data[b].azimuth_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->band_data[b].elevation_index[m], 0, q_direction->cfg.mc_ls_setup );
q_direction->band_data[b].bits_sph_idx[m],
q_direction->band_data[b].elevation_index[m], 0,
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2150,10 +2138,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir( ...@@ -2150,10 +2138,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir(
} }
else else
{ {
q_direction->band_data[b].azimuth[m] = deindex_azimuth( q_direction->band_data[b].azimuth_index[m], q_direction->band_data[b].azimuth[m] = deindex_azimuth( q_direction->band_data[b].azimuth_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->band_data[b].elevation_index[m], 0, q_direction->cfg.mc_ls_setup );
q_direction->band_data[b].bits_sph_idx[m],
q_direction->band_data[b].elevation_index[m], 0,
q_direction->cfg.mc_ls_setup );
} }
if ( ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) && ( nblocks > 1 ) ) if ( ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) && ( nblocks > 1 ) )
{ {
...@@ -2228,9 +2213,7 @@ static int16_t ivas_qmetadata_raw_decode_dir_512( ...@@ -2228,9 +2213,7 @@ static int16_t ivas_qmetadata_raw_decode_dir_512(
} }
else else
{ {
deindex_spherical_component( q_direction->band_data[b].spherical_index[m], &q_direction->band_data[b].azimuth[m], &q_direction->band_data[b].elevation[m], deindex_spherical_component( q_direction->band_data[b].spherical_index[m], &q_direction->band_data[b].azimuth[m], &q_direction->band_data[b].elevation[m], &q_direction->band_data[b].azimuth_index[m], &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->cfg.mc_ls_setup );
&q_direction->band_data[b].azimuth_index[m], &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m],
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2285,8 +2268,7 @@ static int16_t ivas_qmetadata_raw_decode_dir( ...@@ -2285,8 +2268,7 @@ static int16_t ivas_qmetadata_raw_decode_dir(
q_direction->band_data[b].elevation_index[m] = 0; q_direction->band_data[b].elevation_index[m] = 0;
azith_alph = no_phi_masa[bits_direction_masa[diff_idx] - 1][0]; azith_alph = no_phi_masa[bits_direction_masa[diff_idx] - 1][0];
q_direction->band_data[b].azimuth_index[m] = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, azith_alph ); q_direction->band_data[b].azimuth_index[m] = ivas_qmetadata_DecodeQuasiUniform( bitstream, index, azith_alph );
q_direction->band_data[b].azimuth[m] = deindex_azimuth( q_direction->band_data[b].azimuth_index[m], q_direction->band_data[b].bits_sph_idx[m], 0, 1, q_direction->band_data[b].azimuth[m] = deindex_azimuth( q_direction->band_data[b].azimuth_index[m], q_direction->band_data[b].bits_sph_idx[m], 0, 1, q_direction->cfg.mc_ls_setup );
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2343,8 +2325,7 @@ static uint16_t ivas_qmetadata_DecodeQuasiUniform( ...@@ -2343,8 +2325,7 @@ static uint16_t ivas_qmetadata_DecodeQuasiUniform(
*------------------------------------------------------------------------*/ *------------------------------------------------------------------------*/
/*! r: Value decoded from the bitstream */ /*! r: Value decoded from the bitstream */
int16_t int16_t ivas_qmetadata_DecodeExtendedGR(
ivas_qmetadata_DecodeExtendedGR(
uint16_t *bitstream, /* i : pointer to the bitstream to read */ uint16_t *bitstream, /* i : pointer to the bitstream to read */
int16_t *index, /* i/o: position in the bitstream to start reading (gets updated with reading) */ int16_t *index, /* i/o: position in the bitstream to start reading (gets updated with reading) */
const int16_t alph_size, /* i : size of the alphabet, used to calculate the number of bits needed */ const int16_t alph_size, /* i : size of the alphabet, used to calculate the number of bits needed */
...@@ -2733,13 +2714,9 @@ static int16_t decode_azimuth( ...@@ -2733,13 +2714,9 @@ static int16_t decode_azimuth(
} }
else else
{ {
q_direction->band_data[idx_subband].azimuth_index[k] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, q_direction->band_data[idx_subband].azimuth_index[k] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, q_direction->band_data[idx_subband].azimuth_m_alphabet[k], MASA_GR_ORD_AZ - ( q_direction->band_data[idx_subband].bits_sph_idx[k] == 2 ) );
q_direction->band_data[idx_subband].azimuth_m_alphabet[k], MASA_GR_ORD_AZ - ( q_direction->band_data[idx_subband].bits_sph_idx[k] == 2 ) );
q_direction->band_data[idx_subband].azimuth[k] = deindex_azimuth( q_direction->band_data[idx_subband].azimuth_index[k], q_direction->band_data[idx_subband].azimuth[k] = deindex_azimuth( q_direction->band_data[idx_subband].azimuth_index[k], q_direction->band_data[idx_subband].bits_sph_idx[k], q_direction->band_data[idx_subband].elevation_index[k], 1, q_direction->cfg.mc_ls_setup );
q_direction->band_data[idx_subband].bits_sph_idx[k],
q_direction->band_data[idx_subband].elevation_index[k], 1,
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2760,12 +2737,8 @@ static int16_t decode_azimuth( ...@@ -2760,12 +2737,8 @@ static int16_t decode_azimuth(
{ {
if ( no_phi_masa[q_direction->band_data[idx_subband].bits_sph_idx[k] - 1][q_direction->band_data[idx_subband].elevation_index[k]] > 1 ) if ( no_phi_masa[q_direction->band_data[idx_subband].bits_sph_idx[k] - 1][q_direction->band_data[idx_subband].elevation_index[k]] > 1 )
{ {
q_direction->band_data[idx_subband].azimuth_index[k] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, q_direction->band_data[idx_subband].azimuth_index[k] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, q_direction->band_data[idx_subband].azimuth_m_alphabet[k], MASA_GR_ORD_AZ - byteBuffer );
q_direction->band_data[idx_subband].azimuth_m_alphabet[k], MASA_GR_ORD_AZ - byteBuffer ); q_direction->band_data[idx_subband].azimuth[k] = deindex_azimuth( q_direction->band_data[idx_subband].azimuth_index[k], q_direction->band_data[idx_subband].bits_sph_idx[k], q_direction->band_data[idx_subband].elevation_index[k], 1, q_direction->cfg.mc_ls_setup );
q_direction->band_data[idx_subband].azimuth[k] = deindex_azimuth( q_direction->band_data[idx_subband].azimuth_index[k],
q_direction->band_data[idx_subband].bits_sph_idx[k],
q_direction->band_data[idx_subband].elevation_index[k], 1,
q_direction->cfg.mc_ls_setup );
} }
else else
{ {
...@@ -2795,13 +2768,9 @@ static int16_t decode_azimuth( ...@@ -2795,13 +2768,9 @@ static int16_t decode_azimuth(
{ {
if ( no_phi_masa[q_direction->band_data[idx_subband].bits_sph_idx[k] - 1][q_direction->band_data[idx_subband].elevation_index[k]] > 1 ) if ( no_phi_masa[q_direction->band_data[idx_subband].bits_sph_idx[k] - 1][q_direction->band_data[idx_subband].elevation_index[k]] > 1 )
{ {
q_direction->band_data[idx_subband].azimuth_index[k] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, q_direction->band_data[idx_subband].azimuth_index[k] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, q_direction->band_data[idx_subband].azimuth_m_alphabet[k], MASA_GR_ORD_AZ - 1 - byteBuffer );
q_direction->band_data[idx_subband].azimuth_m_alphabet[k], MASA_GR_ORD_AZ - 1 - byteBuffer );
q_direction->band_data[idx_subband].azimuth_index[k] += min_idx; q_direction->band_data[idx_subband].azimuth_index[k] += min_idx;
q_direction->band_data[idx_subband].azimuth[k] = deindex_azimuth( q_direction->band_data[idx_subband].azimuth_index[k], q_direction->band_data[idx_subband].azimuth[k] = deindex_azimuth( q_direction->band_data[idx_subband].azimuth_index[k], q_direction->band_data[idx_subband].bits_sph_idx[k], q_direction->band_data[idx_subband].elevation_index[k], 1, q_direction->cfg.mc_ls_setup );
q_direction->band_data[idx_subband].bits_sph_idx[k],
q_direction->band_data[idx_subband].elevation_index[k], 1,
q_direction->cfg.mc_ls_setup );
} }
else else
{ {
...@@ -2901,8 +2870,7 @@ static int16_t decode_elevation( ...@@ -2901,8 +2870,7 @@ static int16_t decode_elevation(
if ( q_direction->band_data[j].elevation_index[k] < MASA_NO_INDEX ) if ( q_direction->band_data[j].elevation_index[k] < MASA_NO_INDEX )
{ {
q_direction->band_data[j].elevation_index[k] = same_idx; q_direction->band_data[j].elevation_index[k] = same_idx;
q_direction->band_data[j].elevation[k] = deindex_elevation( &q_direction->band_data[j].elevation_index[k], q_direction->band_data[j].bits_sph_idx[k], q_direction->band_data[j].elevation[k] = deindex_elevation( &q_direction->band_data[j].elevation_index[k], q_direction->band_data[j].bits_sph_idx[k], q_direction->cfg.mc_ls_setup );
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2917,8 +2885,7 @@ static int16_t decode_elevation( ...@@ -2917,8 +2885,7 @@ static int16_t decode_elevation(
if ( q_direction->band_data[j].elevation_index[k] < MASA_NO_INDEX ) if ( q_direction->band_data[j].elevation_index[k] < MASA_NO_INDEX )
{ {
q_direction->band_data[j].elevation_index[k] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, q_direction->band_data[j].elevation_m_alphabet[k], GR_ord_elevation ); q_direction->band_data[j].elevation_index[k] = ivas_qmetadata_DecodeExtendedGR( bitstream, &bit_pos, q_direction->band_data[j].elevation_m_alphabet[k], GR_ord_elevation );
q_direction->band_data[j].elevation[k] = deindex_elevation( &q_direction->band_data[j].elevation_index[k], q_direction->band_data[j].bits_sph_idx[k], q_direction->band_data[j].elevation[k] = deindex_elevation( &q_direction->band_data[j].elevation_index[k], q_direction->band_data[j].bits_sph_idx[k], q_direction->cfg.mc_ls_setup );
q_direction->cfg.mc_ls_setup );
} }
} }
} }
...@@ -2986,9 +2953,7 @@ static int16_t decode_fixed_rate( ...@@ -2986,9 +2953,7 @@ static int16_t decode_fixed_rate(
q_direction->band_data[b].spherical_index[m] = value; q_direction->band_data[b].spherical_index[m] = value;
nbits += q_direction->band_data[b].bits_sph_idx[m]; nbits += q_direction->band_data[b].bits_sph_idx[m];
deindex_spherical_component( q_direction->band_data[b].spherical_index[m], &q_direction->band_data[b].azimuth[m], &q_direction->band_data[b].elevation[m], deindex_spherical_component( q_direction->band_data[b].spherical_index[m], &q_direction->band_data[b].azimuth[m], &q_direction->band_data[b].elevation[m], &q_direction->band_data[b].azimuth_index[m], &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m], q_direction->cfg.mc_ls_setup );
&q_direction->band_data[b].azimuth_index[m], &q_direction->band_data[b].elevation_index[m], q_direction->band_data[b].bits_sph_idx[m],
q_direction->cfg.mc_ls_setup );
} }
return nbits; return nbits;
...@@ -3101,6 +3066,7 @@ static void set_zero_direction( ...@@ -3101,6 +3066,7 @@ static void set_zero_direction(
const int16_t len ) const int16_t len )
{ {
int16_t k; int16_t k;
for ( k = 0; k < len; k++ ) for ( k = 0; k < len; k++ )
{ {
q_direction->band_data[idx_band].azimuth[k] = 0; q_direction->band_data[idx_band].azimuth[k] = 0;
...@@ -3476,7 +3442,6 @@ static ivas_error read_huf( ...@@ -3476,7 +3442,6 @@ static ivas_error read_huf(
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong Huffman codeword for average index in coherence encoding." ); return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong Huffman codeword for average index in coherence encoding." );
} }
#endif #endif
*num_bits_read = end_pos; *num_bits_read = end_pos;
return IVAS_ERR_OK; return IVAS_ERR_OK;
...@@ -3536,6 +3501,7 @@ static int16_t read_GR_min_removed_data( ...@@ -3536,6 +3501,7 @@ static int16_t read_GR_min_removed_data(
decoded_idx[j] += min_index; decoded_idx[j] += min_index;
} }
} }
#ifdef DEBUGGING #ifdef DEBUGGING
assert( nbits == *p_bit_pos - bit_pos ); assert( nbits == *p_bit_pos - bit_pos );
#endif #endif
...@@ -3777,6 +3743,7 @@ static int16_t read_coherence_data( ...@@ -3777,6 +3743,7 @@ static int16_t read_coherence_data(
#ifdef NONBE_FIX_760_COHERENCE_MASA #ifdef NONBE_FIX_760_COHERENCE_MASA
int16_t extra_cv; int16_t extra_cv;
#endif #endif
coding_subbands = hQMetaData->q_direction[idx_dir].cfg.nbands; coding_subbands = hQMetaData->q_direction[idx_dir].cfg.nbands;
#ifdef NONBE_FIX_760_COHERENCE_MASA #ifdef NONBE_FIX_760_COHERENCE_MASA
extra_cv = (int16_t) ( coding_subbands / MASA_FACTOR_CV_COH ); extra_cv = (int16_t) ( coding_subbands / MASA_FACTOR_CV_COH );
......
...@@ -40,11 +40,6 @@ ...@@ -40,11 +40,6 @@
#include "prot.h" #include "prot.h"
/*-----------------------------------------------------------------------*
* Local function prototypes
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------* /*-------------------------------------------------------------------*
* deindex_elevation() * deindex_elevation()
* *
......
...@@ -212,8 +212,7 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -212,8 +212,7 @@ ivas_error ivas_sba_dec_reconfigure(
ivas_spar_md_dec_matrix_close( st_ivas->hSpar->hMdDec, num_channels ); ivas_spar_md_dec_matrix_close( st_ivas->hSpar->hMdDec, num_channels );
num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, ivas_total_brate, st_ivas->last_active_ivas_total_brate ); num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( sba_order_internal, ivas_total_brate, st_ivas->last_active_ivas_total_brate );
if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, if ( ( error = ivas_spar_md_dec_matrix_open( st_ivas->hSpar->hMdDec, num_channels, num_md_sub_frames ) ) != IVAS_ERR_OK )
num_md_sub_frames ) ) != IVAS_ERR_OK )
{ {
return error; return error;
} }
...@@ -289,12 +288,14 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -289,12 +288,14 @@ ivas_error ivas_sba_dec_reconfigure(
{ {
ivas_binRenderer_close( &st_ivas->hBinRenderer ); ivas_binRenderer_close( &st_ivas->hBinRenderer );
} }
#ifdef NONBE_FIX_736_FOA_BR_SWITCH #ifdef NONBE_FIX_736_FOA_BR_SWITCH
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 ( ( 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; return error;
} }
#endif #endif
#ifndef NONBE_FIX_736_FOA_BR_SWITCH #ifndef NONBE_FIX_736_FOA_BR_SWITCH
if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO ) ) || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k ) ) if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO ) ) || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k ) )
#else #else
...@@ -327,14 +328,6 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -327,14 +328,6 @@ ivas_error ivas_sba_dec_reconfigure(
#ifdef NONBE_FIX_736_FOA_BR_SWITCH #ifdef NONBE_FIX_736_FOA_BR_SWITCH
else else
{ {
#endif
#ifndef NONBE_FIX_736_FOA_BR_SWITCH
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;
}
#endif
#ifdef NONBE_FIX_736_FOA_BR_SWITCH
int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1];
st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND );
...@@ -350,12 +343,12 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -350,12 +343,12 @@ ivas_error ivas_sba_dec_reconfigure(
st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 );
} }
#endif #endif
if ( st_ivas->renderer_type == RENDERER_DISABLE ) if ( st_ivas->renderer_type == RENDERER_DISABLE )
{ {
ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); ivas_dirac_rend_close( &( st_ivas->hDirACRend ) );
ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) );
ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) );
vbap_free_data( &( st_ivas->hVBAPdata ) ); vbap_free_data( &( st_ivas->hVBAPdata ) );
} }
...@@ -407,6 +400,13 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -407,6 +400,13 @@ ivas_error ivas_sba_dec_reconfigure(
} }
} }
#ifdef FIX_782_OSBA_FUNCTION_NAMES
/* Allocate memory for OSBA delay buffer */
if ( ( error = ivas_osba_data_open( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
}
#else
if ( ( error = ivas_masa_ism_data_open( st_ivas ) ) != IVAS_ERR_OK ) if ( ( error = ivas_masa_ism_data_open( st_ivas ) ) != IVAS_ERR_OK )
{ {
return error; return error;
...@@ -417,6 +417,7 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -417,6 +417,7 @@ ivas_error ivas_sba_dec_reconfigure(
{ {
return error; return error;
} }
#endif
#ifndef NONBE_FIX_752_OSBA_MISCONFIG_MCT #ifndef NONBE_FIX_752_OSBA_MISCONFIG_MCT
st_ivas->nchan_transport += st_ivas->nchan_ism; st_ivas->nchan_transport += st_ivas->nchan_ism;
...@@ -437,7 +438,7 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -437,7 +438,7 @@ ivas_error ivas_sba_dec_reconfigure(
} }
#endif #endif
ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 ); ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 );
ivas_masa_ism_data_close( &st_ivas->hMasaIsmData ); ivas_osba_data_close( &st_ivas->hSbaIsmData );
/* Time Domain binaural renderer handle */ /* Time Domain binaural renderer handle */
if ( st_ivas->hBinRendererTd != NULL ) if ( st_ivas->hBinRendererTd != NULL )
...@@ -524,6 +525,7 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -524,6 +525,7 @@ ivas_error ivas_sba_dec_reconfigure(
/*-----------------------------------------------------------------* /*-----------------------------------------------------------------*
* JBM TC buffer * JBM TC buffer
*-----------------------------------------------------------------*/ *-----------------------------------------------------------------*/
if ( st_ivas->hDecoderConfig->Opt_5ms == 1 ) if ( st_ivas->hDecoderConfig->Opt_5ms == 1 )
{ {
int16_t tc_nchan_to_allocate; int16_t tc_nchan_to_allocate;
...@@ -596,6 +598,7 @@ ivas_error ivas_sba_dec_reconfigure( ...@@ -596,6 +598,7 @@ ivas_error ivas_sba_dec_reconfigure(
return error; return error;
} }
/*-------------------------------------------------------------------* /*-------------------------------------------------------------------*
* ivas_sba_dec_digest_tc() * ivas_sba_dec_digest_tc()
* *
...@@ -686,7 +689,7 @@ ivas_error ivas_sba_dec_digest_tc( ...@@ -686,7 +689,7 @@ ivas_error ivas_sba_dec_digest_tc(
* *
*-------------------------------------------------------------------*/ *-------------------------------------------------------------------*/
void ivas_sba_dec_render( ivas_error ivas_sba_dec_render(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */
uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */
...@@ -700,6 +703,7 @@ void ivas_sba_dec_render( ...@@ -700,6 +703,7 @@ void ivas_sba_dec_render(
SPAR_DEC_HANDLE hSpar; SPAR_DEC_HANDLE hSpar;
SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
float *output_f_local[MAX_OUTPUT_CHANNELS]; float *output_f_local[MAX_OUTPUT_CHANNELS];
ivas_error error;
hSpar = st_ivas->hSpar; hSpar = st_ivas->hSpar;
hSpatParamRendCom = st_ivas->hSpatParamRendCom; hSpatParamRendCom = st_ivas->hSpatParamRendCom;
...@@ -744,9 +748,10 @@ void ivas_sba_dec_render( ...@@ -744,9 +748,10 @@ void ivas_sba_dec_render(
if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC )
{ {
ivas_sba_linear_renderer( output_f, *nSamplesRendered, st_ivas->hIntSetup.nchan_out_woLFE, if ( ( error = ivas_sba_linear_renderer( output_f, *nSamplesRendered, st_ivas->hIntSetup.nchan_out_woLFE, 0, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ) ) != IVAS_ERR_OK )
0, {
st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); return error;
}
} }
if ( st_ivas->hDirAC != NULL && hSpar->slots_rendered == hSpar->num_slots ) if ( st_ivas->hDirAC != NULL && hSpar->slots_rendered == hSpar->num_slots )
...@@ -763,5 +768,5 @@ void ivas_sba_dec_render( ...@@ -763,5 +768,5 @@ void ivas_sba_dec_render(
*nSamplesAvailableNext = ( hSpar->num_slots - hSpar->slots_rendered ) * slot_size; *nSamplesAvailableNext = ( hSpar->num_slots - hSpar->slots_rendered ) * slot_size;
return; return IVAS_ERR_OK;
} }
...@@ -180,6 +180,7 @@ static int16_t ivas_sba_dirac_stereo_band_config( ...@@ -180,6 +180,7 @@ static int16_t ivas_sba_dirac_stereo_band_config(
return nbands; return nbands;
} }
static float get_panning( static float get_panning(
const int16_t aziDeg, const int16_t aziDeg,
const int16_t eleDeg ) const int16_t eleDeg )
...@@ -214,6 +215,7 @@ static float get_panning( ...@@ -214,6 +215,7 @@ static float get_panning(
return panning; return panning;
} }
/*-------------------------------------------------------------------* /*-------------------------------------------------------------------*
* map_params_dirac_to_stereo() * map_params_dirac_to_stereo()
* *
...@@ -246,7 +248,6 @@ static void map_params_dirac_to_stereo( ...@@ -246,7 +248,6 @@ static void map_params_dirac_to_stereo(
float subframe_band_nrg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; float subframe_band_nrg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS];
float smooth_long_avg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; float smooth_long_avg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS];
float smooth_short_avg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; float smooth_short_avg[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS];
float *side_gain, *res_pred_gain; float *side_gain, *res_pred_gain;
IVAS_QDIRECTION *q_direction; IVAS_QDIRECTION *q_direction;
...@@ -877,22 +878,18 @@ void ivas_sba_dirac_stereo_dec( ...@@ -877,22 +878,18 @@ void ivas_sba_dirac_stereo_dec(
} }
/* mapping of DirAC parameters (azimuth, elevation, diffuseness) to DFT Stereo parameters (side gain, prediction gain) */ /* mapping of DirAC parameters (azimuth, elevation, diffuseness) to DFT Stereo parameters (side gain, prediction gain) */
map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], st_ivas->ivas_format == MC_FORMAT,
st_ivas->ivas_format == MC_FORMAT,
( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame, ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame,
( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) || mcmasa ) ); ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) || mcmasa ) );
if ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && !mcmasa ) if ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && !mcmasa )
{ {
set_f( hStereoDft->res_pred_gain, 1.f, 3 * STEREO_DFT_BAND_MAX ); set_f( hStereoDft->res_pred_gain, 1.f, 3 * STEREO_DFT_BAND_MAX );
} }
/* DFT Stereo upmix */ /* DFT Stereo upmix */
stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, 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->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, 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->last_active_ivas_total_brate ) );
( 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->last_active_ivas_total_brate ) );
/* DFT synthesis */ /* DFT synthesis */
stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame );
...@@ -924,8 +921,7 @@ void ivas_sba_dirac_stereo_dec( ...@@ -924,8 +921,7 @@ void ivas_sba_dirac_stereo_dec(
/* upmix ACELP BWE */ /* upmix ACELP BWE */
ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain ); ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain );
ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft );
( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft );
/* add HB to ACELP core */ /* add HB to ACELP core */
v_add( output[0], hb_synth_stereo[0], output[0], output_frame ); v_add( output[0], hb_synth_stereo[0], output[0], output_frame );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.