diff --git a/lib_com/options.h b/lib_com/options.h index bea3e2670e5784a62b4637526cd2da2ff5e955ff..09e29ce40bc35e30d7acb2d761a74a835bbe962f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,6 +151,7 @@ #define FIX_235 /* Issue 235: Deallocation of HR filter memory separately for lib_rend (ROM) and lib_util (from file) */ #define ENV_STAB_FIX /* Contribution 23: HQ envelope stability memory fix */ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ +#define FIX_292_VBAP_CALLOC_REMOVAL /* Nokia: Fixes issue 292 by removing the remnant callocs */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_vbap.c b/lib_dec/ivas_vbap.c index a3ec6323cf1dd459794241a3c92f5edf0ffa6ae3..ecd3a1e6c9698b29d7701d493def1bf3b45ce0bd 100644 --- a/lib_dec/ivas_vbap.c +++ b/lib_dec/ivas_vbap.c @@ -200,7 +200,12 @@ ivas_error vbap_init_data( if ( is_success && virtual_bottom_type != NO_VIRTUAL_SPEAKER_NODE ) { +#ifdef FIX_292_VBAP_CALLOC_REMOVAL + vbap->bottom_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + set_zero( vbap->bottom_virtual_speaker_node_division_gains, num_speaker_nodes ); +#else vbap->bottom_virtual_speaker_node_division_gains = (float *) calloc( num_speaker_nodes, sizeof( float ) ); +#endif is_success &= vbap->bottom_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->bottom_virtual_speaker_node_index] = 0.0f; speaker_node_ele_deg_internal[vbap->bottom_virtual_speaker_node_index] = -90.0f; @@ -208,7 +213,12 @@ ivas_error vbap_init_data( if ( is_success && virtual_top_type != NO_VIRTUAL_SPEAKER_NODE ) { +#ifdef FIX_292_VBAP_CALLOC_REMOVAL + vbap->top_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + set_zero( vbap->top_virtual_speaker_node_division_gains, num_speaker_nodes ); +#else vbap->top_virtual_speaker_node_division_gains = (float *) calloc( num_speaker_nodes, sizeof( float ) ); +#endif is_success &= vbap->top_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->top_virtual_speaker_node_index] = 0.0f; speaker_node_ele_deg_internal[vbap->top_virtual_speaker_node_index] = 90.0f; @@ -216,7 +226,12 @@ ivas_error vbap_init_data( if ( is_success && virtual_back_type != NO_VIRTUAL_SPEAKER_NODE ) { +#ifdef FIX_292_VBAP_CALLOC_REMOVAL + vbap->back_virtual_speaker_node_division_gains = (float *) malloc( num_speaker_nodes * sizeof( float ) ); + set_zero( vbap->back_virtual_speaker_node_division_gains, num_speaker_nodes ); +#else vbap->back_virtual_speaker_node_division_gains = (float *) calloc( num_speaker_nodes, sizeof( float ) ); +#endif is_success &= vbap->back_virtual_speaker_node_division_gains != NULL; speaker_node_azi_deg_internal[vbap->back_virtual_speaker_node_index] = 180.0f; speaker_node_ele_deg_internal[vbap->back_virtual_speaker_node_index] = 0.0f;