Skip to content
......@@ -270,7 +270,11 @@ ivas_error ivas_corecoder_dec_reconfig(
}
else if ( st_ivas->hMCT != NULL && st_ivas->nCPE > 1 )
{
#ifdef NONBE_FIX_ISM_XOVER_BR
if ( ( error = mct_dec_reconfigure( st_ivas, nchan_transport_real != nchan_transport_old ) ) != IVAS_ERR_OK )
#else
if ( ( error = mct_dec_reconfigure( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
......@@ -351,7 +355,11 @@ ivas_error ivas_corecoder_dec_reconfig(
* Set CNA/CNG flags
*-----------------------------------------------------------------*/
#ifdef NONBE_FIX_ISM_XOVER_BR
if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT )
#else
if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT )
#endif
{
ivas_sba_set_cna_cng_flag( st_ivas );
}
......
......@@ -765,6 +765,9 @@ ivas_error ivas_dirac_dec_config(
int16_t need_parambin;
int16_t dec_param_estim_old;
int16_t dec_param_estim_new;
#ifdef SPLIT_REND_WITH_HEAD_ROT
int16_t num_poses, pos_idx;
#endif
error = IVAS_ERR_OK;
......@@ -775,6 +778,14 @@ ivas_error ivas_dirac_dec_config(
hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order );
dec_param_estim_old = ( dec_config_flag == DIRAC_RECONFIGURE ) ? st_ivas->hDirAC->hConfig->dec_param_estim : FALSE;
#ifdef SPLIT_REND_WITH_HEAD_ROT
num_poses = 1;
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;
}
#endif
sparfoa_flag = 0;
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag )
{
......@@ -904,7 +915,7 @@ ivas_error ivas_dirac_dec_config(
#ifdef SPLIT_REND_WITH_HEAD_ROT
/* copy td-decorr flag to split renderer side rendereres */
for ( int16_t pos_idx = 1; pos_idx < st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
for ( pos_idx = 1; pos_idx < num_poses; pos_idx++ )
{
st_ivas->hDiracDecBin[pos_idx]->useTdDecorr = st_ivas->hDiracDecBin[0]->useTdDecorr;
}
......@@ -925,10 +936,11 @@ ivas_error ivas_dirac_dec_config(
ivas_dirac_dec_get_frequency_axis( frequency_axis, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands );
if ( ( error = ivas_dirac_dec_decorr_open(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS,
&( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin[0]->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS,
#else
if ( ( error = ivas_dirac_dec_decorr_open( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS,
&( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS,
#endif
DIRAC_SYNTHESIS_PSD_LS, frequency_axis, BINAURAL_CHANNELS, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
{
......@@ -938,7 +950,7 @@ ivas_error ivas_dirac_dec_config(
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
for ( int16_t pos_idx = 0; pos_idx < st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses; pos_idx++ )
for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
{
st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate );
}
......@@ -1001,6 +1013,9 @@ void ivas_dirac_dec_read_BS(
int16_t *nb_bits, /* o : number of bits read */
const int16_t last_bit_pos, /* i : last read bitstream position */
const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */
#ifdef NONBE_FIX_1052_SBA_EXT
const int16_t nchan_transport, /* i : number of transport channels */
#endif
int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */
)
{
......@@ -1034,7 +1049,12 @@ void ivas_dirac_dec_read_BS(
}
}
#ifdef NONBE_FIX_1052_SBA_EXT
*nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT );
#else
*nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT );
#endif
for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
{
hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0];
......@@ -1082,7 +1102,11 @@ void ivas_dirac_dec_read_BS(
next_bit_pos_orig = st->next_bit_pos;
/* subtract mode signaling bits, since bitstream was moved after mode reading */
#ifdef NONBE_FIX_1052_SBA_EXT
st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS - SBA_PLANAR_BITS - SBA_ORDER_BITS );
#else
st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS );
#endif
/* 1 bit flag for signaling metadata to read */
b = st->bit_stream[( st->next_bit_pos )--];
( *nb_bits )++;
......@@ -1102,7 +1126,11 @@ void ivas_dirac_dec_read_BS(
}
}
#ifdef NONBE_FIX_1052_SBA_EXT
*nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT );
#else
*nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT );
#endif
for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
{
hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0];
......@@ -2317,13 +2345,8 @@ void ivas_dirac_dec_render_sf(
for ( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ )
{
#ifdef FIX_1060_USAN_ARRAY_BOUNDS
Cldfb_RealBuffer[j2][k][l] += g * *( tc_re++ );
Cldfb_ImagBuffer[j2][k][l] += g * *( tc_im++ );
#else
Cldfb_RealBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += g * *( tc_re++ );
Cldfb_ImagBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += g * *( tc_im++ );
#endif
}
w1 += hSpatParamRendCom->num_freq_bands;
}
......@@ -2342,17 +2365,17 @@ void ivas_dirac_dec_render_sf(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
if ( st_ivas->hSplitBinRend->hCldfbDataOut != NULL )
{
for ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ )
{
for ( ch = 0; ch < st_ivas->hBinRenderer->nInChannels; ch++ )
{
mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
}
}
st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
}
#endif
......@@ -2360,7 +2383,7 @@ void ivas_dirac_dec_render_sf(
/* Perform binaural rendering */
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
&st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData,
......@@ -2379,8 +2402,8 @@ void ivas_dirac_dec_render_sf(
{
for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hSpatParamRendCom->num_freq_bands );
}
}
}
......
......@@ -51,6 +51,13 @@
#include "wmc_auto.h"
#include "rom_dec.h"
#ifdef NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS
/*-----------------------------------------------------------------------*
* Local constants
*-----------------------------------------------------------------------*/
#define SQRT_EPSILON 3.16227755e-08 /* square root of EPSILON */
#endif
/*-------------------------------------------------------------------*
* ivas_dirac_dec_output_synthesis_cov_open()
......@@ -577,8 +584,11 @@ int16_t computeMixingMatrices(
*-----------------------------------------------------------------*/
maximum( svd_s_buffer, lengthCx, &limit );
#ifdef NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS
limit = (float) max( limit * reg_Sx, SQRT_EPSILON );
#else
limit = limit * reg_Sx + EPSILON;
#endif
for ( i = 0; i < lengthCx; ++i )
{
svd_s_buffer[i] = ( ( svd_s_buffer[i] > limit ) ? svd_s_buffer[i] : limit );
......
......@@ -38,7 +38,9 @@
#include "ivas_stat_enc.h"
#include "prot.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "common_api_types.h"
#include "lib_isar_pre_rend.h"
#include "isar_prot.h"
#include "isar_stat.h"
#endif
#include <assert.h>
#include <math.h>
......@@ -57,6 +59,10 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, int16_t *num_bits_r
static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );
#ifdef NONBE_FIX_1052_SBA_EXT
static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order );
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
......@@ -74,11 +80,8 @@ static ivas_error ivas_dec_reconfig_split_rend(
ivas_error error;
int16_t cldfb_in_flag, num_ch, ch, isCldfbNeeded, i, pcm_out_flag;
SPLIT_REND_WRAPPER *hSplitRendWrapper;
#ifndef SPLIT_REND_WITH_HEAD_ROT
CLDFB_TYPE cldfbMode;
#endif
hSplitRendWrapper = &st_ivas->hSplitBinRend.splitrend;
hSplitRendWrapper = &st_ivas->hSplitBinRend->splitrend;
pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
cldfb_in_flag = 0;
......@@ -90,42 +93,35 @@ static ivas_error ivas_dec_reconfig_split_rend(
cldfb_in_flag = 1;
}
ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis );
ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );
isCldfbNeeded = 0;
#ifndef SPLIT_REND_WITH_HEAD_ROT
cldfbMode = CLDFB_ANALYSIS;
#else
if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT )
if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) ||
( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) )
{
cldfb_in_flag = 0;
}
#endif
if ( st_ivas->renderer_type != RENDERER_DISABLE )
{
if ( cldfb_in_flag == 0 )
{
isCldfbNeeded = 1;
#ifndef SPLIT_REND_WITH_HEAD_ROT
cldfbMode = CLDFB_ANALYSIS;
#endif
}
else if ( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag )
else if ( st_ivas->hRenderConfig->split_rend_config.codec == ISAR_SPLIT_REND_CODEC_LC3PLUS && cldfb_in_flag )
{
isCldfbNeeded = 1;
#ifndef SPLIT_REND_WITH_HEAD_ROT
cldfbMode = CLDFB_SYNTHESIS;
#endif
}
else if ( pcm_out_flag && cldfb_in_flag )
{
isCldfbNeeded = 1;
#ifndef SPLIT_REND_WITH_HEAD_ROT
cldfbMode = CLDFB_SYNTHESIS;
#endif
}
}
else if ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan )
{
isCldfbNeeded = 1;
}
if ( isCldfbNeeded == 1 && hSplitRendWrapper->hCldfbHandles == NULL )
{
......@@ -144,18 +140,12 @@ static ivas_error ivas_dec_reconfig_split_rend(
for ( ch = 0; ch < num_ch; ch++ )
{
#ifndef SPLIT_REND_WITH_HEAD_ROT
if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), cldfbMode, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
#else
if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
#endif
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not open CLDFB handles\n" ) );
}
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
{
if ( ( error = openCldfb( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK )
......@@ -163,7 +153,6 @@ static ivas_error ivas_dec_reconfig_split_rend(
return error;
}
}
#endif
}
else if ( isCldfbNeeded == 0 && hSplitRendWrapper->hCldfbHandles != NULL )
{
......@@ -177,7 +166,6 @@ static ivas_error ivas_dec_reconfig_split_rend(
}
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
{
if ( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] != NULL )
......@@ -186,25 +174,21 @@ static ivas_error ivas_dec_reconfig_split_rend(
hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL;
}
}
#endif
free( hSplitRendWrapper->hCldfbHandles );
hSplitRendWrapper->hCldfbHandles = NULL;
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) &&
( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV || st_ivas->ivas_format != SBA_ISM_FORMAT ) )
#else
if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD )
#endif
( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV || st_ivas->ivas_format != SBA_ISM_FORMAT ) &&
!( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) /* td-rend not needed? */
{
for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
{
if ( hSplitRendWrapper->hTdRendHandles[i] != NULL )
if ( st_ivas->hTdRendHandles[i] != NULL )
{
hSplitRendWrapper->hTdRendHandles[i]->HrFiltSet_p = NULL;
ivas_td_binaural_close( &hSplitRendWrapper->hTdRendHandles[i] );
st_ivas->hTdRendHandles[i]->HrFiltSet_p = NULL;
ivas_td_binaural_close( &st_ivas->hTdRendHandles[i] );
}
}
}
......@@ -225,6 +209,7 @@ static ivas_error ivas_dec_init_split_rend(
{
ivas_error error;
int16_t cldfb_in_flag, pcm_out_flag;
int16_t mixed_td_cldfb_flag;
pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
cldfb_in_flag = 0;
......@@ -237,34 +222,51 @@ static ivas_error ivas_dec_init_split_rend(
cldfb_in_flag = 1;
}
ivas_renderSplitGetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend.splitrend.multiBinPoseData, st_ivas->hHeadTrackData->sr_pose_pred_axis );
ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );
if ( cldfb_in_flag == 1 && ( st_ivas->hSplitBinRend.splitrend.multiBinPoseData.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) )
if ( cldfb_in_flag == 1 && ( st_ivas->hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) )
{
if ( ( st_ivas->hSplitBinRend.hCldfbDataOut = (IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( IVAS_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL )
if ( ( st_ivas->hSplitBinRend->hCldfbDataOut = (ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for cldfb data out buffer\n" ) );
}
}
if ( ( error = ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, &st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize ) ) != IVAS_ERR_OK )
mixed_td_cldfb_flag = 0;
if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT ) ||
( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) )
{
return error;
mixed_td_cldfb_flag = 1;
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV && st_ivas->ivas_format == SBA_ISM_FORMAT )
{
cldfb_in_flag = 0;
error = ISAR_PRE_REND_open( &st_ivas->hSplitBinRend->splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize, mixed_td_cldfb_flag );
return error;
}
#endif
error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, (int16_t) st_ivas->hDecoderConfig->render_framesize );
return error;
#ifdef NONBE_FIX_1052_SBA_EXT
static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const int16_t sba_order )
{
AUDIO_CONFIG output_config;
output_config = IVAS_AUDIO_CONFIG_HOA3;
switch ( sba_order )
{
case SBA_FOA_ORDER:
output_config = IVAS_AUDIO_CONFIG_FOA;
break;
case SBA_HOA2_ORDER:
output_config = IVAS_AUDIO_CONFIG_HOA2;
break;
case SBA_HOA3_ORDER:
output_config = IVAS_AUDIO_CONFIG_HOA3;
break;
default:
assert( 0 );
}
return output_config;
}
#endif
/*-------------------------------------------------------------------*
* ivas_dec_setup()
*
......@@ -351,6 +353,13 @@ ivas_error ivas_dec_setup(
/* read Ambisonic (SBA) order */
st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1];
st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
#ifdef NONBE_FIX_1052_SBA_EXT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
{
st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
}
#endif
num_bits_read += SBA_ORDER_BITS;
if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 )
......@@ -390,12 +399,30 @@ ivas_error ivas_dec_setup(
if ( st_ivas->nchan_ism > 0 )
{
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
/* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
/* info about the number of objects:
'00' - MASA format at the encoder
'01' - MASA_ISM_FORMAT at the encoder, with 4 objects
'10' - MASA_ISM_FORMAT at the encoder, with 3 objects
'11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects
reading if 1 or 2 objects is performed later
*/
st_ivas->nchan_ism = 5 - st_ivas->nchan_ism;
if ( st_ivas->nchan_transport == 1 && st_ivas->nchan_ism == 2 )
{
st_ivas->nchan_ism = 1;
}
/* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/
#else
/* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
if ( st_ivas->nchan_transport == 2 && st_ivas->nchan_ism == 3 )
{
st_ivas->nchan_ism = 4;
}
/* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 */
#endif
st_ivas->nchan_transport = 2;
element_mode_flag = 1;
}
......@@ -468,23 +495,22 @@ ivas_error ivas_dec_setup(
/* the number of objects is written at the end of the bitstream, in the SBA metadata */
st_ivas->nchan_ism = 2 * st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 1] + st_ivas->bit_stream[ivas_total_brate / FRAMES_PER_SEC - 2] + 1;
if ( ivas_total_brate < IVAS_24k4 || ivas_total_brate >= IVAS_256k )
{
/* read Ambisonic (SBA) planar flag */
st_ivas->sba_planar = st_ivas->bit_stream[num_bits_read];
num_bits_read += SBA_PLANAR_BITS;
}
/* read Ambisonic (SBA) order (0 for signaling OSBA format at low bitrates)*/
st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1];
st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
num_bits_read += SBA_ORDER_BITS;
/* read Ambisonic (SBA) order */
if ( ivas_total_brate < IVAS_256k )
/* read the real Ambisonic order when the above bits are used to signal OSBA format */
if ( ivas_total_brate < IVAS_24k4 )
{
st_ivas->sba_order = 3;
st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1];
st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
num_bits_read += SBA_ORDER_BITS;
}
if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
......@@ -506,11 +532,23 @@ ivas_error ivas_dec_setup(
/*correct number of CPEs for discrete ISM coding*/
if ( st_ivas->ini_frame > 0 && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
{
#ifdef NONBE_FIX_ISM_XOVER_BR
{
int16_t n;
n = st_ivas->nchan_transport + st_ivas->nchan_ism;
st_ivas->nCPE = ( n + 1 ) >> 1;
}
#else
st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
#endif
}
}
#ifdef NONBE_FIX_ISM_XOVER_BR
if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC )
#else
if ( ivas_total_brate >= IVAS_256k )
#endif
{
st_ivas->ism_mode = ISM_SBA_MODE_DISC;
}
......@@ -607,6 +645,14 @@ ivas_error ivas_dec_setup(
break;
}
#ifdef NONBE_FIX_1052_SBA_EXT
if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
{
st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
}
#endif
if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == SBA_FORMAT )
{
int16_t nchan_transport_old, nchan_transport;
......@@ -801,7 +847,6 @@ static ivas_error ivas_read_format(
st_ivas->ivas_format = MASA_ISM_FORMAT;
}
}
( *num_bits_read )++;
}
break;
......@@ -884,6 +929,16 @@ static ivas_error ivas_read_format(
if ( st_ivas->ivas_format == SBA_FORMAT )
{
#ifdef NONBE_FIX_1052_SBA_EXT
/* read Ambisonic (SBA) planar flag */
st_ivas->sba_planar = st_ivas->bit_stream[*num_bits_read];
*num_bits_read += SBA_PLANAR_BITS;
/* read Ambisonic (SBA) order */
st_ivas->sba_order = st_ivas->bit_stream[*num_bits_read + 1];
st_ivas->sba_order += 2 * st_ivas->bit_stream[*num_bits_read];
*num_bits_read += SBA_ORDER_BITS;
#endif
if ( st_ivas->sba_analysis_order == 0 )
{
st_ivas->sba_analysis_order = SBA_FOA_ORDER;
......@@ -1093,7 +1148,8 @@ ivas_error ivas_init_decoder_front(
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB
#ifdef SPLIT_REND_WITH_HEAD_ROT
|| 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_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ||
( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->Opt_non_diegetic_pan )
#endif
)
{
......@@ -1127,7 +1183,11 @@ ivas_error ivas_init_decoder(
int16_t numCldfbAnalyses, numCldfbSyntheses;
int16_t granularity, n_channels_transport_jbm;
int32_t output_Fs, ivas_total_brate;
#ifdef NONBE_FIX_MC_LFE_LPF
int32_t delay_ns;
#else
int32_t binauralization_delay_ns;
#endif
AUDIO_CONFIG output_config;
DECODER_CONFIG_HANDLE hDecoderConfig;
ivas_error error;
......@@ -1149,7 +1209,19 @@ ivas_error ivas_init_decoder(
if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
{
#ifdef FIX_1052_EXT_OUTPUT
if ( st_ivas->ivas_format == STEREO_FORMAT )
{
hDecoderConfig->nchan_out = CPE_CHANNELS;
}
else if ( st_ivas->ivas_format == MC_FORMAT )
{
hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->transport_config );
}
else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
#else
if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
#endif
{
hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
hDecoderConfig->nchan_out += st_ivas->nchan_ism;
......@@ -1172,7 +1244,19 @@ ivas_error ivas_init_decoder(
st_ivas->intern_config = output_config;
#ifdef FIX_1052_EXT_OUTPUT
if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->ivas_format == MC_FORMAT )
{
ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->transport_config );
st_ivas->intern_config = st_ivas->transport_config;
}
else
{
ivas_output_init( &( st_ivas->hOutSetup ), output_config );
}
#else
ivas_output_init( &( st_ivas->hOutSetup ), output_config );
#endif
if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
......@@ -1255,17 +1339,14 @@ ivas_error ivas_init_decoder(
* Initialize binuaral split rendering
*-----------------------------------------------------------------*/
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
if ( st_ivas->hSplitBinRend != NULL && ( 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_STEREO && st_ivas->hDecoderConfig->Opt_non_diegetic_pan && st_ivas->hRenderConfig->split_rend_config.dof == 0 ) ) )
{
if ( ( error = ivas_dec_init_split_rend( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
}
}
else
{
st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses = 1;
}
#endif
/*-----------------------------------------------------------------*
......@@ -1336,11 +1417,7 @@ ivas_error ivas_init_decoder(
}
}
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
......@@ -1591,7 +1668,16 @@ ivas_error ivas_init_decoder(
if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
{
#ifdef NONBE_FIX_ISM_XOVER_BR
{
int16_t n_all;
n_all = st_ivas->nchan_transport + st_ivas->nchan_ism;
st_ivas->nCPE = ( n_all + 1 ) >> 1;
}
#else
st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
#endif
st_ivas->element_mode_init = IVAS_CPE_MDCT;
}
......@@ -1674,7 +1760,6 @@ ivas_error ivas_init_decoder(
reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] );
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
{
if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK )
......@@ -1684,14 +1769,11 @@ ivas_error ivas_init_decoder(
}
else
{
#endif
if ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK )
{
return error;
}
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
}
#endif
}
else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC )
{
......@@ -2060,7 +2142,7 @@ ivas_error ivas_init_decoder(
#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->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#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->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
......@@ -2192,8 +2274,9 @@ ivas_error ivas_init_decoder(
}
}
#ifndef NONBE_FIX_MC_LFE_LPF
/*-----------------------------------------------------------------*
* LFE handles for rendering after rendering to adjust LFE delay to binaural filter delay
* LFE handles for rendering after rendering to adjust LFE delay to filter delay
*-----------------------------------------------------------------*/
if ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
......@@ -2225,7 +2308,7 @@ ivas_error ivas_init_decoder(
set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN );
set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k );
}
#endif
/*-----------------------------------------------------------------*
* CLDFB handles for rendering
*-----------------------------------------------------------------*/
......@@ -2262,6 +2345,49 @@ ivas_error ivas_init_decoder(
ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig );
}
#ifdef NONBE_FIX_MC_LFE_LPF
/*-----------------------------------------------------------------*
* LFE handles for rendering after rendering to adjust LFE delay to filter delay
*-----------------------------------------------------------------*/
if ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
{
delay_ns = st_ivas->binaural_latency_ns;
if ( st_ivas->hBinRenderer != NULL )
{
if ( st_ivas->hBinRenderer->render_lfe )
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
{
/* Account for filterbank delay */
delay_ns += IVAS_FB_DEC_DELAY_NS;
}
}
else
{
delay_ns = 0;
}
}
else
{
if ( ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) )
{
delay_ns += IVAS_FB_DEC_DELAY_NS;
}
}
if ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, output_Fs, delay_ns ) ) != IVAS_ERR_OK )
{
return error;
}
set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN );
set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k );
}
#endif
/*-----------------------------------------------------------------*
* Allocate and initialize limiter struct
*-----------------------------------------------------------------*/
......@@ -2563,11 +2689,11 @@ void ivas_initialize_handles_dec(
st_ivas->hCombinedOrientationData = NULL;
#ifdef SPLIT_REND_WITH_HEAD_ROT
st_ivas->hSplitBinRend.hMultiBinCldfbData = NULL;
st_ivas->hSplitBinRend.hSplitRendBits = NULL;
st_ivas->hSplitBinRend.hCldfbDataOut = NULL;
st_ivas->hSplitBinRend.numTdSamplesPerChannelCached = 0;
ivas_init_split_rend_handles( &st_ivas->hSplitBinRend.splitrend );
st_ivas->hSplitBinRend = NULL;
for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
{
st_ivas->hTdRendHandles[i] = NULL;
}
#endif
/* JBM handles */
......@@ -2707,13 +2833,14 @@ void ivas_destroy_dec(
ivas_binRenderer_close( &st_ivas->hBinRenderer );
#ifdef SPLIT_REND_WITH_HEAD_ROT
/* Split binaural renderer handle */
ivas_split_renderer_close( &st_ivas->hSplitBinRend.splitrend );
if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
/* TD binaural renderer handles */
for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
{
if ( st_ivas->hTdRendHandles[i] != NULL )
{
free( st_ivas->hSplitBinRend.hCldfbDataOut );
st_ivas->hSplitBinRend.hCldfbDataOut = NULL;
st_ivas->hTdRendHandles[i]->HrFiltSet_p = NULL;
ivas_td_binaural_close( &st_ivas->hTdRendHandles[i] );
}
}
#endif
......@@ -2727,7 +2854,7 @@ void ivas_destroy_dec(
/* Crend handle */
#ifdef SPLIT_REND_WITH_HEAD_ROT
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses );
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
#else
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
#endif
......@@ -3090,11 +3217,25 @@ static ivas_error doSanityChecks_IVAS(
/* Verify stereo output configuration */
if ( st_ivas->ivas_format == STEREO_FORMAT )
{
#ifdef FIX_1052_EXT_OUTPUT
if ( output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#else
if ( output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_5_1 && output_config != IVAS_AUDIO_CONFIG_7_1 && output_config != IVAS_AUDIO_CONFIG_5_1_2 && output_config != IVAS_AUDIO_CONFIG_5_1_4 && output_config != IVAS_AUDIO_CONFIG_7_1_4 && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM )
#endif
{
return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Wrong output configuration specified for Stereo!" );
}
}
#ifdef FIX_1052_EXT_OUTPUT
/* Verify output configuration for other formats */
else
{
if ( output_config == IVAS_AUDIO_CONFIG_INVALID )
{
return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" );
}
}
#else
else if ( st_ivas->ivas_format == ISM_FORMAT )
{
/* Verify ISM output configuration */
......@@ -3126,6 +3267,7 @@ static ivas_error doSanityChecks_IVAS(
return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for Multi-channel" );
}
}
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) && output_Fs != 48000 )
......
......@@ -231,7 +231,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
/* Open Crend Binaural renderer */
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
#endif
......@@ -270,25 +270,12 @@ static ivas_error ivas_ism_bitrate_switching_dec(
}
/* Close the TD Binaural renderer */
#ifdef NONBE_FIX_1045_ISM_BITRATE_SWITCHING
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
{
ivas_reverb_close( &st_ivas->hReverb );
}
#else
if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE )
{
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
st_ivas->hHrtfTD = NULL;
if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
{
ivas_reverb_close( &st_ivas->hReverb );
}
}
#endif
}
else
{
......@@ -311,7 +298,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
/* close the crend binaural renderer */
#ifdef SPLIT_REND_WITH_HEAD_ROT
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses );
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
#else
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
#endif
......
......@@ -642,7 +642,6 @@ ivas_error ivas_ism_metadata_dec(
return IVAS_ERR_OK;
}
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
/*-------------------------------------------------------------------*
* ivas_ism_reset_metadata_handle_dec()
......@@ -675,7 +674,6 @@ void ivas_ism_reset_metadata_handle_dec(
return;
}
#endif
/*-------------------------------------------------------------------------
* ivas_ism_metadata_dec_create()
......@@ -685,11 +683,7 @@ void ivas_ism_reset_metadata_handle_dec(
ivas_error ivas_ism_metadata_dec_create(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
const int16_t n_ISms, /* i : number of separately coded objects */
#else
const int16_t n_ISms, /* i : number of objects */
#endif
int32_t element_brate_tmp[] /* o : element bitrate per object */
)
{
......@@ -697,48 +691,19 @@ ivas_error ivas_ism_metadata_dec_create(
ivas_error error;
/* allocate ISM metadata handles */
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
for ( ch = 0; ch < n_ISms; ch++ )
#else
for ( ch = 0; ch < MAX_NUM_OBJECTS; ch++ )
#endif
{
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
if ( st_ivas->hIsmMetaData[ch] == NULL ) /* note: the handle can be allocated in OMASA bitrate switching from ISM_MASA_MODE_xxx_ONE_OBJ to ISM_MASA_MODE_DISC mode for 'ch==0' */
{
#endif
if ( ( st_ivas->hIsmMetaData[ch] = (ISM_METADATA_HANDLE) malloc( sizeof( ISM_METADATA_FRAME ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM MetaData\n" ) );
}
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
}
#endif
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
ivas_ism_reset_metadata_handle_dec( st_ivas->hIsmMetaData[ch] );
#else
st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0;
st_ivas->hIsmMetaData[ch]->position_angle.last_angle1_idx = 0;
st_ivas->hIsmMetaData[ch]->position_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 );
st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle1_idx = 0;
st_ivas->hIsmMetaData[ch]->orientation_angle.last_angle2_idx = 1 << ( ISM_ELEVATION_NBITS - 1 );
st_ivas->hIsmMetaData[ch]->last_radius_idx = 8; /* Init to radius 1.0 */
st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0;
st_ivas->hIsmMetaData[ch]->last_true_elevation = 0;
st_ivas->hIsmMetaData[ch]->last_azimuth = 0;
st_ivas->hIsmMetaData[ch]->last_elevation = 0;
st_ivas->hIsmMetaData[ch]->ism_imp = -1;
st_ivas->hIsmMetaData[ch]->ism_md_null_flag = 0;
st_ivas->hIsmMetaData[ch]->ism_md_lowrate_flag = 0;
ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] );
#endif
}
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
/* sanity freeing - it can happen only in reconfiguration when a smaller number of handles than before is requested */
for ( ; ch < MAX_NUM_OBJECTS; ch++ )
{
......@@ -748,7 +713,6 @@ ivas_error ivas_ism_metadata_dec_create(
st_ivas->hIsmMetaData[ch] = NULL;
}
}
#endif
if ( element_brate_tmp != NULL )
{
......
......@@ -681,7 +681,11 @@ ivas_error ivas_jbm_dec_tc(
/* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */
if ( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_7_1 ||
output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 ||
#ifdef FIX_1052_EXT_OUTPUT
output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) || output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
#else
output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) )
#endif
{
ivas_lfe_synth_with_filters( st_ivas->hMasa->hMasaLfeSynth, p_output, output_frame, n, LFE_CHANNEL );
}
......@@ -939,7 +943,14 @@ void ivas_jbm_dec_feed_tc_to_renderer(
{
v_multc( st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN, st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available );
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
#endif
delay_signal( st_ivas->hTcBuffer->tc[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
#ifdef SPLIT_REND_WITH_HEAD_ROT
}
#endif
}
}
}
......@@ -1325,7 +1336,7 @@ ivas_error ivas_jbm_dec_render(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
if ( ( error = ivas_rend_crendProcessSubframesSplitBin( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, &st_ivas->hSplitBinRend.splitrend.multiBinPoseData, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
if ( ( error = ivas_rend_crendProcessSubframesSplitBin( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
&st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : p_tc, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK )
{
return error;
......@@ -1490,7 +1501,7 @@ ivas_error ivas_jbm_dec_render(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
nchan_out_syn_output = BINAURAL_CHANNELS * st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses;
nchan_out_syn_output = BINAURAL_CHANNELS * st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;
}
else
{
......@@ -1658,14 +1669,37 @@ ivas_error ivas_jbm_dec_flush_renderer(
{
if ( mc_mode_old == MC_MODE_MCT )
{
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
int16_t crendInPlaceRotation = FALSE;
if ( st_ivas->transport_config != intern_config_old && ( intern_config_old == IVAS_AUDIO_CONFIG_FOA || intern_config_old == IVAS_AUDIO_CONFIG_HOA2 || intern_config_old == IVAS_AUDIO_CONFIG_HOA3 ) )
{
if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) < ( hIntSetupOld->nchan_out_woLFE + hIntSetupOld->num_lfe ) )
{
crendInPlaceRotation = TRUE;
ivas_mc2sba( st_ivas->hTransSetup, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, hIntSetupOld->ambisonics_order, GAIN_LFE );
}
}
#endif
if ( renderer_type_old == RENDERER_BINAURAL_MIXER_CONV || renderer_type_old == RENDERER_BINAURAL_MIXER_CONV_ROOM )
{
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
#if defined SPLIT_REND_WITH_HEAD_ROT
if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : st_ivas->hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : st_ivas->hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
#endif
#else
#if defined SPLIT_REND_WITH_HEAD_ROT
if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, hTcBuffer->tc, p_output, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
#endif
#endif
{
return error;
......@@ -2305,7 +2339,11 @@ ivas_error ivas_jbm_dec_tc_buffer_open(
const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */
)
{
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
int32_t nsamp_to_allocate;
#else
int16_t nsamp_to_allocate;
#endif
DECODER_TC_BUFFER_HANDLE hTcBuffer;
int16_t nMaxSlotsPerSubframe;
int16_t nchan_residual;
......@@ -2384,7 +2422,11 @@ ivas_error ivas_jbm_dec_tc_buffer_open(
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) );
}
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
set_zero_l( hTcBuffer->tc_buffer, nsamp_to_allocate );
#else
set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate );
#endif
offset = 0;
for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ )
......@@ -2430,7 +2472,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */
)
{
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
int32_t nsamp_to_allocate, offset;
int16_t n_samp_full, n_samp_residual, nchan_residual;
#else
int16_t nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual;
#endif
int16_t ch_idx;
DECODER_TC_BUFFER_HANDLE hTcBuffer;
......@@ -2517,7 +2564,11 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) );
}
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
set_zero_l( hTcBuffer->tc_buffer, nsamp_to_allocate );
#else
set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate );
#endif
offset = 0;
for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ )
......
......@@ -252,6 +252,28 @@ static int16_t ivas_lfe_dec_dequant(
}
#ifdef NONBE_FIX_MC_LFE_LPF
/*-------------------------------------------------------------------------
* ivas_create_lfe_lpf_dec()
*
* Create, allocate and initialize IVAS decoder LFE low pass filter state handle
*-------------------------------------------------------------------------*/
static void ivas_create_lfe_lpf_dec(
ivas_filters_process_state_t *hLfeLpf, /* o : LFE LPF handle */
const int32_t input_Fs /* i : input sampling rate */
)
{
const float *filt_coeff;
ivas_lfe_lpf_select_filt_coeff( input_Fs, IVAS_FILTER_ORDER_4, &filt_coeff );
ivas_filters_init( hLfeLpf, filt_coeff, IVAS_FILTER_ORDER_4 );
return;
}
#endif
/*-----------------------------------------------------------------------------------------*
* Function ivas_lfe_dec()
*
......@@ -350,9 +372,15 @@ void ivas_lfe_dec(
*-------------------------------------------------------------------------*/
ivas_error ivas_create_lfe_dec(
#ifdef NONBE_FIX_MC_LFE_LPF
LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */
const int32_t output_Fs, /* i : output sampling rate */
const int32_t delay_ns /* i : additional LFE delay to sync other channel outputs */
#else
LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */
const int32_t output_Fs, /* i : output sampling rate */
const int32_t binauralization_delay_ns /* i : additional LFE delay to sync with binaural renderer */
#endif
)
{
float low_pass_delay_dec_out, block_offset_s;
......@@ -403,6 +431,15 @@ ivas_error ivas_create_lfe_dec(
block_offset_s = BLOCK_OFFSET_MS * 0.001f;
filt_order = 0;
low_pass_delay_dec_out = 0;
#ifdef NONBE_FIX_MC_LFE_LPF
if ( ( delay_ns / 1000000000.f ) > ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3] )
{
filt_order = 4;
low_pass_delay_dec_out = ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3] * 1000000000.f;
ivas_create_lfe_lpf_dec( &( hLFE->filter_state ), output_Fs );
}
#endif
hLFE->filter_state.order = filt_order;
hLFE->lfe_block_delay_s = hLFE->lfe_block_delay_s + low_pass_delay_dec_out;
hLFE->lfe_prior_buf_len = NS2SA( output_Fs, IVAS_LFE_FADE_NS );
......@@ -411,7 +448,11 @@ ivas_error ivas_create_lfe_dec(
lfe_addl_delay_s = block_offset_s - hLFE->lfe_block_delay_s;
lfe_addl_delay_s = max( 0.0f, lfe_addl_delay_s );
#ifdef NONBE_FIX_MC_LFE_LPF
add_delay_sa = (int16_t) roundf( (float) delay_ns * output_Fs / 1000000000.f );
#else
add_delay_sa = (int16_t) roundf( (float) binauralization_delay_ns * output_Fs / 1000000000.f );
#endif
hLFE->lfe_addl_delay = (int16_t) ( lfe_addl_delay_s * output_Fs ) + add_delay_sa;
hLFE->lfe_block_delay_s += lfe_addl_delay_s + add_delay_sa / output_Fs;
......
......@@ -151,6 +151,52 @@ ivas_error ivas_masa_decode(
{
if ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) )
{
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
if ( ivas_format == MASA_FORMAT )
{
/* re-read the number of objects, needed in case of bad frame */
st_ivas->nchan_ism = 5 - ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 3] + 2 * st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 2] );
}
if ( ivas_format == MASA_FORMAT && st_ivas->nchan_ism != 5 )
{
/* there was OMASA in the input */
hMasa->config.input_ivas_format = MASA_ISM_FORMAT;
if ( st_ivas->nchan_ism < 3 )
{
/* was read in ivas_init_dec() to distinguish between 1 and 2 objects */
if ( st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 1] == 0 )
{
st_ivas->nchan_ism = 1;
}
st->next_bit_pos -= MASA_TRANSP_BITS;
*nb_bits_read += MASA_TRANSP_BITS;
/* the two reserved bits were already read in ivas_init_dec()*/
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
*nb_bits_read += MASA_HEADER_BITS;
/* read number of directions */
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
( *nb_bits_read )++;
hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );
}
else
{
/* if there are 3 or 4 objects the number of transport channels bit is given to MASA format
and used to read number of directions*/
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
( *nb_bits_read )++;
hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );
/* the two reserved bits were already read in ivas_init_dec()*/
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
*nb_bits_read += MASA_HEADER_BITS;
}
}
else
{
#endif
if ( ivas_format != MASA_ISM_FORMAT )
{
/* number of transport channels is always 2 for MASA_ISM format */
......@@ -249,13 +295,14 @@ ivas_error ivas_masa_decode(
}
}
#ifndef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
/* read 2 bits:
'00' - MASA format at the encoder
'01' - MASA_ISM_FORMAT at the encoder, with 1 object
'10' - MASA_ISM_FORMAT at the encoder, with 2 objects
'11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects
reading if 3 or 4 object is performed later
'11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects; reading if 3 or 4 object is performed later
*/
#endif
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
byteBuffer = byteBuffer + 2 * st->bit_stream[( st->next_bit_pos )--];
......@@ -273,6 +320,9 @@ ivas_error ivas_masa_decode(
byteBuffer = st->bit_stream[( st->next_bit_pos )--];
( *nb_bits_read )++;
hMasa->config.numberOfDirections = (uint8_t) ( byteBuffer + 1 );
#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
}
#endif
}
else
{
......@@ -397,7 +447,11 @@ ivas_error ivas_masa_decode(
hMasa->config.coherencePresent = !hQMetaData->all_coherence_zero;
#ifdef FIX_1052_EXT_OUTPUT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) )
#else
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
#endif
{
index_16bits( hQMetaData, hMasa->data.sph_grid16 );
}
......@@ -617,7 +671,11 @@ ivas_error ivas_masa_dec_open(
hMasa->config.joinedSubframes = FALSE;
/* Create spherical grid only for external output */
#ifdef FIX_1052_EXT_OUTPUT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) )
#else
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
#endif
{
if ( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL )
{
......@@ -1048,6 +1106,9 @@ static ivas_error init_lfe_synth_data(
( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_7_1 ||
output_config == IVAS_AUDIO_CONFIG_5_1_2 ||
output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 ||
#ifdef FIX_1052_EXT_OUTPUT
output_config == IVAS_AUDIO_CONFIG_EXTERNAL ||
#endif
output_config == IVAS_AUDIO_CONFIG_FOA || output_config == IVAS_AUDIO_CONFIG_HOA2 ||
output_config == IVAS_AUDIO_CONFIG_HOA3 ||
( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) )
......@@ -1413,18 +1474,17 @@ ivas_error ivas_masa_dec_reconfigure(
{
if ( st_ivas->hDiracDecBin[pos_idx] != NULL )
{
#else
if ( st_ivas->hDiracDecBin != NULL )
{
#endif
/* regularization factor is bitrate-dependent */
#ifdef SPLIT_REND_WITH_HEAD_ROT
st_ivas->hDiracDecBin[pos_idx]->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate );
}
}
#else
if ( st_ivas->hDiracDecBin != NULL )
{
/* regularization factor is bitrate-dependent */
st_ivas->hDiracDecBin->reqularizationFactor = configure_reqularization_factor( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate );
#endif
}
#endif
if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT ) /* note: switching within OMASA is handled in ivas_omasa_dec_config() */
{
......
......@@ -148,7 +148,11 @@ ivas_error ivas_param_mc_dec_open(
hParamMC->hoa_encoder = NULL;
/* determine the synthesis config */
#ifdef FIX_1052_EXT_OUTPUT
if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD || st_ivas->transport_config == output_config || output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
#else
if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD || st_ivas->transport_config == output_config )
#endif
{
hParamMC->synthesis_conf = PARAM_MC_SYNTH_DIRECT;
}
......@@ -1689,24 +1693,24 @@ void ivas_param_mc_dec_render(
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
if ( st_ivas->hSplitBinRend->hCldfbDataOut != NULL )
{
for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
{
for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
{
mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
}
}
st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
}
#endif
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
&st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
NULL,
#endif
......@@ -1725,8 +1729,8 @@ void ivas_param_mc_dec_render(
{
for ( ch = 0; ch < nchan_out_cldfb; ch++ )
{
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
}
}
}
......
......@@ -761,18 +761,18 @@ static void ivas_mc_paramupmix_dec_sf(
/*LFE handling for split rendering cases*/
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
if ( st_ivas->hSplitBinRend->hCldfbDataOut != NULL )
{
for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ )
{
for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
{
mvr2r( Cldfb_RealBuffer_subfr[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer_subfr[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_RealBuffer_subfr[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_RealBuffer[ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer_subfr[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_index_start + slot_idx], maxBand );
}
}
st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
}
}
#endif
......@@ -780,7 +780,7 @@ static void ivas_mc_paramupmix_dec_sf(
/* Implement binaural rendering */
ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
&st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
#endif
st_ivas->hCombinedOrientationData,
st_ivas->hTcBuffer->subframe_nbslots[subframeIdx],
......@@ -798,8 +798,8 @@ static void ivas_mc_paramupmix_dec_sf(
{
for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_index_start + slot_idx], maxBand );
}
}
}
......
......@@ -87,6 +87,9 @@ ivas_error ivas_mct_dec(
STnsData tnsData[MCT_MAX_BLOCKS][CPE_CHANNELS][NB_DIV];
Decoder_State **sts;
float synth[CPE_CHANNELS][L_FRAME_PLUS];
#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
float *p_output_orig[2];
#endif
float output_lfe_ch[L_FRAME48k];
int32_t ivas_total_brate;
ivas_error error;
......@@ -148,6 +151,18 @@ ivas_error ivas_mct_dec(
/* MCT side bits decoder */
ivas_mct_side_bits( hMCT, st_ivas->hCPE, nCPE, st_ivas->hCPE[0]->hCoreCoder[0], st_ivas->bfi, st_ivas->hCPE[0]->hCoreCoder[0]->bit_stream, ivas_total_brate, nb_bits_metadata );
#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
/* in case of switching from an SID frame (with ACELP core) to MCT, buffer of L_FRAME_PLUS samples is needed -> use synth[] as a temporary buffer */
if ( st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE )
{
for ( n = 0; n < CPE_CHANNELS; n++ )
{
p_output_orig[n] = output[n];
output[n] = synth[n];
}
}
#endif
for ( cpe_id = 0; cpe_id < nCPE; cpe_id++ )
{
st_ivas->hCPE[cpe_id]->hCoreCoder[0]->BER_detect |= st_ivas->BER_detect;
......@@ -232,6 +247,17 @@ ivas_error ivas_mct_dec(
ivas_mdct_core_reconstruct( hCPE, x, synth, fUseTns[cpe_id], 1 );
#ifdef NONBE_FIX_1087_OOB_SBA_DTX_RS
/* set pointers back */
if ( cpe_id == 0 && st_ivas->hCPE[0]->hCoreCoder[0]->last_core == ACELP_CORE )
{
for ( n = 0; n < CPE_CHANNELS; n++ )
{
output[n] = p_output_orig[n];
}
}
#endif
/*----------------------------------------------------------------*
* CoreCoder Post-processing and updates
*----------------------------------------------------------------*/
......@@ -263,7 +289,6 @@ ivas_error ivas_mct_dec(
#endif
} /* n_channels loop */
/* synthesis synchronization between stereo modes */
if ( !st_ivas->sba_dirac_stereo_flag || ( st_ivas->ivas_format == SBA_ISM_FORMAT && cpe_id < nCPE - 2 ) )
{
......@@ -673,6 +698,15 @@ ivas_error ivas_mc_dec_config(
{
st_ivas->transport_config = signaled_config;
}
#ifdef FIX_1052_EXT_OUTPUT
else if ( st_ivas->transport_config != signaled_config )
{
#ifdef DEBUGGING
fprintf( stderr, "\nError: Switching of MC configurations is not supported!\n" );
#endif
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong MC configuration signalled!" );
}
#endif
/* select MC format mode */
st_ivas->mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate );
......@@ -680,7 +714,11 @@ ivas_error ivas_mc_dec_config(
/* MC format switching */
if ( st_ivas->ini_frame != 0 )
{
#ifdef FIX_1052_EXT_OUTPUT
if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || last_mc_mode != st_ivas->mc_mode )
#else
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 )
#endif
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( ( error = ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
......@@ -1117,21 +1155,46 @@ static ivas_error ivas_mc_dec_reconfig(
if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL )
{
#ifdef NONBE_FIX_MC_LFE_LPF
int32_t delay_ns = st_ivas->binaural_latency_ns;
#else
int32_t binauralization_delay_ns = st_ivas->binaural_latency_ns;
#endif
if ( st_ivas->hBinRenderer != NULL )
{
if ( st_ivas->hBinRenderer->render_lfe )
{
/* Account for filterbank delay */
#ifdef NONBE_FIX_MC_LFE_LPF
delay_ns += IVAS_FB_DEC_DELAY_NS;
#else
binauralization_delay_ns += IVAS_FB_DEC_DELAY_NS;
#endif
}
else
{
#ifdef NONBE_FIX_MC_LFE_LPF
delay_ns = 0;
#else
binauralization_delay_ns = 0;
#endif
}
}
#ifdef NONBE_FIX_MC_LFE_LPF
else
{
if ( ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) )
{
delay_ns += IVAS_FB_DEC_DELAY_NS;
}
}
#endif
#ifdef NONBE_FIX_MC_LFE_LPF
if ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, delay_ns ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
......@@ -1192,6 +1255,12 @@ static ivas_error ivas_mc_dec_reconfig(
if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) )
{
ivas_binRenderer_close( &st_ivas->hBinRenderer );
#ifdef FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR
if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
{
efap_free_data( &st_ivas->hEFAPdata );
}
#endif
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
......@@ -1202,7 +1271,7 @@ static ivas_error ivas_mc_dec_reconfig(
{
#ifdef SPLIT_REND_WITH_HEAD_ROT
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses );
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
#else
ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
#endif
......@@ -1210,15 +1279,7 @@ static ivas_error ivas_mc_dec_reconfig(
if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) )
{
#ifdef NONBE_FIX_1045_ISM_BITRATE_SWITCHING
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
#else
if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE )
{
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
st_ivas->hHrtfTD = NULL;
}
#endif
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
......@@ -1291,7 +1352,7 @@ 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 ) )
{
#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->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
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->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#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->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
#endif
......
......@@ -61,8 +61,13 @@ ivas_error ivas_td_binaural_open(
num_src = st_ivas->nchan_ism;
}
#ifdef CONF_DISTATT
return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, num_src, st_ivas->ivas_format,
st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hRenderConfig->distAtt, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns );
#else
return ivas_td_binaural_open_unwrap( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, num_src, st_ivas->ivas_format,
st_ivas->transport_config, st_ivas->hRenderConfig->directivity, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns );
#endif
}
......@@ -240,7 +245,7 @@ ivas_error ivas_td_binaural_renderer_sf(
ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
float *output[], /* i/o: SCE channels / Binaural synthesis */
int16_t nSamplesRendered /* i : number of samples to render */
const int16_t nSamplesRendered /* i : number of samples to render */
)
{
int16_t i;
......@@ -252,15 +257,15 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
int16_t original_subframes_rendered;
int16_t original_slots_rendered;
float *p_bin_output[BINAURAL_CHANNELS];
float output_local[MAX_OUTPUT_CHANNELS][L_FRAME48k]; // VE2SB: TBV
float output_local[MAX_OUTPUT_CHANNELS][L_FRAME48k];
push_wmops( "ivas_td_binaural_renderer_sf_splitBinaural" );
pMultiBinPoseData = &st_ivas->hSplitBinRend.splitrend.multiBinPoseData;
pMultiBinPoseData = &st_ivas->hSplitBinRend->splitrend.multiBinPoseData;
/* If not yet allocated, open additional instances of TD renderer */
for ( i = 0; i < pMultiBinPoseData->num_poses - 1; ++i )
{
if ( st_ivas->hSplitBinRend.splitrend.hTdRendHandles[i] != NULL )
if ( st_ivas->hTdRendHandles[i] != NULL )
{
continue;
}
......@@ -271,8 +276,11 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
st_ivas->ivas_format,
st_ivas->transport_config,
st_ivas->hRenderConfig->directivity,
#ifdef CONF_DISTATT
st_ivas->hRenderConfig->distAtt,
#endif
st_ivas->hTransSetup,
&st_ivas->hSplitBinRend.splitrend.hTdRendHandles[i],
&st_ivas->hTdRendHandles[i],
&st_ivas->binaural_latency_ns ) ) != IVAS_ERR_OK )
{
return error;
......@@ -333,7 +341,7 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
/* Render */
if ( pos_idx != 0 )
{
st_ivas->hBinRendererTd = st_ivas->hSplitBinRend.splitrend.hTdRendHandles[pos_idx - 1];
st_ivas->hBinRendererTd = st_ivas->hTdRendHandles[pos_idx - 1];
}
if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_bin_output, nSamplesRendered ) ) != IVAS_ERR_OK )
......
......@@ -300,7 +300,6 @@ ivas_error ivas_omasa_dec_config(
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
{
/* the full number of hIsmMetaData are needed for EXT output */
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
if ( st_ivas->hIsmMetaData[0] == NULL )
{
if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK )
......@@ -315,17 +314,6 @@ ivas_error ivas_omasa_dec_config(
ivas_ism_reset_metadata_handle_dec( st_ivas->hIsmMetaData[k] );
}
}
#else
n_MD = st_ivas->nchan_ism;
ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 );
if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK )
{
return error;
}
ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD );
#endif
}
else
{
......@@ -340,20 +328,15 @@ ivas_error ivas_omasa_dec_config(
return error;
}
}
#ifdef NONBE_FIX_1065_ISM_MD_HANDLE
else
{
ivas_ism_reset_metadata_handle_dec( st_ivas->hIsmMetaData[0] );
}
#endif
}
else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC )
{
n_MD = st_ivas->nchan_ism;
#ifndef NONBE_FIX_1065_ISM_MD_HANDLE
ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 );
#endif
if ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, NULL ) ) != IVAS_ERR_OK )
{
return error;
......@@ -426,20 +409,11 @@ ivas_error ivas_omasa_dec_config(
}
else
{
#ifdef NONBE_FIX_1045_ISM_BITRATE_SWITCHING
if ( st_ivas->hBinRendererTd != NULL )
{
/* TD renderer handle */
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
}
#else
if ( st_ivas->hBinRendererTd != NULL && st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE )
{
/* TD renderer handle */
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
st_ivas->hHrtfTD = NULL;
}
#endif
/* ISM renderer handle + ISM data handle */
ivas_omasa_separate_object_renderer_close( st_ivas );
}
......@@ -783,6 +757,11 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];
ivas_error error;
float *p_sepobj[MAX_NUM_OBJECTS];
#ifdef SPLIT_REND_WITH_HEAD_ROT
int16_t slot_idx_start;
slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered;
#endif
for ( n = 0; n < MAX_NUM_OBJECTS; n++ )
{
......@@ -794,6 +773,45 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
/* reset combined orientation access index before calling the td renderer */
ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData );
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
int16_t slot_idx, num_cldfb_bands, nchan_transport_orig, cldfb_slots;
float Cldfb_RealBuffer[CLDFB_NO_CHANNELS_MAX];
float Cldfb_ImagBuffer[CLDFB_NO_CHANNELS_MAX];
float *p_rend_obj[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS]; /* [8 * 2] */
for ( n = 0; n < st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS; n++ )
{
p_rend_obj[n] = &output_f[n][0];
}
num_cldfb_bands = st_ivas->hSplitBinRend->splitrend.hCldfbHandles->cldfbAna[0]->no_channels;
nchan_transport_orig = st_ivas->nchan_transport;
st_ivas->nchan_transport = st_ivas->nchan_ism;
if ( ( error = ivas_td_binaural_renderer_sf_splitBinaural( st_ivas, p_rend_obj, *nSamplesRendered ) ) != IVAS_ERR_OK ) /* objects are read from st_ivas->hTcBuffer->tc[2..(1+n_isms)] */
{
return error;
}
st_ivas->nchan_transport = nchan_transport_orig;
cldfb_slots = *nSamplesRendered / num_cldfb_bands;
for ( n = 0; n < st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++n )
{
for ( slot_idx = 0; slot_idx < cldfb_slots; slot_idx++ )
{
cldfbAnalysis_ts( &( p_rend_obj[n][num_cldfb_bands * slot_idx] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, num_cldfb_bands, st_ivas->hSplitBinRend->splitrend.hCldfbHandles->cldfbAna[n] );
/* note: this intentionally differs from OSBA by: no scaling by 0.5 */
v_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx], Cldfb_RealBuffer, st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx], num_cldfb_bands );
v_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx], Cldfb_ImagBuffer, st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx], num_cldfb_bands );
}
}
}
else
{
#endif
if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_sepobj, *nSamplesRendered ) ) != IVAS_ERR_OK )
{
return error;
......@@ -802,7 +820,9 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
{
v_add( output_f[n], p_sepobj[n], output_f[n], *nSamplesRendered );
}
#ifdef SPLIT_REND_WITH_HEAD_ROT
}
#endif
return IVAS_ERR_OK;
}
......
......@@ -137,6 +137,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm(
float output_separated_objects[BINAURAL_CHANNELS][L_FRAME48k]; // VE2SB: TBV
float *p_sepobj[BINAURAL_CHANNELS];
int16_t channel_offset;
#ifdef SPLIT_REND_WITH_HEAD_ROT
int16_t slot_idx_start;
slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered;
#endif
for ( n = 0; n < BINAURAL_CHANNELS; n++ )
{
......@@ -150,19 +155,21 @@ ivas_error ivas_osba_dirac_td_binaural_jbm(
return error;
}
#ifdef NONBE_FIX_ISM_XOVER_BR
ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData );
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
int16_t slot_idx, num_cldfb_bands, b, nchan_transport_orig;
int16_t cldfb_slots, slot_idx_start;
int16_t cldfb_slots;
float Cldfb_RealBuffer[CLDFB_NO_CHANNELS_MAX];
float Cldfb_ImagBuffer[CLDFB_NO_CHANNELS_MAX];
num_cldfb_bands = st_ivas->hSplitBinRend.splitrend.hCldfbHandles->cldfbAna[0]->no_channels;
num_cldfb_bands = st_ivas->hSplitBinRend->splitrend.hCldfbHandles->cldfbAna[0]->no_channels;
nchan_transport_orig = st_ivas->nchan_transport;
st_ivas->nchan_transport = st_ivas->nchan_ism;
slot_idx_start = st_ivas->hTcBuffer->n_samples_rendered / num_cldfb_bands;
if ( ( error = ivas_td_binaural_renderer_sf_splitBinaural( st_ivas, output_f, *nSamplesRendered ) ) != IVAS_ERR_OK )
{
return error;
......@@ -170,20 +177,20 @@ ivas_error ivas_osba_dirac_td_binaural_jbm(
st_ivas->nchan_transport = nchan_transport_orig;
cldfb_slots = *nSamplesRendered / num_cldfb_bands;
for ( n = 0; n < st_ivas->hSplitBinRend.splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++n )
for ( n = 0; n < st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS; ++n )
{
for ( slot_idx = 0; slot_idx < cldfb_slots; slot_idx++ )
{
cldfbAnalysis_ts( &( output_f[n][num_cldfb_bands * slot_idx] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, num_cldfb_bands, st_ivas->hSplitBinRend.splitrend.hCldfbHandles->cldfbAna[n] );
cldfbAnalysis_ts( &( output_f[n][num_cldfb_bands * slot_idx] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, num_cldfb_bands, st_ivas->hSplitBinRend->splitrend.hCldfbHandles->cldfbAna[n] );
for ( b = 0; b < num_cldfb_bands; b++ )
{
st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx][b] =
( 0.5f * st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) +
st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] =
( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) +
( 0.5f * Cldfb_RealBuffer[b] );
st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx][b] =
( 0.5f * st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) +
st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] =
( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) +
( 0.5f * Cldfb_ImagBuffer[b] );
}
}
......
......@@ -34,9 +34,6 @@
#include "options.h"
#include "ivas_cnst.h"
#include "ivas_prot.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
#include "ivas_prot_rend.h"
#endif
#include "ivas_stat_dec.h"
#ifdef DEBUGGING
#include "debug.h"
......@@ -436,7 +433,11 @@ void ivas_renderer_select(
else if ( st_ivas->ivas_format == MC_FORMAT )
{
*internal_config = transport_config;
#ifdef FIX_1052_EXT_OUTPUT
if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#else
if ( st_ivas->mc_mode == MC_MODE_MCT && *internal_config != output_config )
#endif
{
if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
{
......@@ -450,7 +451,11 @@ void ivas_renderer_select(
else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
{
*internal_config = transport_config;
#ifdef FIX_1052_EXT_OUTPUT
if ( *internal_config != output_config && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#else
if ( *internal_config != output_config )
#endif
{
if ( output_config != IVAS_AUDIO_CONFIG_FOA && output_config != IVAS_AUDIO_CONFIG_HOA2 && output_config != IVAS_AUDIO_CONFIG_HOA3 )
{
......@@ -475,7 +480,14 @@ void ivas_renderer_select(
}
else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
{
#ifdef FIX_1052_EXT_OUTPUT
if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
{
*internal_config = output_config;
}
#else
*internal_config = output_config;
#endif
/* 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 )
......
......@@ -1203,6 +1203,9 @@ int16_t ivas_qmetadata_dec_sid_decode(
float direction_vector[3];
int16_t metadata_sid_bits; /* bits allocated to SID for metadata */
int16_t bits_delta, bits_dir;
#ifdef NONBE_FIX_1052_SBA_EXT
int16_t sba_spar_bitlen;
#endif
#ifdef DEBUG_MODE_QMETADATA
static FILE *pF = NULL;
static FILE *pF_azi = NULL;
......@@ -1221,7 +1224,12 @@ int16_t ivas_qmetadata_dec_sid_decode(
if ( ivas_format == SBA_FORMAT )
{
#ifdef NONBE_FIX_1052_SBA_EXT
sba_spar_bitlen = ivas_sba_spar_sid_bitlen( nchan_transport );
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - sba_spar_bitlen - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/
#else
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/
#endif
}
else
{
......
......@@ -390,6 +390,7 @@ const float dirac_dithering_ele_scale[DIRAC_DIFFUSE_LEVELS] =
6.716062e-01f, 1.011804e+00f, 1.796875e+00f, 2.804382e+00f, 4.623130e+00f, 7.802667e+00f, 1.045446e+01f, 1.379538e+01f
};
#ifndef FIX_1053_REVERB_RECONFIGURATION
/*----------------------------------------------------------------------------------*
* FASTCONV and PARAMETRIC binaural renderer ROM tables
*----------------------------------------------------------------------------------*/
......@@ -399,146 +400,8 @@ const float dmxmtx_table[BINAURAL_CHANNELS][11] =
{ 1.0f, 0.0f, 0.70709997f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f },
{ 0.0f, 1.0f, 0.70709997f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f },
};
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*----------------------------------------------------------------------*
* Binuaral split rendering ROM tables
*-----------------------------------------------------------------------*/
/* rotations in this array are relative to ref rotation */
const float ivas_split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f};
const float ivas_split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f};
const float ivas_split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {10.0f, 10.0f};
const float ivas_split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f};
const float ivas_split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES] = {-15.0f, 15.0f};
const float ivas_split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f};
const float ivas_split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES] = {-15.0f, 15.0f};
const float ivas_split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES] = {-15.0f, 15.0f};
const int16_t ivas_split_rend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 20, 25, 30, 35, 40, 50, 60
};
const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] =
{
{0,8,252},{1,8,253},{2,7,124},{3,6,60},{4,5,28},{5,4,12},
{6,3,4},{7,1,0},{8,3,5},{9,4,13},{10,5,29},{11,6,61},
{12,7,125},{13,8,254},{14,8,255}
};
const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] =
{
{ 0, 1, 0 },{ 1, 2, 2 },{ 2, 3, 6 },{ 3, 4, 14 },
{ 4, 5, 30 },{ 5, 6, 62 },{ 6, 7, 126 },{ 7, 8, 254 },
{ 8, 9, 510 },{ 9, 10, 1022 },{ 10, 11, 2046 },{ 11, 12, 4094 },
{ 12, 13, 8190 },{ 13, 14, 16382 },{ 14, 14, 16383 }
};
const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3] =
{
{ 0, 1, 0 },{ 1, 2, 2 },{ 2, 3, 6 },{ 3, 4, 14 },
{ 4, 5, 30 },{ 5, 6, 62 },{ 6, 7, 126 },{ 7, 8, 254 },
{ 8, 9, 510 },{ 9, 10, 1022 },{ 10, 11, 2046 },{ 11, 12, 4094 },
{ 12, 13, 8190 },{ 13, 14, 16382 },{ 14, 14, 16383 }
};
const int32_t ivas_split_rend_huff_pred63_consts[IVAS_SPLIT_REND_PRED_63QUANT_PNTS][3] =
{
{-31,11,2040},
{-30,11,2041},
{-29,11,2042},
{-28,11,2043},
{-27,10,1012},
{-26,10,1013},
{-25,10,1014},
{-24,10,1015},
{-23,9,498},
{-22,9,499},
{-21,9,500},
{-20,9,501},
{-19,8,242},
{-18,8,243},
{-17,8,244},
{-16,8,245},
{-15,7,112},
{-14,7,113},
{-13,7,114},
{-12,7,115},
{-11,6,48},
{-10,6,49},
{-9,6,50},
{-8,6,51},
{-7,5,16},
{-6,5,17},
{-5,5,18},
{-4,5,19},
{-3,4,2},
{-2,4,3},
{-1,4,4},
{0,3,0},
{1,4,5},
{2,4,6},
{3,4,7},
{4,5,20},
{5,5,21},
{6,5,22},
{7,5,23},
{8,6,52},
{9,6,53},
{10,6,54},
{11,6,55},
{12,7,116},
{13,7,117},
{14,7,118},
{15,7,119},
{16,7,120},
{17,8,246},
{18,8,247},
{19,8,248},
{20,9,502},
{21,9,503},
{22,9,504},
{23,9,505},
{24,10,1016},
{25,10,1017},
{26,10,1018},
{27,10,1019},
{28,11,2044},
{29,11,2045},
{30,11,2046},
{31,11,2047},
};
const int32_t ivas_split_rend_huff_pred31_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3] =
{
{-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507},
{-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121},
{-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8},
{-2,4,9},{-1,3,2},{0,2,0},{1,3,3},
{2,4,10},{3,4,11},{4,5,26},{5,5,27},
{6,6,58},{7,6,59},{8,7,122},{9,7,123},
{10,7,124},{11,8,252},{12,9,508},{13,9,509},
{14,10,1022},{15,10,1023},
};
const int32_t ivas_split_rend_huff_roll_pred_consts[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS][3] =
{
{-15,10,1020},{-14,10,1021},{-13,9,506},{-12,9,507},
{-11,8,250},{-10,8,251},{-9,7,120},{-8,7,121},
{-7,6,56},{-6,6,57},{-5,5,24},{-4,5,25},{-3,4,8},
{-2,4,9},{-1,3,2},{0,2,0},{1,3,3},
{2,4,10},{3,4,11},{4,5,26},{5,5,27},
{6,6,58},{7,6,59},{8,7,122},{9,7,123},
{10,7,124},{11,8,252},{12,9,508},{13,9,509},
{14,10,1022},{15,10,1023},
};
#endif
/*----------------------------------------------------------------------*
* MC ParamUpmix ROM tables
*-----------------------------------------------------------------------*/
......
......@@ -96,37 +96,12 @@ extern const uint16_t *const sym_freq_ECSQ_tab_abs_lsbs[1 + 4];
extern const float dirac_dithering_azi_scale[DIRAC_DIFFUSE_LEVELS];
extern const float dirac_dithering_ele_scale[DIRAC_DIFFUSE_LEVELS];
#ifndef FIX_1053_REVERB_RECONFIGURATION
/*----------------------------------------------------------------------------------*
* FASTCONV and PARAMETRIC binaural renderer ROM tables
*----------------------------------------------------------------------------------*/
extern const float dmxmtx_table[BINAURAL_CHANNELS][11];
#ifdef SPLIT_REND_WITH_HEAD_ROT
/*----------------------------------------------------------------------*
* Binuaral split rendering ROM tables
*-----------------------------------------------------------------------*/
extern const float ivas_split_rend_relative_yaw_pos_angles[SPLIT_REND_MAX_YAW_ONLY_POSES];
extern const float ivas_split_rend_relative_pitch_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES];
extern const float ivas_split_rend_relative_roll_pos_angles[SPLIT_REND_MAX_PITCH_ONLY_POSES];
extern const float ivas_split_rend_relative_one_axis_pos_angles[SPLIT_REND_MAX_ONE_AXIS_MD_POSES];
extern const float ivas_split_rend_relative_one_axis_pos_angles_hq[SPLIT_REND_MAX_ONE_AXIS_MD_POSES];
extern const float ivas_split_rend_relative_yaw_pos_angles_hq[SPLIT_REND_MAX_YAW_ONLY_POSES];
extern const float ivas_split_rend_relative_pitch_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES];
extern const float ivas_split_rend_relative_roll_pos_angles_hq[SPLIT_REND_MAX_PITCH_ONLY_POSES];
extern const float ivas_split_rend_relative_pos_angles[MAX_HEAD_ROT_POSES][3];
extern const int16_t ivas_split_rend_band_grouping[MAX_SPLIT_REND_MD_BANDS + 1];
extern const int32_t ivas_split_rend_huff_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3];
extern const int32_t ivas_split_rend_huff_pred63_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3];
extern const int32_t ivas_split_rend_huff_pred31_consts[IVAS_SPLIT_REND_PRED_31QUANT_PNTS][3];
extern const int32_t ivas_split_rend_huff_roll_pred_consts[IVAS_SPLIT_REND_ROLL_PRED_QUANT_PNTS][3];
extern const int32_t ivas_split_rend_huff_p_d_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3];
extern const int32_t ivas_split_rend_huff_p_d_diff_consts[IVAS_SPLIT_REND_D_QUANT_PNTS][3];
extern const int32_t split_rend_brate_tbl[];
#endif
......
......@@ -70,7 +70,11 @@ void ivas_sba_set_cna_cng_flag(
st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1;
st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1;
}
#ifdef NONBE_FIX_ISM_XOVER_BR
else if ( st_ivas->nchan_transport == 2 && st_ivas->ivas_format != SBA_ISM_FORMAT )
#else
else if ( st_ivas->nchan_transport == 2 )
#endif
{
for ( n = 0; n < CPE_CHANNELS; n++ )
{
......@@ -124,6 +128,9 @@ ivas_error ivas_sba_dec_reconfigure(
ivas_error error;
ISM_MODE ism_mode_old;
int16_t granularity_new;
#ifdef NONBE_FIX_ISM_XOVER_BR
int16_t nchan_transport;
#endif
ism_mode_old = st_ivas->ism_mode;
hDecoderConfig = st_ivas->hDecoderConfig;
......@@ -143,7 +150,11 @@ ivas_error ivas_sba_dec_reconfigure(
if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
{
#ifdef NONBE_FIX_ISM_XOVER_BR
if ( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ) == ISM_SBA_MODE_DISC )
#else
if ( ivas_total_brate >= IVAS_256k )
#endif
{
st_ivas->ism_mode = ISM_SBA_MODE_DISC;
}
......@@ -450,6 +461,9 @@ ivas_error ivas_sba_dec_reconfigure(
* Allocate, initialize, and configure SCE/CPE/MCT handles
*-----------------------------------------------------------------*/
#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = st_ivas->nchan_transport;
#endif
if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
{
if ( ism_mode_old == ISM_MODE_NONE && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
......@@ -519,7 +533,12 @@ ivas_error ivas_sba_dec_reconfigure(
return error;
}
#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport += st_ivas->nchan_ism;
st_ivas->nCPE = ( nchan_transport + 1 ) >> 1;
#else
st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
#endif
}
else if ( ism_mode_old == ISM_SBA_MODE_DISC && st_ivas->ism_mode == ISM_MODE_NONE )
{
......@@ -531,25 +550,28 @@ ivas_error ivas_sba_dec_reconfigure(
/* Time Domain binaural renderer handle */
if ( st_ivas->hBinRendererTd != NULL )
{
#ifdef NONBE_FIX_1045_ISM_BITRATE_SWITCHING
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
#else
if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE )
{
ivas_td_binaural_close( &st_ivas->hBinRendererTd );
st_ivas->hHrtfTD = NULL;
}
#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = st_ivas->nchan_transport;
#endif
}
nchan_transport_old += st_ivas->nchan_ism;
st_ivas->ism_mode = ISM_MODE_NONE;
}
else if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
{
#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = st_ivas->nchan_transport + st_ivas->nchan_ism;
st_ivas->nCPE = ( nchan_transport + 1 ) >> 1;
nchan_transport_old += st_ivas->nchan_ism;
#else
st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1;
nCPE_old = st_ivas->nCPE;
nchan_transport_old = st_ivas->nchan_transport;
nchan_transport_old += st_ivas->nchan_ism;
#endif
}
}
......@@ -578,6 +600,7 @@ ivas_error ivas_sba_dec_reconfigure(
{
return error;
}
}
#else
if ( st_ivas->hDiracDecBin != NULL )
{
......@@ -585,8 +608,8 @@ ivas_error ivas_sba_dec_reconfigure(
{
return error;
}
#endif
}
#endif
/*-----------------------------------------------------------------*
* CLDFB instances
......