Commit 2fa22e9c authored by vaclav's avatar vaclav
Browse files

Merge branch '1117-isar-malloc-in-every-frame' into 'main'

Resolve "ISAR malloc() in every frame"

See merge request !1648
parents 5ab23872 97b2cbbf
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -160,9 +160,10 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */

//#define FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT          /* Orange issue 1031 : new fix point hrtf binary file format */
//#define FIX_CREND_SIMPLIFY_CODE                         /* Ora : simplify line code in crend */
//#define FIX_CREND_SIMPLIFY_CODE                       /* Orange: simplify line code in Crend */
#define FLOAT_FIX_POINT_HRTF_FILE_FORMAT                /* allows reading floation or fix point hrtf binary file format */
#define FIX_1138_SBA_EXT_ERROR_PRINTOUT                 /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */
#define FIX_1117_ISAR_MALLOC                            /* VA: issue 1117: call ISAR malloc() only at the initialization. */

/* #################### End BE switches ################################## */

+17 −0
Original line number Diff line number Diff line
@@ -268,11 +268,13 @@ static ivas_error isar_set_split_rend_setup(
    splitRendBits->isar_frame_size_ms = 0;
    splitRendBits->lc3plus_highres = 0;

#ifndef FIX_1117_ISAR_MALLOC
    if ( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" );
    }

#endif
    ISAR_PRE_REND_GetMultiBinPoseData( hSplitBinConfig, &hSplitBinRend->splitrend.multiBinPoseData, ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->sr_pose_pred_axis : DEFAULT_AXIS );

    if ( hCombinedOrientationData != NULL )
@@ -1236,8 +1238,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
            ivas_syn_output( pOutput, numSamplesPerChannelToDecode, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out );
    }

#ifndef FIX_1117_ISAR_MALLOC
    free( st_ivas->hSplitBinRend->hMultiBinCldfbData );

#endif
    return error;
}

@@ -3919,6 +3923,11 @@ static void ivas_destroy_handle_isar(
{
    if ( *hSplitBinRend != NULL )
    {
#ifdef FIX_1117_ISAR_MALLOC
        free( ( *hSplitBinRend )->hMultiBinCldfbData );
        ( *hSplitBinRend )->hMultiBinCldfbData = NULL;

#endif
        ISAR_PRE_REND_close( &( *hSplitBinRend )->splitrend, NULL );

        if ( ( *hSplitBinRend )->hCldfbDataOut != NULL )
@@ -4114,6 +4123,14 @@ static ivas_error ivas_dec_init_split_rend(
        cldfb_in_flag = 1;
    }

#ifdef FIX_1117_ISAR_MALLOC
    /* note: this is intra-frame heap memory */
    if ( ( st_ivas->hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" );
    }

#endif
    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 == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) )