Commit ccd8dbb8 authored by sagnowski's avatar sagnowski
Browse files

Fix msan issue in crend

parent 03cc1fe5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@
#define FIX_XXX_ISM_SBA_ASAN
#define API_5MS
#define LIB_REND_API_5MS                            /* FhG: Adds 5ms framing capability to lib_rend */
#define SGI_DBG

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
+19 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@
#include "options.h"
#include <stdio.h>
#include <stdint.h>
#ifdef SGI_DBG
#include <assert.h>
#endif
#ifdef DEBUG_SBA
#include "sba_debug.h"
#endif
@@ -97,6 +100,22 @@ int16_t dbgwrite(
    const char *const filename
#endif
);
#ifdef SGI_DBG
inline static void sgi_dbgwrite(
    const float *const buffer,
    const int16_t count,
    const char *const filename )
{
    float tmp[960];

    for ( int i = 0; i < count; ++i )
    {
        tmp[i] = buffer[i] / INT16_MAX;
    }

    dbgwrite( tmp, sizeof( float ), count, 1, filename );
}
#endif

void dbgwrite_mat_repeat(
    float *buffer,      /* i  : write buffer */
+22 −1
Original line number Diff line number Diff line
@@ -1332,9 +1332,18 @@ ivas_error ivas_rend_crendProcess(
    IVAS_OUTPUT_SETUP_HANDLE hIntSetup,
    EFAP_HANDLE hEFAPdata,
    float *output[], /* i/o: input/output audio channels     */
    const int32_t output_Fs )
    const int32_t output_Fs
#ifdef LIB_REND_API_5MS
    ,
    const int16_t num_subframes /* i  : number of subframes to render */
#endif
)
{
#ifdef LIB_REND_API_5MS
    int16_t i, subframe_idx, subframe_len;
#else
    int16_t i, subframe_idx, output_frame, subframe_len;
#endif
    int16_t nchan_out;
    float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k];
    float *p_pcm_tmp[BINAURAL_CHANNELS];
@@ -1379,15 +1388,23 @@ ivas_error ivas_rend_crendProcess(
        return error;
    }

#ifdef LIB_REND_API_5MS
    subframe_len = (int16_t) output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES;
#else
    output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC );
    subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES;
#endif

    for ( i = 0; i < BINAURAL_CHANNELS; i++ )
    {
        p_pcm_tmp[i] = pcm_tmp[i];
    }

#ifdef LIB_REND_API_5MS
    for ( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ )
#else
    for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ )
#endif
    {
        if ( hDecoderConfig && combinedOrientationEnabled )
        {
@@ -1432,7 +1449,11 @@ ivas_error ivas_rend_crendProcess(
    /* move to output */
    for ( i = 0; i < nchan_out; i++ )
    {
#ifdef LIB_REND_API_5MS
        mvr2r( pcm_tmp[i], output[i], num_subframes * subframe_len );
#else
        mvr2r( pcm_tmp[i], output[i], output_frame );
#endif
    }

    pop_wmops();
+3 −0
Original line number Diff line number Diff line
@@ -509,6 +509,9 @@ ivas_error ivas_rend_crendProcess(
    EFAP_HANDLE hEFAPdata,
    float *output[],                                            /* i/o: input/output audio channels             */
    const int32_t output_Fs
#ifdef LIB_REND_API_5MS
    ,const int16_t num_subframes                                /* i  : number of subframes to render */
#endif
);

ivas_error ivas_rend_crendProcessSubframe(
+40 −6
Original line number Diff line number Diff line
@@ -5078,7 +5078,12 @@ static ivas_error renderIsmToBinauralRoom(
    copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer );

    if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR,
                                           NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
                                           NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                           ,
                                           *ismInput->base.ctx.pOutSampleRate / FRAMES_PER_SEC / outAudio.config.numSamplesPerChannel
#endif
                                           ) ) != IVAS_ERR_OK )
    {
        return error;
    }
@@ -5493,10 +5498,19 @@ static ivas_error renderMcToBinaural(

        /* call CREND */
        if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                               NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
                                               NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                               ,
                                               *mcInput->base.ctx.pOutSampleRate / FRAMES_PER_SEC / outAudio.config.numSamplesPerChannel
#endif
                                               ) ) != IVAS_ERR_OK )
        {
            return error;
        }

#ifdef SGI_DBG
        sgi_dbgwrite( p_tmpRendBuffer[0], outAudio.config.numSamplesPerChannel, "res/p_tmpRendBuffer.pcm" );
#endif
    }

    accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio );
@@ -5602,7 +5616,12 @@ static ivas_error renderMcToBinauralRoom(

        /* call CREND */
        if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                               NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
                                               NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                               ,
                                               *mcInput->base.ctx.pOutSampleRate / FRAMES_PER_SEC / outAudio.config.numSamplesPerChannel
#endif
                                               ) ) != IVAS_ERR_OK )
        {
            return error;
        }
@@ -5712,7 +5731,12 @@ static ivas_error renderMcCustomLsToBinauralRoom(

    /* call CREND */
    if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL,
                                           p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
                                           p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                           ,
                                           *mcInput->base.ctx.pOutSampleRate / FRAMES_PER_SEC / outAudio.config.numSamplesPerChannel
#endif
                                           ) ) != IVAS_ERR_OK )
    {
        return error;
    }
@@ -5996,7 +6020,12 @@ static ivas_error renderSbaToBinaural(

    /* call CREND */
    if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                           NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
                                           NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                           ,
                                           *sbaInput->base.ctx.pOutSampleRate / FRAMES_PER_SEC / outAudio.config.numSamplesPerChannel
#endif
                                           ) ) != IVAS_ERR_OK )
    {
        return error;
    }
@@ -6097,7 +6126,12 @@ static ivas_error renderSbaToBinauralRoom(

    /* call CREND */
    if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ),
                                           NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
                                           NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                           ,
                                           *sbaInput->base.ctx.pOutSampleRate / FRAMES_PER_SEC / outAudio.config.numSamplesPerChannel
#endif
                                           ) ) != IVAS_ERR_OK )
    {
        return error;
    }