Skip to content
Commits on Source (37)
...@@ -1610,12 +1610,17 @@ typedef enum ...@@ -1610,12 +1610,17 @@ typedef enum
/*----------------------------------------------------------------------------------* /*----------------------------------------------------------------------------------*
* Amplitude Panning (EFAP, VBAP) constants * Amplitude Panning (EFAP, VBAP) constants
*----------------------------------------------------------------------------------*/ *----------------------------------------------------------------------------------*/
#ifndef FIX_1050_EFAP_ALLOC
#define PANNING_AZI_RESOLUTION 2 #define PANNING_AZI_RESOLUTION 2
#define PANNING_ELE_RESOLUTION 5 #define PANNING_ELE_RESOLUTION 5
#endif
#define EFAP_MAX_CHAN_NUM 5 /* Maximum number of channels that constitute a polygon, 4 or 5 */ #define EFAP_MAX_CHAN_NUM 5 /* Maximum number of channels that constitute a polygon, 4 or 5 */
#ifdef FIX_1050_EFAP_ALLOC
#define EFAP_MAX_POLY_SET 54 /* Upper bound on number of polygons; found to be 54 in the worst case for a speaker setup of 16.0 */
#else
#define EFAP_MAX_POLY_SET 50 /* Upper bound on number of polygons; with a Speaker setup of 16.0, we obtain 44 polygons/triangles in the matlab implementation. */ #define EFAP_MAX_POLY_SET 50 /* Upper bound on number of polygons; with a Speaker setup of 16.0, we obtain 44 polygons/triangles in the matlab implementation. */
#endif
#define EFAP_MODE_EFAP 0 /* EFAP Panning */ #define EFAP_MODE_EFAP 0 /* EFAP Panning */
#define EFAP_MODE_EFIP 1 /* EFIP Panning */ #define EFAP_MODE_EFIP 1 /* EFIP Panning */
......
...@@ -3904,6 +3904,17 @@ ivas_error ivas_osba_render_sf_fx( ...@@ -3904,6 +3904,17 @@ ivas_error ivas_osba_render_sf_fx(
Word32 *p_output[] /* o : rendered time signal */ Word32 *p_output[] /* o : rendered time signal */
); );
#ifdef NONBE_1894_OSBA_SCALING
void ivas_osba_stereo_add_channels_fx(
Word32 *tc_fx[], /* i : transport channels */
Word32 *output_fx[], /* i/o: output channels */
const Word16 gain, /* i : gain bed value Q11 */
const Word16 nchan_out, /* i : number of output channels */
const Word16 nchan_ism, /* i : number of ISM channels */
const UWord16 n_samples_to_render /* i : output frame length per channel */
);
#endif
void ivas_osba_data_close_fx( void ivas_osba_data_close_fx(
SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */
); );
......
...@@ -1737,6 +1737,7 @@ const Word32 ivas_param_mc_dmx_fac_CICP19_3tc_fx[36] = ...@@ -1737,6 +1737,7 @@ const Word32 ivas_param_mc_dmx_fac_CICP19_3tc_fx[36] =
0,0,2147483647,2147483647,0,0,0,0,0,0,0,0 /*Ct*/ 0,0,2147483647,2147483647,0,0,0,0,0,0,0,0 /*Ct*/
}; };
#ifndef FIX_1157_OBSOLETE_DMX_TABLE
const Word32 ivas_param_mc_dmx_fac_CICP19_4tc_fx[48] = const Word32 ivas_param_mc_dmx_fac_CICP19_4tc_fx[48] =
{ {
2147483647,0,1518500224,1518500224,2147483647,0,2147483647,0,0,0,0,0, /*Lht*/ 2147483647,0,1518500224,1518500224,2147483647,0,2147483647,0,0,0,0,0, /*Lht*/
...@@ -1744,7 +1745,7 @@ const Word32 ivas_param_mc_dmx_fac_CICP19_4tc_fx[48] = ...@@ -1744,7 +1745,7 @@ const Word32 ivas_param_mc_dmx_fac_CICP19_4tc_fx[48] =
0,0,0,0,0,0,0,0,2147483647,0,2147483647,0, /*Lut*/ 0,0,0,0,0,0,0,0,2147483647,0,2147483647,0, /*Lut*/
0,0,0,0,0,0,0,0,0,2147483647,0,2147483647 /*Rut*/ 0,0,0,0,0,0,0,0,0,2147483647,0,2147483647 /*Rut*/
}; };
#endif
//Q15 //Q15
const Word16 ivas_param_mc_ild_fac_CICP6_2tc_fx[6] = const Word16 ivas_param_mc_ild_fac_CICP6_2tc_fx[6] =
......
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
#define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */ #define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */
#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */ #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */
#define FIX_1050_EFAP_ALLOC /* FhG: issue 1050: reduction of memory allocated to EFAP handle */
#define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */ #define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */
#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/ #define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/
...@@ -119,10 +120,12 @@ ...@@ -119,10 +120,12 @@
#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/ #define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
#define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */ #define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */
#define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */ #define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */
#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */
#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */ #define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */
#define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */ #define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */
#define NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */ #define NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */
#define FIX_1111_TDM_LSP_BUFFER /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */ #define FIX_1111_TDM_LSP_BUFFER /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */
#define FIX_1157_OBSOLETE_DMX_TABLE /* FhG: remove obsolte ParamMC DMX table ivas_param_mc_dmx_fac_CICP19_4tc[] */
#define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */ #define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */
#define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/ #define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/
#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */ #define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */
...@@ -131,6 +134,8 @@ ...@@ -131,6 +134,8 @@
#define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */ #define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */
#define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */ #define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */
#define NONBE_1894_OSBA_SCALING /* FhG: do not scale OSBA inputs by 0.5 any more */
/* #################### End BASOP porting switches ############################ */ /* #################### End BASOP porting switches ############################ */
#define FIX_1766_TCX2ACELP_BWE_ISSUE /* VA : Fix rare BWE issue when switching from TCX to ACELP */ #define FIX_1766_TCX2ACELP_BWE_ISSUE /* VA : Fix rare BWE issue when switching from TCX to ACELP */
......
...@@ -70,7 +70,15 @@ ivas_error ivas_ism_renderer_open_fx( ...@@ -70,7 +70,15 @@ ivas_error ivas_ism_renderer_open_fx(
test(); test();
test(); test();
test(); test();
#ifdef FIX_1050_EFAP_ALLOC
test();
IF( st_ivas->hIntSetup.is_loudspeaker_setup &&
st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO &&
st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL &&
st_ivas->hEFAPdata == NULL )
#else
IF( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL && st_ivas->hEFAPdata == NULL ) IF( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL && st_ivas->hEFAPdata == NULL )
#endif
{ {
IF( NE_32( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) ) IF( NE_32( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) )
{ {
......
...@@ -2230,10 +2230,14 @@ ivas_error ivas_jbm_dec_render_fx( ...@@ -2230,10 +2230,14 @@ ivas_error ivas_jbm_dec_render_fx(
ivas_ism_render_sf_fx( st_ivas, st_ivas->renderer_type, p_output_fx, *nSamplesRendered ); ivas_ism_render_sf_fx( st_ivas, st_ivas->renderer_type, p_output_fx, *nSamplesRendered );
/* add already rendered SBA part */ /* add already rendered SBA part */
#ifdef NONBE_1894_OSBA_SCALING
ivas_osba_stereo_add_channels_fx( p_tc_fx, p_output_fx, ONE_IN_Q11, nchan_out, st_ivas->nchan_ism, *nSamplesRendered );
#else
FOR( n = 0; n < nchan_out; n++ ) FOR( n = 0; n < nchan_out; n++ )
{ {
v_add_fixed_no_hdrm( p_output_fx[n], p_tc_fx[n + st_ivas->nchan_ism], p_output_fx[n], *nSamplesRendered ); v_add_fixed_no_hdrm( p_output_fx[n], p_tc_fx[n + st_ivas->nchan_ism], p_output_fx[n], *nSamplesRendered );
} }
#endif
} }
ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) || EQ_32( st_ivas->renderer_type, RENDERER_OSBA_LS ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) || EQ_32( st_ivas->renderer_type, RENDERER_OSBA_LS ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
{ {
...@@ -2265,6 +2269,12 @@ ivas_error ivas_jbm_dec_render_fx( ...@@ -2265,6 +2269,12 @@ ivas_error ivas_jbm_dec_render_fx(
ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
{ {
ivas_dirac_dec_binaural_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output_fx ); ivas_dirac_dec_binaural_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output_fx );
#ifdef NONBE_1894_OSBA_SCALING
FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ )
{
scale_sig32( p_output_fx[n], *nSamplesRendered, 1 );
}
#endif
} }
ELSE ELSE
{ {
...@@ -2284,6 +2294,12 @@ ivas_error ivas_jbm_dec_render_fx( ...@@ -2284,6 +2294,12 @@ ivas_error ivas_jbm_dec_render_fx(
set32_fx( p_output_fx[n], 0, *nSamplesRendered ); set32_fx( p_output_fx[n], 0, *nSamplesRendered );
} }
} }
#ifdef NONBE_1894_OSBA_SCALING
FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ )
{
scale_sig32( p_output_fx[n], *nSamplesRendered, 1 );
}
#endif
} }
} }
ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
......
...@@ -203,13 +203,21 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( ...@@ -203,13 +203,21 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
FOR( b = 0; b < num_cldfb_bands; b++ ) FOR( b = 0; b < num_cldfb_bands; b++ )
{ {
st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] = st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] =
#ifdef NONBE_1894_OSBA_SCALING
L_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], Cldfb_RealBuffer[b] );
#else
L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ), L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ),
L_shr( Cldfb_RealBuffer[b], 1 ) ); L_shr( Cldfb_RealBuffer[b], 1 ) );
#endif
move32(); move32();
st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] = st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] =
#ifdef NONBE_1894_OSBA_SCALING
L_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], Cldfb_ImagBuffer[b] );
#else
L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ), L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ),
L_shr( Cldfb_ImagBuffer[b], 1 ) ); L_shr( Cldfb_ImagBuffer[b], 1 ) );
#endif
move32(); move32();
} }
} }
...@@ -227,7 +235,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx( ...@@ -227,7 +235,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
Word16 i; Word16 i;
FOR( i = 0; i < nSamplesAsked; i++ ) FOR( i = 0; i < nSamplesAsked; i++ )
{ {
#ifdef NONBE_1894_OSBA_SCALING
output_fx[n][i] = L_add( output_fx[channel_offset + n][i], p_sepobj_fx[n][i] );
#else
output_fx[n][i] = L_add( L_shr( output_fx[channel_offset + n][i], 1 ), L_shr( p_sepobj_fx[n][i], 1 ) ); output_fx[n][i] = L_add( L_shr( output_fx[channel_offset + n][i], 1 ), L_shr( p_sepobj_fx[n][i], 1 ) );
#endif
move32(); move32();
} }
} }
...@@ -318,13 +330,68 @@ ivas_error ivas_osba_render_sf_fx( ...@@ -318,13 +330,68 @@ ivas_error ivas_osba_render_sf_fx(
{ {
IF( NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) IF( NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
{ {
#ifndef NONBE_1894_OSBA_SCALING
v_add_fixed( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered, 1 ); // takes care of downscaling by 0.5f v_add_fixed( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered, 1 ); // takes care of downscaling by 0.5f
#else
v_add_fixed_no_hdrm( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered );
#endif
} }
#ifndef NONBE_1894_OSBA_SCALING
ELSE ELSE
{ {
scale_sig32( p_output[n], *nSamplesRendered, -1 ); scale_sig32( p_output[n], *nSamplesRendered, -1 );
} }
#endif
} }
return IVAS_ERR_OK; return IVAS_ERR_OK;
} }
#ifdef NONBE_1894_OSBA_SCALING
/*-------------------------------------------------------------------------*
* ivas_osba_stereo_add_channels()
*
*
*-------------------------------------------------------------------------*/
void ivas_osba_stereo_add_channels_fx(
Word32 *tc_fx[], /* i : transport channels */
Word32 *output_fx[], /* i/o: output channels */
const Word16 gain, /* i : gain bed value Q11 */
const Word16 nchan_out, /* i : number of output channels */
const Word16 nchan_ism, /* i : number of ISM channels */
const UWord16 n_samples_to_render /* i : output frame length per channel */
)
{
Word16 n;
#if 0
IF ( ism_mode == ISM_SBA_MODE_DISC )
{
#endif
IF( NE_16( gain, ONE_IN_Q11 ) )
{
assert( 0 && "Object editing is not implemented in the BASOP code!" );
}
ELSE
{
FOR( n = 0; n < nchan_out; n++ )
{
v_add_fixed_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render );
}
}
#if 0
}
ELSE
{
FOR( n = 0; n < nchan_out; n++ )
{
v_add_fixed_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render );
}
}
#endif
return;
}
#endif
...@@ -622,6 +622,10 @@ static void map_params_dirac_to_stereo( ...@@ -622,6 +622,10 @@ static void map_params_dirac_to_stereo(
move32(); move32();
} }
} }
#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO
/* Clamp values here. [-1, 1] is the allowed range, but due to precision issues they can be slightly off which can cause problems later. */
/* In Q31, this clamping happens implicitly */
#endif
q_sqrt = 0; q_sqrt = 0;
move16(); move16();
side_gain[b] = Mpy_32_32( side_gain[b], Sqrt32( L_sub( MAX_32, diffuseness[b] ), &q_sqrt ) ); /*Q31 - q_sqrt*/ side_gain[b] = Mpy_32_32( side_gain[b], Sqrt32( L_sub( MAX_32, diffuseness[b] ), &q_sqrt ) ); /*Q31 - q_sqrt*/
...@@ -640,10 +644,18 @@ static void map_params_dirac_to_stereo( ...@@ -640,10 +644,18 @@ static void map_params_dirac_to_stereo(
q_sqrt = 0; q_sqrt = 0;
move16(); move16();
} }
#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO
/* for residual prediction gain, allowed range is [0, 1]*/
res_pred_gain[b] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/
move32();
res_pred_gain[b + STEREO_DFT_BAND_MAX] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/
move32();
#else
res_pred_gain[b] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/ res_pred_gain[b] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/
move32(); move32();
res_pred_gain[b + STEREO_DFT_BAND_MAX] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/ res_pred_gain[b + STEREO_DFT_BAND_MAX] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/
move32(); move32();
#endif
} }
} }
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include "options.h" #include "options.h"
#include "prot_fx.h" #include "prot_fx.h"
#include "ivas_prot_rend_fx.h" #include "ivas_prot_rend_fx.h"
#ifdef FIX_1050_EFAP_ALLOC
#include "ivas_rom_rend.h"
#endif
#include "ivas_stat_dec.h" #include "ivas_stat_dec.h"
#include "wmc_auto.h" #include "wmc_auto.h"
#include "ivas_prot_fx.h" #include "ivas_prot_fx.h"
...@@ -49,6 +52,12 @@ ...@@ -49,6 +52,12 @@
#define EFAP_MAX_GHOST_LS 5 /* Maximum number of ghost Loudspeakers, for memory allocation purpose */ #define EFAP_MAX_GHOST_LS 5 /* Maximum number of ghost Loudspeakers, for memory allocation purpose */
#define POLY_THRESH_Q29 53687LL // Q29 #define POLY_THRESH_Q29 53687LL // Q29
#define POLY_THRESH_Q28 26843 // Q28 #define POLY_THRESH_Q28 26843 // Q28
#ifdef FIX_1050_EFAP_ALLOC
#ifdef DEBUG_EFAP_POLY_TOFILE
#define PANNING_AZI_RESOLUTION 2
#define PANNING_ELE_RESOLUTION 5
#endif
#endif
#define Q22_1 4194304 #define Q22_1 4194304
#define Q22_45_DEG 188743680 #define Q22_45_DEG 188743680
#define Q22_90_DEG 377487360 #define Q22_90_DEG 377487360
...@@ -124,6 +133,9 @@ ivas_error efap_init_data_fx( ...@@ -124,6 +133,9 @@ ivas_error efap_init_data_fx(
) )
{ {
/* Handle instance declaration */ /* Handle instance declaration */
#ifdef FIX_1050_EFAP_ALLOC
Word8 polyset_size;
#endif
EFAP *efap; EFAP *efap;
ivas_error error; ivas_error error;
...@@ -142,7 +154,7 @@ ivas_error efap_init_data_fx( ...@@ -142,7 +154,7 @@ ivas_error efap_init_data_fx(
* Allocate memory * Allocate memory
*-----------------------------------------------------------------*/ *-----------------------------------------------------------------*/
/* Memory Allocations for efap */ /* Memory allocation for main EFAP structure */
IF( ( efap = (EFAP *) malloc( sizeof( EFAP ) ) ) == NULL ) IF( ( efap = (EFAP *) malloc( sizeof( EFAP ) ) ) == NULL )
{ {
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP handle\n" ) ); return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP handle\n" ) );
...@@ -158,7 +170,7 @@ ivas_error efap_init_data_fx( ...@@ -158,7 +170,7 @@ ivas_error efap_init_data_fx(
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP speaker elevations\n" ) ); return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP speaker elevations\n" ) );
} }
/* Memory Allocation for vertexArray */ /* Memory allocation for vertexArray */
IF( ( efap->vtxData.vertexArray = (EFAP_VERTEX *) malloc( ( num_speaker_nodes + EFAP_MAX_GHOST_LS ) * sizeof( EFAP_VERTEX ) ) ) == NULL ) IF( ( efap->vtxData.vertexArray = (EFAP_VERTEX *) malloc( ( num_speaker_nodes + EFAP_MAX_GHOST_LS ) * sizeof( EFAP_VERTEX ) ) ) == NULL )
{ {
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP Vertex Array\n" ) ); return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP Vertex Array\n" ) );
...@@ -169,6 +181,22 @@ ivas_error efap_init_data_fx( ...@@ -169,6 +181,22 @@ ivas_error efap_init_data_fx(
{ {
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) ); return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) );
} }
#ifdef FIX_1050_EFAP_ALLOC
/* get upper bound of number of polygons required */
polyset_size = efap_poly_limit[num_speaker_nodes - 1];
/* Memory allocation for the polyset array */
IF( ( efap->polyData.polysetArray = (EFAP_POLYSET *) malloc( polyset_size * sizeof( EFAP_POLYSET ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) );
}
/* Memory allocation for the triangle array */
IF( ( efap->polyData.triArray = (EFAP_LS_TRIANGLE *) malloc( polyset_size * sizeof( EFAP_LS_TRIANGLE ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for EFAP bufferS\n" ) );
}
#endif
/*-----------------------------------------------------------------* /*-----------------------------------------------------------------*
* Initialize values * Initialize values
...@@ -332,6 +360,14 @@ void efap_free_data_fx( ...@@ -332,6 +360,14 @@ void efap_free_data_fx(
free( ( *hEFAPdata )->vtxData.vtxOrder ); free( ( *hEFAPdata )->vtxData.vtxOrder );
( *hEFAPdata )->vtxData.vtxOrder = NULL; ( *hEFAPdata )->vtxData.vtxOrder = NULL;
#ifdef FIX_1050_EFAP_ALLOC
free( ( *hEFAPdata )->polyData.polysetArray );
( *hEFAPdata )->vtxData.vtxOrder = NULL;
free( ( *hEFAPdata )->polyData.triArray );
( *hEFAPdata )->vtxData.vtxOrder = NULL;
#endif
free( ( *hEFAPdata )->bufferLong_fx ); free( ( *hEFAPdata )->bufferLong_fx );
( *hEFAPdata )->bufferLong_fx = NULL; ( *hEFAPdata )->bufferLong_fx = NULL;
...@@ -403,7 +439,11 @@ static ivas_error poly_init_fx( ...@@ -403,7 +439,11 @@ static ivas_error poly_init_fx(
if ( GT_32( efap->vtxData.vertexArray[n].ele /*Q22*/, ( Q22_90_DEG /*90.0 Q22*/ - 4 /*1e-6 Q22*/ ) ) || if ( GT_32( efap->vtxData.vertexArray[n].ele /*Q22*/, ( Q22_90_DEG /*90.0 Q22*/ - 4 /*1e-6 Q22*/ ) ) ||
LT_32( efap->vtxData.vertexArray[n].ele /*Q22*/, ( 4 /*1e-6 Q22*/ - Q22_90_DEG /*90.0 Q22*/ ) ) ) LT_32( efap->vtxData.vertexArray[n].ele /*Q22*/, ( 4 /*1e-6 Q22*/ - Q22_90_DEG /*90.0 Q22*/ ) ) )
{ {
#ifdef FIX_1050_EFAP_ALLOC
efap->vtxData.vertexArray[n].isNaN = true;
#else
efap->vtxData.vertexArray[n].isNaN = 1; efap->vtxData.vertexArray[n].isNaN = 1;
#endif
move16(); move16();
} }
} }
...@@ -1664,7 +1704,11 @@ static void add_vertex_fx( ...@@ -1664,7 +1704,11 @@ static void add_vertex_fx(
vtxArray[pos].idx = add( extract_l( idxAziTmp ), i_mult( 181, extract_l( L_shr( idxEleTmp, Q22 ) ) ) ); // q0 vtxArray[pos].idx = add( extract_l( idxAziTmp ), i_mult( 181, extract_l( L_shr( idxEleTmp, Q22 ) ) ) ); // q0
/* Setting the nan flag to 0 */ /* Setting the nan flag to 0 */
#ifdef FIX_1050_EFAP_ALLOC
vtxArray[pos].isNaN = false;
#else
vtxArray[pos].isNaN = 0; vtxArray[pos].isNaN = 0;
#endif
move16(); move16();
/* Set the default downmix type */ /* Set the default downmix type */
......
...@@ -114,6 +114,15 @@ extern const Word32 ivas_reverb_default_DSR_fx[]; /*Q-30*/ ...@@ -114,6 +114,15 @@ extern const Word32 ivas_reverb_default_DSR_fx[]; /*Q-30*/
* Renderer SBA & MC enc/dec matrices * Renderer SBA & MC enc/dec matrices
*----------------------------------------------------------------------------------*/ *----------------------------------------------------------------------------------*/
#ifdef FIX_1050_EFAP_ALLOC
/*----------------------------------------------------------------------------------*
* EFAP ROM tables
*----------------------------------------------------------------------------------*/
extern const Word8 efap_poly_limit[MAX_OUTPUT_CHANNELS];
#endif
/*----------------------------------------------------------------------------------* /*----------------------------------------------------------------------------------*
* LS Configuration Converter ROM tables * LS Configuration Converter ROM tables
*----------------------------------------------------------------------------------*/ *----------------------------------------------------------------------------------*/
......
...@@ -286,8 +286,15 @@ const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ = ...@@ -286,8 +286,15 @@ const Word32 ivas_reverb_default_DSR_fx[IVAS_REVERB_DEFAULT_N_BANDS] /*Q30*/ =
* Renderer SBA & MC enc/dec matrices * Renderer SBA & MC enc/dec matrices
*----------------------------------------------------------------------------------*/ *----------------------------------------------------------------------------------*/
#ifdef FIX_1050_EFAP_ALLOC
/*----------------------------------------------------------------------------------*
* EFAP ROM tables
*----------------------------------------------------------------------------------*/
const Word8 efap_poly_limit[MAX_OUTPUT_CHANNELS] = {22, 22, 22, 26, 30, 34, 36, 42, 42, 44, 47, 51, 52, 54, 54, 54};
#endif
/*----------------------------------------------------------------------------------* /*----------------------------------------------------------------------------------*
* LS Renderer ROM tables * LS Renderer ROM tables
*----------------------------------------------------------------------------------*/ *----------------------------------------------------------------------------------*/
......
...@@ -710,7 +710,11 @@ typedef struct EFAP_VERTEX ...@@ -710,7 +710,11 @@ typedef struct EFAP_VERTEX
Word32 ele; /* elevation of the loudspeaker */ /* Q22 */ Word32 ele; /* elevation of the loudspeaker */ /* Q22 */
Word32 pos[3]; /* [x y z] cartesian coordinate vector */ /* Q31 */ Word32 pos[3]; /* [x y z] cartesian coordinate vector */ /* Q31 */
Word16 idx; /* integer, that corresponds to the first index for the LS in the 1D output */ Word16 idx; /* integer, that corresponds to the first index for the LS in the 1D output */
#ifdef FIX_1050_EFAP_ALLOC
bool isNaN; /* used to indicate if the vertex is a virtual speaker */
#else
Word16 isNaN; /* used to indicate if the vertex is a virtual speaker */ Word16 isNaN; /* used to indicate if the vertex is a virtual speaker */
#endif
EFAP_VTX_DMX_TYPE dmxType; /* virtual speaker downmix type */ EFAP_VTX_DMX_TYPE dmxType; /* virtual speaker downmix type */
} EFAP_VERTEX; } EFAP_VERTEX;
...@@ -725,7 +729,11 @@ typedef struct EFAP_VERTEX_DATA ...@@ -725,7 +729,11 @@ typedef struct EFAP_VERTEX_DATA
typedef struct EFAP_POLYSET typedef struct EFAP_POLYSET
{ {
Word16 chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices */ Word16 chan[EFAP_MAX_CHAN_NUM]; /* An array indicating the loudspeaker index of the polygon vertices */
#ifdef FIX_1050_EFAP_ALLOC
bool isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */
#else
Word16 isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */ Word16 isNaN[EFAP_MAX_CHAN_NUM]; /* Indicates if one of the vertices isNaN */
#endif
Word16 numChan; /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */ Word16 numChan; /* An integer between 0 and EFAP_MAX_CHAN_NUM corresponding to the number of vertices of the polygon */
Word32 polyAzi[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the azimuth of the channels */ /* Q22 */ Word32 polyAzi[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the azimuth of the channels */ /* Q22 */
Word32 polyEle[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the elevation of the channels */ /* Q22 */ Word32 polyEle[EFAP_MAX_CHAN_NUM]; /* An array (same length as "chan"), with the elevation of the channels */ /* Q22 */
...@@ -739,9 +747,17 @@ typedef struct EFAP_LS_TRIANGLE ...@@ -739,9 +747,17 @@ typedef struct EFAP_LS_TRIANGLE
typedef struct EFAP_POLYSET_DATA typedef struct EFAP_POLYSET_DATA
{ {
#ifdef FIX_1050_EFAP_ALLOC
EFAP_POLYSET *polysetArray; /* Array of polygons */
#else
EFAP_POLYSET polysetArray[EFAP_MAX_POLY_SET]; /* Array of polygons */ EFAP_POLYSET polysetArray[EFAP_MAX_POLY_SET]; /* Array of polygons */
#endif
Word16 numPoly; /* Number of polygons */ Word16 numPoly; /* Number of polygons */
#ifdef FIX_1050_EFAP_ALLOC
EFAP_LS_TRIANGLE *triArray; /* Array of triangles */
#else
EFAP_LS_TRIANGLE triArray[EFAP_MAX_POLY_SET]; /* Array of triangles */ EFAP_LS_TRIANGLE triArray[EFAP_MAX_POLY_SET]; /* Array of triangles */
#endif
Word16 numTri; /* Number of triangles */ Word16 numTri; /* Number of triangles */
} EFAP_POLYSET_DATA; } EFAP_POLYSET_DATA;
......