Commit ed8d7567 authored by sagnowski's avatar sagnowski
Browse files

Fix msan issues

parent ccd8dbb8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3605,6 +3605,9 @@ void ivas_dirac_dec(
    Decoder_Struct *st_ivas,       /* i/o: IVAS decoder structure                                  */
    float output_f[][L_FRAME48k],  /* i/o: synthesized core-coder transport channels/DirAC output  */
    const int16_t nchan_transport  /* i  : number of transport channels                            */
#ifdef LIB_REND_API_5MS
    ,const int16_t num_subframes   /* i  : number of subframes to render */
#endif
);

void ivas_dirac_dec_render(
+8 −0
Original line number Diff line number Diff line
@@ -2205,6 +2205,10 @@ void ivas_dirac_dec(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder structure                                  */
    float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output  */
    const int16_t nchan_transport /* i  : number of transport channels                            */
#ifdef LIB_REND_API_5MS
    ,
    const int16_t num_subframes /* i  : number of subframes to render */
#endif
)
{
    int16_t subframe_idx;
@@ -2234,7 +2238,11 @@ void ivas_dirac_dec(

    ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS );

#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
    {
        ivas_dirac_dec_render_sf( st_ivas, output_f_local, nchan_transport, NULL, NULL );
        for ( n = 0; n < nchan_out; n++ )
+7 −0
Original line number Diff line number Diff line
@@ -423,6 +423,9 @@ void ivas_dirac_dec_binaural(
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i  : combined orientation handle     */
    float output_f[][L_FRAME48k],                         /* i/o: synthesized core-coder transport channels/DirAC output  */
    const int16_t nchan_transport                         /* i  : number of transport channels                            */
#ifdef LIB_REND_API_5MS
    ,const int16_t num_subframes                                /* i  : number of subframes to render */
#endif
)
{
    int16_t subframe;
@@ -475,7 +478,11 @@ void ivas_dirac_dec_binaural(
        generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[nchan_transport], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna );
    }

#ifdef LIB_REND_API_5MS
    for ( subframe = 0; subframe < num_subframes; subframe++ )
#else
    for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ )
#endif
    {
        int16_t n_samples_sf = slot_size * st_ivas->hDirAC->subframe_nbslots[subframe];

+3 −0
Original line number Diff line number Diff line
@@ -154,6 +154,9 @@ void ivas_dirac_dec_binaural(
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,       /* i  : combined orientation handle                             */
    float output_f[][L_FRAME48k],                               /* i/o: synthesized core-coder transport channels/DirAC output  */
    const int16_t nchan_transport                               /* i  : number of transport channels                            */
#ifdef LIB_REND_API_5MS
    ,const int16_t num_subframes                                /* i  : number of subframes to render */
#endif
);

void ivas_dirac_dec_binaural_render(
+46 −16
Original line number Diff line number Diff line
@@ -4925,6 +4925,16 @@ static ivas_error renderIsmToBinaural(
    return IVAS_ERR_OK;
}

#ifdef LIB_REND_API_5MS
static int16_t num_subframes_in_buffer( const IVAS_REND_AudioBuffer *buffer, int32_t sampleRate )
{
#ifdef DEBUGGING
    assert( buffer->config.numSamplesPerChannel % (sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES) == 0 );
#endif
    return buffer->config.numSamplesPerChannel / (sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES);
}
#endif

static ivas_error renderIsmToBinauralRoom(
    input_ism *ismInput,
    IVAS_REND_AudioBuffer outAudio )
@@ -5081,7 +5091,7 @@ static ivas_error renderIsmToBinauralRoom(
                                           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
                                           num_subframes_in_buffer( &outAudio, *ismInput->base.ctx.pOutSampleRate )
#endif
                                               ) ) != IVAS_ERR_OK )
    {
@@ -5501,7 +5511,7 @@ static ivas_error renderMcToBinaural(
                                               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
                                               num_subframes_in_buffer( &outAudio, *mcInput->base.ctx.pOutSampleRate )
#endif
                                                   ) ) != IVAS_ERR_OK )
        {
@@ -5619,7 +5629,7 @@ static ivas_error renderMcToBinauralRoom(
                                               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
                                               num_subframes_in_buffer( &outAudio, *mcInput->base.ctx.pOutSampleRate )
#endif
                                                   ) ) != IVAS_ERR_OK )
        {
@@ -5734,7 +5744,7 @@ static ivas_error renderMcCustomLsToBinauralRoom(
                                           p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate
#ifdef LIB_REND_API_5MS
                                           ,
                                           *mcInput->base.ctx.pOutSampleRate / FRAMES_PER_SEC / outAudio.config.numSamplesPerChannel
                                           num_subframes_in_buffer( &outAudio, *mcInput->base.ctx.pOutSampleRate )
#endif
                                               ) ) != IVAS_ERR_OK )
    {
@@ -6023,7 +6033,7 @@ static ivas_error renderSbaToBinaural(
                                           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
                                           num_subframes_in_buffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate )
#endif
                                               ) ) != IVAS_ERR_OK )
    {
@@ -6129,7 +6139,7 @@ static ivas_error renderSbaToBinauralRoom(
                                           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
                                           num_subframes_in_buffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate )
#endif
                                               ) ) != IVAS_ERR_OK )
    {
@@ -6300,11 +6310,21 @@ static void renderMasaToMc(

    if ( masaInput->decDummy->renderer_type == RENDERER_STEREO_PARAMETRIC )
    {
        ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels );
        ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels
#ifdef LIB_REND_API_5MS
                                 ,
                                 num_subframes_in_buffer( &outAudio, *masaInput->base.ctx.pOutSampleRate )
#endif
        );
    }
    else
    {
        ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels );
        ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels 
#ifdef LIB_REND_API_5MS
                                 ,
                                 num_subframes_in_buffer( &outAudio, *masaInput->base.ctx.pOutSampleRate )
#endif
        );
    }

    accumulate2dArrayToBuffer( tmpBuffer, &outAudio );
@@ -6321,7 +6341,12 @@ static void renderMasaToSba(
    copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer );
    copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC );

    ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels );
    ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels
#ifdef LIB_REND_API_5MS
                                 ,
                                 num_subframes_in_buffer( &outAudio, *masaInput->base.ctx.pOutSampleRate )
#endif
    );

    accumulate2dArrayToBuffer( tmpBuffer, &outAudio );

@@ -6337,7 +6362,12 @@ static void renderMasaToBinaural(
    copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer );
    copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC );

    ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels );
    ivas_dirac_dec_binaural( masaInput->decDummy, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, masaInput->base.inputBuffer.config.numChannels
#ifdef LIB_REND_API_5MS
                             ,
                             num_subframes_in_buffer( &outAudio, *masaInput->base.ctx.pOutSampleRate )
#endif
    );

    accumulate2dArrayToBuffer( tmpBuffer, &outAudio );