Skip to content
......@@ -679,6 +679,7 @@ static void ivas_mc_paramupmix_dec_sf(
cldfbAnalysis_ts( &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), Cldfb_RealBuffer[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], hMCParamUpmix->num_freq_bands, st_ivas->cldfbAnaDec[ch] );
}
}
for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
{
ps_pred_process_sf( hMCParamUpmix,
......@@ -837,12 +838,16 @@ static void ivas_mc_paramupmix_dec_sf(
hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch] );
}
}
/* adjust delay of other channels */
noparamupmix_delay = NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_FB_DEC_DELAY_NS );
n_samples_rendered = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered] * hMCParamUpmix->num_freq_bands;
if ( n_samples_rendered > noparamupmix_delay )
{
for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
{
/*delay is handled within LFE decoder*/
if ( st_ivas->hIntSetup.index_lfe[0] != ch )
{
float tmp_buf[L_SUBFRAME5MS_48k];
mvr2r( &output_f[ch][n_samples_rendered - noparamupmix_delay], tmp_buf, noparamupmix_delay );
......@@ -851,9 +856,12 @@ static void ivas_mc_paramupmix_dec_sf(
mvr2r( tmp_buf, hMCParamUpmix->pcm_delay[ch], noparamupmix_delay );
}
}
}
else
{
for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
{
if ( st_ivas->hIntSetup.index_lfe[0] != ch )
{
float tmp_buf[L_SUBFRAME5MS_48k];
mvr2r( &output_f[ch][0], tmp_buf, n_samples_rendered );
......@@ -863,6 +871,7 @@ static void ivas_mc_paramupmix_dec_sf(
}
}
}
}
st_ivas->hTcBuffer->slots_rendered += st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered];
st_ivas->hTcBuffer->subframes_rendered++;
......
......@@ -732,11 +732,17 @@ static ivas_error ivas_mc_dec_reconfig(
int16_t tc_nchan_tc_new;
int16_t tc_nchan_allocate_new;
int16_t tc_granularity_new;
#ifdef FIX_1330_JBM_MEMORY
int16_t nchan_out_buff;
#else
int16_t nchan_out_buff_old, nchan_out_buff;
#endif
ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
nchan_transport_old = st_ivas->nchan_transport;
#ifndef FIX_1330_JBM_MEMORY
nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#endif
last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */
/* temporally set the current mc_mode back to the previous one to make sure the following call to
......@@ -1077,42 +1083,6 @@ static ivas_error ivas_mc_dec_reconfig(
return error;
}
/*-----------------------------------------------------------------*
* 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 )
{
int32_t delay_ns = st_ivas->binaural_latency_ns;
if ( st_ivas->hBinRenderer != NULL )
{
if ( st_ivas->hBinRenderer->render_lfe )
{
/* 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, st_ivas->hDecoderConfig->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 );
}
/*-----------------------------------------------------------------*
* Reconfigure renderers
*-----------------------------------------------------------------*/
......@@ -1264,6 +1234,63 @@ static ivas_error ivas_mc_dec_reconfig(
return error;
}
/*-----------------------------------------------------------------*
* 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 ) )
{
int32_t delay_ns;
if ( st_ivas->hIntSetup.index_lfe[0] != -1 )
{
delay_ns = st_ivas->binaural_latency_ns;
}
else
{
delay_ns = 0;
}
if ( st_ivas->hBinRenderer != NULL )
{
if ( st_ivas->hBinRenderer->render_lfe )
{
/* 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 ( st_ivas->hLFE != NULL )
{
if ( st_ivas->hLFE->delay_ns != delay_ns )
{
ivas_lfe_dec_close( &( st_ivas->hLFE ) );
}
}
if ( st_ivas->hLFE == NULL )
{
if ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, st_ivas->hDecoderConfig->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 );
}
}
/*-----------------------------------------------------------------*
* JBM TC buffers
*-----------------------------------------------------------------*/
......@@ -1320,6 +1347,7 @@ static ivas_error ivas_mc_dec_reconfig(
return error;
}
}
/* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */
if ( st_ivas->hSpatParamRendCom != NULL )
{
......@@ -1344,8 +1372,11 @@ static ivas_error ivas_mc_dec_reconfig(
*-----------------------------------------------------------------*/
nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#ifdef FIX_1330_JBM_MEMORY
if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
......
......@@ -200,7 +200,11 @@ ivas_error ivas_omasa_dec_config(
int32_t ivas_total_brate, ism_total_brate, cpe_brate;
ISM_MODE ism_mode_old;
IVAS_FORMAT ivas_format_orig;
#ifdef FIX_1330_JBM_MEMORY
int16_t nchan_out_buff;
#else
int16_t nchan_out_buff, nchan_out_buff_old;
#endif
ivas_error error;
RENDERER_TYPE old_renderer_type;
......@@ -215,8 +219,9 @@ ivas_error ivas_omasa_dec_config(
ivas_format_orig = st_ivas->ivas_format;
st_ivas->ivas_format = st_ivas->last_ivas_format;
ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
#ifndef FIX_1330_JBM_MEMORY
nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#endif
st_ivas->ivas_format = ivas_format_orig;
nSCE_old = st_ivas->nSCE;
......@@ -470,7 +475,11 @@ ivas_error ivas_omasa_dec_config(
*-----------------------------------------------------------------*/
nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 );
#ifdef FIX_1330_JBM_MEMORY
if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
......@@ -673,19 +682,27 @@ void ivas_omasa_dirac_rend_jbm(
)
{
int16_t subframes_rendered;
#ifndef FIX_1330_JBM_MEMORY
int16_t slots_rendered;
#endif
int16_t n;
float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];
#ifndef FIX_1330_JBM_MEMORY
if ( !st_ivas->hDecoderConfig->Opt_tsm )
{
#endif
*nSamplesRendered = min( nSamplesAsked, st_ivas->hTcBuffer->n_samples_available );
if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
{
mvr2r( &output_f[CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[0], *nSamplesRendered );
#ifdef FIX_1330_JBM_MEMORY
if ( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
#else
if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
#endif
{
/* Gain separated object, if edited */
for ( n = 0; n < st_ivas->nchan_ism; n++ )
......@@ -704,14 +721,22 @@ void ivas_omasa_dirac_rend_jbm(
mvr2r( &output_f[n + CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[n], *nSamplesRendered );
/* Gain discrete objects, if edited */
#ifdef FIX_1330_JBM_MEMORY
if ( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->ism_gain_is_edited[n] )
#else
if ( st_ivas->hMasaIsmData->ism_gain_is_edited[n] )
#endif
{
v_multc( data_separated_objects[n], st_ivas->hMasaIsmData->gain_ism_edited[n], data_separated_objects[n], *nSamplesRendered );
}
}
/* Gain MASA part, if edited */
#ifdef FIX_1330_JBM_MEMORY
if ( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->masa_gain_is_edited )
#else
if ( st_ivas->hMasaIsmData->masa_gain_is_edited )
#endif
{
for ( int16_t ch = 0; ch < 2; ch++ )
{
......@@ -719,14 +744,22 @@ void ivas_omasa_dirac_rend_jbm(
}
}
}
#ifndef FIX_1330_JBM_MEMORY
}
#endif
subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered;
#ifndef FIX_1330_JBM_MEMORY
slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered;
#endif
ivas_dirac_dec_render( st_ivas, nchan_transport, nSamplesAsked, nSamplesRendered, nSamplesAvailable, output_f );
#ifdef FIX_1330_JBM_MEMORY
ivas_omasa_separate_object_render_jbm( st_ivas, *nSamplesRendered, data_separated_objects, output_f, subframes_rendered );
#else
ivas_omasa_separate_object_render_jbm( st_ivas, *nSamplesRendered, data_separated_objects, output_f, subframes_rendered, slots_rendered );
#endif
return;
}
......
......@@ -258,15 +258,25 @@ ivas_error ivas_osba_render_sf(
)
{
int16_t n;
#ifdef FIX_1330_JBM_MEMORY
float output_sba[MAX_OUTPUT_CHANNELS][L_FRAME48k];
float *p_output_sba[MAX_OUTPUT_CHANNELS];
#else
float output_ism[MAX_OUTPUT_CHANNELS][L_FRAME48k];
float *p_output_ism[MAX_OUTPUT_CHANNELS];
#endif
ivas_error error;
for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ )
{
#ifdef FIX_1330_JBM_MEMORY
p_output_sba[n] = output_sba[n];
#else
p_output_ism[n] = &output_ism[n][0];
#endif
}
#ifndef FIX_1330_JBM_MEMORY
if ( !st_ivas->hDecoderConfig->Opt_tsm )
{
int16_t tc_offset;
......@@ -276,23 +286,42 @@ ivas_error ivas_osba_render_sf(
mvr2r( &p_output[n][tc_offset], &output_ism[n][tc_offset], nSamplesAsked );
}
}
#endif
#ifdef FIX_1330_JBM_MEMORY
if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output_sba ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM )
{
#ifdef FIX_1330_JBM_MEMORY
ivas_ism_render_sf( st_ivas, st_ivas->renderer_type, p_output, *nSamplesRendered );
#else
ivas_ism_render_sf( st_ivas, st_ivas->renderer_type, p_output_ism, *nSamplesRendered );
#endif
}
for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ )
{
if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM )
{
#ifdef FIX_1330_JBM_MEMORY
v_add( p_output[n], p_output_sba[n], p_output[n], *nSamplesRendered );
#else
v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered );
#endif
}
#ifdef FIX_1330_JBM_MEMORY
else
{
mvr2r( p_output_sba[n], p_output[n], *nSamplesRendered );
}
#endif
}
return IVAS_ERR_OK;
......
......@@ -111,8 +111,12 @@ ivas_error ivas_sba_dec_reconfigure(
int32_t ivas_total_brate;
int32_t last_ivas_total_brate;
int16_t num_channels, num_md_sub_frames;
#ifdef FIX_1330_JBM_MEMORY
int16_t nchan_out_buff;
#else
int16_t nchan_out_buff, nchan_out_buff_old;
int16_t sba_analysis_order_old_flush;
#endif
DECODER_CONFIG_HANDLE hDecoderConfig;
ivas_error error;
ISM_MODE ism_mode_old;
......@@ -123,15 +127,18 @@ ivas_error ivas_sba_dec_reconfigure(
hDecoderConfig = st_ivas->hDecoderConfig;
ivas_total_brate = hDecoderConfig->ivas_total_brate;
last_ivas_total_brate = st_ivas->last_active_ivas_total_brate;
#ifndef FIX_1330_JBM_MEMORY
sba_analysis_order_old_flush = st_ivas->sba_analysis_order;
#endif
/*-----------------------------------------------------------------*
* Set SBA high-level parameters
* Save old SBA high-level parameters
*-----------------------------------------------------------------*/
#ifndef FIX_1330_JBM_MEMORY
nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, sba_analysis_order_old_flush, last_ivas_total_brate );
#endif
ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
nchan_hp20_old = getNumChanSynthesis( st_ivas );
......@@ -591,8 +598,11 @@ ivas_error ivas_sba_dec_reconfigure(
*-----------------------------------------------------------------*/
nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
#ifdef FIX_1330_JBM_MEMORY
if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff, hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
#else
if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK )
#endif
{
return error;
}
......
......@@ -790,7 +790,7 @@ typedef struct ivas_lfe_dec_data_structure
LFE_WINDOW_HANDLE pWindow_state;
const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS];
int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS];
float lfe_block_delay_s;
int32_t delay_ns;
int16_t lfe_prior_buf_len;
float prior_out_buffer[L_FRAME48k];
......@@ -846,6 +846,7 @@ typedef struct
} ISAR_DEC_SPLIT_REND_WRAPPER, *ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE;
/*----------------------------------------------------------------------------------*
* MASA decoder structures
*----------------------------------------------------------------------------------*/
......@@ -963,6 +964,10 @@ typedef struct decoder_tc_buffer_structure
int16_t num_slots;
int16_t n_samples_discard; /* number of samples to discard from the beginning of the output */
#ifdef FIX_1330_JBM_MEMORY
float *tc_buffer2; /* non-scaled buffer of output audio - needed only when '*tc_buffer* is not long enough */
#endif
} DECODER_TC_BUFFER, *DECODER_TC_BUFFER_HANDLE;
typedef struct jbm_metadata_structure
......
......@@ -60,9 +60,17 @@
static float GivensRotation( const float x, const float z );
#ifdef NONBE_SVD_OPTIMIZATION
static void biDiagonalReductionLeft( float singularVectors[][MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *g );
#else
static void biDiagonalReductionLeft( float singularVectors[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], float secDiag[MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *sig_x, float *g );
#endif
#ifdef NONBE_SVD_OPTIMIZATION
static void biDiagonalReductionRight( float singularVectors[][MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *g );
#else
static void biDiagonalReductionRight( float singularVectors[][MAX_OUTPUT_CHANNELS], float secDiag[MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC, const int16_t currChannel, float *sig_x, float *g );
#endif
static void singularVectorsAccumulationLeft( float singularVectors_Left[][MAX_OUTPUT_CHANNELS], float singularValues[MAX_OUTPUT_CHANNELS], const int16_t nChannelsL, const int16_t nChannelsC );
......@@ -489,13 +497,28 @@ static void HouseholderReduction(
float *eps_x )
{
int16_t nCh;
float g = 0.0f, sig_x = 0.0f;
#ifdef NONBE_SVD_OPTIMIZATION
float g_left = 0.0f;
float g_right = 0.0f;
#else
float sig_x = 0.0f;
float g = 0.0f;
#endif
/* Bidiagonal Reduction for every channel */
for ( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */
{
#ifdef NONBE_SVD_OPTIMIZATION
secDiag[nCh] = g_right; /* from the previous channel */
biDiagonalReductionLeft( singularVectors_Left, nChannelsL, nChannelsC, nCh, &g_left );
singularValues[nCh] = g_left;
biDiagonalReductionRight( singularVectors_Left, nChannelsL, nChannelsC, nCh, &g_right );
#else
biDiagonalReductionLeft( singularVectors_Left, singularValues, secDiag, nChannelsL, nChannelsC, nCh, &sig_x, &g );
biDiagonalReductionRight( singularVectors_Left, secDiag, nChannelsL, nChannelsC, nCh, &sig_x, &g );
#endif
*eps_x = max( *eps_x, ( fabsf( singularValues[nCh] ) + fabsf( secDiag[nCh] ) ) );
}
......@@ -512,7 +535,58 @@ static void HouseholderReduction(
*
*
*-------------------------------------------------------------------------*/
#ifdef NONBE_SVD_OPTIMIZATION
static void biDiagonalReductionLeft(
float singularVectors[][MAX_OUTPUT_CHANNELS],
const int16_t nChannelsL,
const int16_t nChannelsC,
const int16_t currChannel,
float *g )
{
int16_t iCh, jCh;
float norm_x, f, r;
/* Setting values to 0 */
( *g ) = 0.0f;
if ( currChannel < nChannelsL ) /* i <= m */
{
norm_x = 0.0f;
for ( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
{
norm_x += ( singularVectors[jCh][currChannel] * singularVectors[jCh][currChannel] );
}
if ( ( norm_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
{
( *g ) = -( singularVectors[currChannel][currChannel] >= 0 ? 1 : ( -1 ) ) * sqrtf( norm_x );
r = ( *g ) * singularVectors[currChannel][currChannel] - norm_x;
singularVectors[currChannel][currChannel] = ( singularVectors[currChannel][currChannel] - ( *g ) );
for ( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */
{
norm_x = 0.0f;
for ( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
{
norm_x += ( singularVectors[jCh][currChannel] * singularVectors[jCh][iCh] );
}
f = norm_x / maxWithSign( r );
for ( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
{
singularVectors[jCh][iCh] += ( f * singularVectors[jCh][currChannel] );
}
}
}
}
return;
}
#else
static void biDiagonalReductionLeft(
float singularVectors[][MAX_OUTPUT_CHANNELS],
float singularValues[MAX_OUTPUT_CHANNELS],
......@@ -583,7 +657,7 @@ static void biDiagonalReductionLeft(
return;
}
#endif
/*-------------------------------------------------------------------------
* biDiagonalReductionRight()
......@@ -591,6 +665,56 @@ static void biDiagonalReductionLeft(
*
*-------------------------------------------------------------------------*/
#ifdef NONBE_SVD_OPTIMIZATION
static void biDiagonalReductionRight(
float singularVectors[][MAX_OUTPUT_CHANNELS],
const int16_t nChannelsL,
const int16_t nChannelsC,
const int16_t currChannel,
float *g )
{
int16_t iCh, jCh, idx;
float norm_x, r;
/* Setting values to 0 */
( *g ) = 0.0f;
if ( currChannel < nChannelsL && currChannel != ( nChannelsC - 1 ) ) /* i <=m && i !=n */
{
idx = currChannel + 1;
norm_x = 0.0f;
for ( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */
{
norm_x += ( singularVectors[currChannel][jCh] * singularVectors[currChannel][jCh] );
}
if ( norm_x ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
{
( *g ) = -( singularVectors[currChannel][idx] >= 0 ? 1 : ( -1 ) ) * sqrtf( norm_x );
r = ( *g ) * singularVectors[currChannel][idx] - norm_x;
singularVectors[currChannel][idx] = ( singularVectors[currChannel][idx] - ( *g ) );
for ( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /* nChannelsL */
{
norm_x = 0.0f;
for ( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
{
norm_x += ( singularVectors[iCh][jCh] * singularVectors[currChannel][jCh] );
}
norm_x /= r;
for ( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
{
singularVectors[iCh][jCh] += ( norm_x * singularVectors[currChannel][jCh] );
}
}
}
}
return;
}
#else
static void biDiagonalReductionRight(
float singularVectors[][MAX_OUTPUT_CHANNELS],
float secDiag[MAX_OUTPUT_CHANNELS],
......@@ -601,6 +725,7 @@ static void biDiagonalReductionRight(
float *g )
{
int16_t iCh, jCh, idx;
float norm_x, r;
/* Setting values to 0 */
......@@ -657,7 +782,7 @@ static void biDiagonalReductionRight(
return;
}
#endif
/*-------------------------------------------------------------------------
* singularVectorsAccumulationLeft()
......
......@@ -725,6 +725,17 @@ uint8_t apa_exec(
ps->nFramesSinceSetScale >>= statsResetShift;
}
#ifdef DEBUG_APA_SILENCE_NON_SCALED
if ( l_in == *l_out )
{
set_zero( a_out, *l_out );
}
else
{
set_f( a_out, (float) INT16_MAX, *l_out );
}
#endif
return 0;
}
......
......@@ -336,7 +336,15 @@ void hq_lr_enc(
frac1 = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
L_tmp = Pow2( 30, frac1 );
exp = sub( exp, 30 );
#ifdef FIX_1369_HQ_LR_OVERFLOW
#ifdef BASOP_NOGLOB
Ep_fx[i] = L_shl_o( L_tmp, s_max( sub( exp, 6 ), -31 ), &Overflow ); /* Q -6 */
#else
Ep_fx[i] = L_shl( L_tmp, s_max( sub( exp, 6 ), -31 ) ); /* Q -6 */
#endif
#else
Ep_fx[i] = L_shl( L_tmp, sub( exp, 6 ) ); /* Q -6 */
#endif
Ep[i] = (float) ( Ep_fx[i] / pow( 2.0, -6 ) );
}
......
......@@ -33,7 +33,7 @@
#include "options.h"
#include "isar_lc3plus_common.h"
#include "ivas_error.h"
#include "lc3.h"
#include "lc3plus.h"
/*-----------------------------------------------------------------------------------------*
* Function ISAR_LC3PLUS_LC3plusErrToIvasErr()
......
......@@ -37,7 +37,7 @@
#include <stdint.h>
#include "options.h"
#include "ivas_error.h"
#include "lc3.h"
#include "lc3plus.h"
#include "isar_lc3plus_payload.h"
/*! common configuration parameters between encoder and decoder */
......
......@@ -36,7 +36,7 @@
#include "ivas_prot.h"
#include "isar_lc3plus_dec.h"
#include "isar_lc3plus_common.h"
#include "lc3.h"
#include "lc3plus.h"
#include "ivas_error_utils.h"
#include "wmc_auto.h"
......
......@@ -35,7 +35,7 @@
#include <stdint.h>
#include "options.h"
#include "lc3.h"
#include "lc3plus.h"
#include "ivas_error.h"
#include "ivas_cnst.h"
#include "isar_lc3plus_common.h"
......
......@@ -32,7 +32,7 @@
#include "isar_lc3plus_enc.h"
#include "isar_lc3plus_common.h"
#include "lc3.h"
#include "lc3plus.h"
#include "ivas_error_utils.h"
#include "prot.h"
#include "wmc_auto.h"
......
......@@ -35,7 +35,7 @@
#include <stdint.h>
#include "ivas_error.h"
#include "lc3.h"
#include "lc3plus.h"
#include "isar_lc3plus_common.h"
#include "isar_lc3plus_payload.h"
......
......@@ -35,7 +35,7 @@
#include <stdint.h>
#include <stddef.h>
#include "lc3.h"
#include "lc3plus.h"
#include "options.h"
......
......@@ -53,8 +53,8 @@
*------------------------------------------------------------------------*/
ivas_error ISAR_PRE_REND_open(
SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renerer handle */
ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i/o: Split renderer pre-renerer config */
SPLIT_REND_WRAPPER *hSplitBinRend, /* i/o: Split renderer pre-renderer handle */
ISAR_SPLIT_REND_CONFIG_DATA *pSplitRendConfig, /* i/o: Split renderer pre-renderer config */
const int32_t output_Fs, /* i : output sampling rate */
const int16_t cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */
const int16_t pcm_out_flag, /* i : Flag to indicate PCM output */
......@@ -94,9 +94,7 @@ ivas_error ISAR_PRE_REND_open(
isCldfbNeeded = 1;
}
hSplitBinRend->hCldfbHandles = NULL;
if ( isCldfbNeeded )
if ( isCldfbNeeded && hSplitBinRend->hCldfbHandles == NULL )
{
if ( ( hSplitBinRend->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL )
{
......@@ -286,7 +284,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural(
const int16_t max_bands, /* i : CLDFB bands */
float *output[], /* i/o: PCM in/out buffer */
const int16_t low_res_pre_rend_rot, /* i : low time resolution pre-renderer flag */
const int16_t cldfb_in_flag, /* i : Flag to indicate CLDFB or time doamin input */
const int16_t cldfb_in_flag, /* i : Flag to indicate CLDFB or time domain input */
const int16_t pcm_out_flag, /* i : Flag to indicate PCM output */
const int16_t ro_md_flag /* i : Flag to indicate real only metadata for yaw */
)
......
......@@ -15,9 +15,9 @@
#include "clib.h"
#include "defines.h"
#include "float.h"
#include "lc3.h"
#include "setup_dec_lc3.h"
#include "setup_enc_lc3.h"
#include "lc3plus.h"
#include "setup_dec_lc3plus.h"
#include "setup_enc_lc3plus.h"
#include "structs.h"
#include "util.h"
......
......@@ -9,13 +9,13 @@
#include "options.h"
#include "wmc_auto.h"
#include "lc3.h"
#include "lc3plus.h"
#include "defines.h"
#include "functions.h"
#include <stdio.h>
#include "setup_dec_lc3.h"
#include "setup_enc_lc3.h"
#include "setup_dec_lc3plus.h"
#include "setup_enc_lc3plus.h"
#define RETURN_IF(cond, error) \
if (cond) \
......
......@@ -7,7 +7,7 @@
* estoppel or otherwise. *
******************************************************************************/
/*! \file lc3.h
/*! \file lc3plus.h
* This header provides the API for LC3plus.
*
* This library is targeting devices with extreme memory limitations, so memory management
......