Commit 1a882818 authored by vaclav's avatar vaclav
Browse files

FIX_2431_AVOID_CALLOC

parent ac900052
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1598,7 +1598,11 @@ ivas_error cldfb_save_memory(
    }
    hs->memory_length = cldfb_get_memory_length( hs );
    move16();
#ifdef FIX_2431_AVOID_CALLOC
    hs->memory = (Word16 *) malloc( ( hs->memory_length + CLDFB_MEM_EXPONENTS + 1 ) * sizeof( Word16 ) );
#else
    hs->memory = (Word16 *) calloc( hs->memory_length + CLDFB_MEM_EXPONENTS + 1, sizeof( Word16 ) );
#endif

    /* save the memory */
    Copy( hs->FilterStates, hs->memory, hs->memory_length );
+8 −2
Original line number Diff line number Diff line
@@ -651,7 +651,11 @@ Word16 modify_Fs_intcub3m_sup_fx(
    const Word16( *cu )[3] = 0;
    Word16 *sigin_sr, *sigOutptr, *cptr;
    const Word16 *uptr, *ctptr;
#ifdef FIX_2431_AVOID_CALLOC
    Word16 sigin_sr_tab[NS2SA( 16000, DELAY_CLDFB_NS ) + 2];
#else
    Word16 *sigin_sr_tab;
#endif
    Word16 lim, inc, lim2, lim3;
    Word32 vv32;
#define QSR 2 /* right shift to avoid overflow, 2 is OK */
@@ -677,7 +681,9 @@ Word16 modify_Fs_intcub3m_sup_fx(
    }
    ELSE
    {
#ifndef FIX_2431_AVOID_CALLOC
        sigin_sr_tab = (Word16 *) calloc( lg + 2, sizeof( *sigin_sr ) ); /*shift right*/
#endif
        sigin_sr = sigin_sr_tab + 2;
        FOR( i = -2; i < lg; i++ )
        {
@@ -861,7 +867,6 @@ Word16 modify_Fs_intcub3m_sup_fx(
            }
        }


        kk = sub( kk, 1 );
        if ( kk < 0 )
        {
@@ -916,8 +921,9 @@ Word16 modify_Fs_intcub3m_sup_fx(
        }
    }

#ifndef FIX_2431_AVOID_CALLOC
    free( sigin_sr_tab );

#endif
    return lg_out;
}

+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@
#define HARM_FD_BWE                                     /* VA: harmonize core-coder FD BWE function duplications */
#define FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT    /* FhG: basop issue 2411: harmonize TNSAnalysis*_fx(), DetectTnsFilt*_fx()*/        
#define HARMONIZE_READ_DECODE_TNS                       /* FhG basop 2389: Harm between two pairs of functions. */
#define FIX_2431_AVOID_CALLOC                           /* VA: basp issue 2431: avoid use of calloc() */

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

+4 −0
Original line number Diff line number Diff line
@@ -44,7 +44,11 @@ ivas_error DTFS_new_fx(
    Word16 i;

    DTFS_STRUCTURE *dtfs_fx = NULL;
#ifdef FIX_2431_AVOID_CALLOC
    dtfs_fx = (DTFS_STRUCTURE *) malloc( sizeof( DTFS_STRUCTURE ) );
#else
    dtfs_fx = (DTFS_STRUCTURE *) calloc( 1, sizeof( DTFS_STRUCTURE ) );
#endif
    IF( dtfs_fx == NULL )
    {
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTFS (SC-VBR) structure\n" ) );
+1 −1
Original line number Diff line number Diff line
@@ -793,7 +793,7 @@ void core_switching_OLA_fx(
            move16();
            out_filt_length = 0;
            move16();
            out_filt_length = modify_Fs_intcub3m_sup_fx( mem_over_hp + 2, NS2SA_FX2( 12800, DELAY_CLDFB_NS ), 12800, tmp_buf_switch2, output_Fs, &filt_delay );
            out_filt_length = modify_Fs_intcub3m_sup_fx( mem_over_hp + 2, NS2SA( 12800, DELAY_CLDFB_NS ), 12800, tmp_buf_switch2, output_Fs, &filt_delay );
            pt = tmp_buf_switch2 + sub( out_filt_length, filt_delay );
            pt2 = pt - 1;
            FOR( i = 0; i < filt_delay; i++ )
Loading