Commit c9d35820 authored by sagnowski's avatar sagnowski
Browse files

Try to fix MSVC's false-positive warning and WMC tool causing build problems

parent ecc59099
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -6357,18 +6357,24 @@ static ivas_error renderActiveInputsIsm(
    input_ism *pCurrentInput;
    ivas_error error;
#ifdef FIX_BASOP_2436_REUSED_CLDFB_IN_OMASA_SR
    IVAS_REND_AudioBuffer tmp_td_audio_buf;
    float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS * L_FRAME48k];

    // ISM renderering only supports TD output. If CLDFB output was requested, we first render
    // to TD in a tmp buffer and then convert to CLDFB.
    IVAS_REND_AudioBuffer work_buffer;
    float tmp_td_binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS * L_FRAME48k];

    // By default (TD output), use outAudio as work_buffer. This means we render individual ISMs
    // directly to outAudio, since the `data` member of both these structs is pointing to the same memory.
    // Initializing this way also fixes MSVC's false-positive warning about work_buffer being used
    // without initialization in code below, as well as some WMC tool instrumentation problems.
    work_buffer = outAudio;

    // ISM rendering only supports TD output. If CLDFB output was requested, we first render
    // to TD in a temporary buffer and then convert to CLDFB. We do this by swapping out the
    // underlying memory of work_buffer and modifying its config to TD.
    if ( outAudio.config.is_cldfb )
    {
        tmp_td_audio_buf.config = outAudio.config;
        tmp_td_audio_buf.config.numSamplesPerChannel /= 2;
        tmp_td_audio_buf.config.is_cldfb = false;
        tmp_td_audio_buf.data = tmpBinaural;
        set_zero( tmpBinaural, MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS * L_FRAME48k );
        work_buffer.config.numSamplesPerChannel /= 2;
        work_buffer.config.is_cldfb = false;
        work_buffer.data = tmp_td_binaural;
        set_zero( tmp_td_binaural, MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS * L_FRAME48k );
    }
#endif

@@ -6383,7 +6389,7 @@ static ivas_error renderActiveInputsIsm(
#ifdef FIX_BASOP_2436_REUSED_CLDFB_IN_OMASA_SR
        if ( ( error = renderInputIsm( pCurrentInput,
                                       hIvasRend->outputConfig,
                                       outAudio.config.is_cldfb ? tmp_td_audio_buf : outAudio ) ) != IVAS_ERR_OK )
                                       work_buffer ) ) != IVAS_ERR_OK )
#else
        if ( ( error = renderInputIsm( pCurrentInput, hIvasRend->outputConfig, outAudio ) ) != IVAS_ERR_OK )
#endif
@@ -6395,7 +6401,7 @@ static ivas_error renderActiveInputsIsm(
#ifdef FIX_BASOP_2436_REUSED_CLDFB_IN_OMASA_SR
    if ( outAudio.config.is_cldfb )
    {
        audio_buffer_td_to_cldfb( tmp_td_audio_buf,
        audio_buffer_td_to_cldfb( work_buffer,
                                  outAudio,
                                  hIvasRend->sampleRateOut,
                                  hIvasRend->splitRendWrapper->hCldfbHandles->cldfbAna );