Commit b0b37828 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

add function set_zero_l()

parent 5cda0c76
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2938,6 +2938,13 @@ int16_t check_bounds_s(
    const int16_t high                                          /* i  : High limit                              */
);

#ifdef FIX_CRASH_LONG_BRIR
void set_zero_l(
    float *vec,         /* o  : input vector                                    */
    const uint32_t lvec /* i  : length of the vector                            */
);
#endif

ivas_error stereo_memory_enc(
    CPE_ENC_HANDLE hCPE,                                        /* i  : CPE encoder structure                   */
    const int32_t input_Fs,                                     /* i  : input sampling rate                     */
+22 −0
Original line number Diff line number Diff line
@@ -579,6 +579,28 @@ int16_t check_bounds_s(
    return value_adj;
}

#ifdef FIX_CRASH_LONG_BRIR
/*---------------------------------------------------------------------*
 * set_zero_l()
 *
 * Set a vector vec[] of dimension lvec to zero
 *---------------------------------------------------------------------*/

void set_zero_l(
    float *vec,         /* o  : input vector            */
    const uint32_t lvec /* i  : length of the vector    */
)
{
    uint32_t i;

    for ( i = 0; i < lvec; i++ )
    {
        *vec++ = 0.0f;
    }

    return;
}
#endif

/****************************************************************************/
/* matrix functions                                                         */
+6 −24
Original line number Diff line number Diff line
@@ -1303,10 +1303,7 @@ ivas_error ivas_rend_openCrend(
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                for ( j = 0; j < max_total_ir_len; j++ )
                {
                    hCrend->freq_buffer_re[i][j] = 0.f;
                }
                set_zero_l( hCrend->freq_buffer_re[i], max_total_ir_len );
#else
                set_zero( hCrend->freq_buffer_re[i], max_total_ir_len );
#endif
@@ -1316,10 +1313,7 @@ ivas_error ivas_rend_openCrend(
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                for ( j = 0; j < max_total_ir_len; j++ )
                {
                    hCrend->freq_buffer_im[i][j] = 0.f;
                }
                set_zero_l( hCrend->freq_buffer_im[i], max_total_ir_len );
#else
                set_zero( hCrend->freq_buffer_im[i], max_total_ir_len );
#endif
@@ -1332,10 +1326,7 @@ ivas_error ivas_rend_openCrend(
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                for ( j = 0; j < subframe_length; j++ )
                {
                    hCrend->prev_out_buffer[i][j] = 0.f;
                }
                set_zero_l( hCrend->prev_out_buffer[i], subframe_length );
#else
                set_zero( hCrend->prev_out_buffer[i], subframe_length );
#endif
@@ -1352,10 +1343,7 @@ ivas_error ivas_rend_openCrend(
#ifdef FIX_CRASH_LONG_BRIR
                if ( hCrend->freq_buffer_re_diffuse != NULL )
                {
                    for ( j = 0; j < max_total_ir_len; j++ )
                    {
                        hCrend->freq_buffer_re_diffuse[j] = 0.f;
                    }
                    set_zero_l( hCrend->freq_buffer_re_diffuse, max_total_ir_len );
                }
#else
                set_zero( hCrend->freq_buffer_re_diffuse, max_total_ir_len );
@@ -1368,10 +1356,7 @@ ivas_error ivas_rend_openCrend(
#ifdef FIX_CRASH_LONG_BRIR
                if ( hCrend->freq_buffer_im_diffuse != NULL )
                {
                    for ( j = 0; j < max_total_ir_len; j++ )
                    {
                        hCrend->freq_buffer_im_diffuse[j] = 0.f;
                    }
                    set_zero_l( hCrend->freq_buffer_im_diffuse, max_total_ir_len );
                }
#else
                set_zero( hCrend->freq_buffer_im_diffuse, max_total_ir_len );
@@ -1391,10 +1376,7 @@ ivas_error ivas_rend_openCrend(
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                for ( j = 0; j < max_total_ir_len; j++ )
                {
                    hCrend->lfe_delay_line[j] = 0.f;
                }
                set_zero_l( hCrend->lfe_delay_line, max_total_ir_len );
#else
                set_zero( hCrend->lfe_delay_line, max_total_ir_len );
#endif