Commit ad7d5805 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Fix issue 292 by removing the remaining callocs in VBAP.

parent e9c2f3c6
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 */
+15 −0
Original line number Diff line number Diff line
@@ -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;