Commit d4e05338 authored by emerit's avatar emerit
Browse files

Merge branch '744_step1_scripts_and_brir_fix' into 'main'

#744 step 1: binaural table generation scripts + FIX_CRASH_LONG_BRIR

See merge request !1202
parents 48a94d94 bfb7a8fe
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2920,6 +2920,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,         /* i/o: input/output 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                                                         */
+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define SPLIT_REND_WITH_HEAD_ROT  */                  /* Dlb,FhG: Split Rendering contributions 21 and 35 */

#define FIX_CRASH_LONG_BRIR                             /* Orange : Fix crash when long BRIR is set */
#define FIX_SPLITREND_WARNINGS                          /* FhG: fix warnings related to split rendering observed in build jobs */
#define FIX_923_EXTERNAL_REND_COMMAND_LINE              /* VA: issue 923: enable external renderer command-line options in UPPER case letters */
#define FIX_921_OMASA_DELAY_PRINTOUT                    /* VA: issue 921: correct OMASA decoder delay printout */
+33 −1
Original line number Diff line number Diff line
@@ -1248,7 +1248,11 @@ ivas_error ivas_rend_openCrend(
)
{
    int16_t i, subframe_length;
#ifdef FIX_CRASH_LONG_BRIR
    int32_t max_total_ir_len;
#else
    int16_t max_total_ir_len;
#endif
    HRTFS_HANDLE hHrtf;
    CREND_HANDLE hCrend;
    ivas_error error;
@@ -1298,13 +1302,21 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                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

                if ( ( hCrend->freq_buffer_im[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                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
            }

            for ( i = 0; i < BINAURAL_CHANNELS; i++ )
@@ -1313,7 +1325,11 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                set_zero_l( hCrend->prev_out_buffer[i], subframe_length );
#else
                set_zero( hCrend->prev_out_buffer[i], subframe_length );
#endif
            }

            max_total_ir_len = hHrtf->num_iterations_diffuse[0] * subframe_length;
@@ -1324,13 +1340,21 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                set_zero_l( hCrend->freq_buffer_re_diffuse, max_total_ir_len );
#else
                set_zero( hCrend->freq_buffer_re_diffuse, max_total_ir_len );
#endif

                if ( ( hCrend->freq_buffer_im_diffuse = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                set_zero_l( hCrend->freq_buffer_im_diffuse, max_total_ir_len );
#else
                set_zero( hCrend->freq_buffer_im_diffuse, max_total_ir_len );
#endif
            }
            else
            {
@@ -1345,7 +1369,11 @@ ivas_error ivas_rend_openCrend(
                {
                    return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
                }
#ifdef FIX_CRASH_LONG_BRIR
                set_zero_l( hCrend->lfe_delay_line, max_total_ir_len );
#else
                set_zero( hCrend->lfe_delay_line, max_total_ir_len );
#endif
            }
            else
            {
@@ -1541,7 +1569,7 @@ void ivas_rend_closeCrend(

#ifdef SPLIT_REND_WITH_HEAD_ROT
/*-------------------------------------------------------------------------
 * ivas_rend_openCldfbRend()
 * ivas_rend_closeCldfbRend()
 *
 * Close CLDFB based fastconv binaural renderer memories
 *------------------------------------------------------------------------*/
@@ -1588,7 +1616,11 @@ static ivas_error ivas_rend_crendConvolver(
    int16_t i, j, k, m;
    int16_t subframe_length, idx_in;
    int16_t lfe_idx_in;
#ifdef FIX_CRASH_LONG_BRIR
    int32_t offset, offset_in, offset_diffuse;
#else
    int16_t offset, offset_in, offset_diffuse;
#endif
    int16_t nchan_in, nchan_out;
    const float *pIn;
    float *pFreq_buf_re, *pFreq_buf_im;
+0 −1
Original line number Diff line number Diff line
@@ -4747,7 +4747,6 @@ ivas_error IVAS_REND_DisableHeadRotation(
            {
                if ( ( error = initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, TRUE ) ) != IVAS_ERR_OK )
                {

                    return error;
                }
            }
Loading