Commit 5354f2cb authored by multrus's avatar multrus
Browse files

Merge branch...

Merge branch 'basop-2351-follow-up-to-2326-scale_sig-potentially-used-on-unintialized-values-in-external-renderer' into 'main'

Resolve "Follow up to #2326; Scale_sig32 potentially used on unintialized values in external renderer"

Closes #2351

See merge request !2742
parents 3971ebf7 a66f31fb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@
#define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND  /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */
#define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK           /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */
#define HARM_COREDECODER_FUNCTIONS                      /* VA: basop issue 2347: Remove various duplicated code in core-decoder  */
#define FIX_BASOP_2351_EXTREND_SCALE                    /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */
#define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE           /* FhG: Fix issue 2331: Uninitialized variable */

/* #################### End BE switches ################################## */
+91 −3
Original line number Diff line number Diff line
@@ -6487,9 +6487,17 @@ static ivas_error renderIsmToBinaural(
    ism_md_subframe_update_ext = extract_l( Mpy_32_32( ismInput->ism_metadata_delay_ms_fx, ONE_BY_SUBFRAME_LEN_MS_Q31 ) );
    copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpTDRendBuffer );

#ifdef FIX_BASOP_2351_EXTREND_SCALE
    FOR( i = 0; i < ismInput->base.inputBuffer.config.numChannels; ++i )
#else
    FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
    {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
        Scale_sig32( tmpTDRendBuffer[i], ismInput->base.inputBuffer.config.numSamplesPerChannel, sub( Q11, exp ) ); /* Q11 */
#else
        Scale_sig32( tmpTDRendBuffer[i], L_FRAME48k, sub( Q11, exp ) ); /* Q11 */
#endif
    }

    IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext,
@@ -6499,9 +6507,17 @@ static ivas_error renderIsmToBinaural(
        return error;
    }

#ifdef FIX_BASOP_2351_EXTREND_SCALE
    FOR( i = 0; i < outAudio.config.numChannels; ++i )
#else
    FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
    {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
        Scale_sig32( tmpTDRendBuffer[i], outAudio.config.numSamplesPerChannel, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#else
        Scale_sig32( tmpTDRendBuffer[i], L_FRAME48k, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#endif
    }

    IF( ismInput->hReverb != NULL )
@@ -6764,9 +6780,17 @@ static ivas_error renderIsmToBinauralReverb(
    ism_md_subframe_update_ext = extract_l( Mpy_32_32( ismInput->ism_metadata_delay_ms_fx, ONE_BY_SUBFRAME_LEN_MS_Q31 ) );
    copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpRendBuffer_fx );

#ifdef FIX_BASOP_2351_EXTREND_SCALE
    FOR( i = 0; i < ismInput->base.inputBuffer.config.numChannels; ++i )
#else
    FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
    {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
        Scale_sig32( tmpRendBuffer_fx[i], ismInput->base.inputBuffer.config.numSamplesPerChannel, sub( Q11, exp ) ); /* Q11 */
#else
        Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, sub( Q11, exp ) ); /* Q11 */
#endif
    }

    IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer_fx, &exp ) ), IVAS_ERR_OK ) )
@@ -6774,9 +6798,17 @@ static ivas_error renderIsmToBinauralReverb(
        return error;
    }

#ifdef FIX_BASOP_2351_EXTREND_SCALE
    FOR( i = 0; i < outAudio.config.numChannels; ++i )
#else
    FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
    {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
        Scale_sig32( tmpRendBuffer_fx[i], outAudio.config.numSamplesPerChannel, negate( sub( 11, exp ) ) ); /* Q(exp) */
#else
        Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, negate( sub( 11, exp ) ) ); /* Q(exp) */
#endif
    }

    IF( ismInput->hReverb != NULL )
@@ -7079,9 +7111,17 @@ static ivas_error renderIsmToSplitBinaural(
        }


#ifdef FIX_BASOP_2351_EXTREND_SCALE
        FOR( i = 0; i < ismInput->base.inputBuffer.config.numChannels; ++i )
#else
        FOR( i = 0; i < MAX_NUM_OBJECTS; ++i )
#endif
        {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
            Scale_sig32( tmpProcessing[i], ismInput->base.inputBuffer.config.numSamplesPerChannel, sub( Q11, exp ) ); /* Q11 */
#else
            Scale_sig32( tmpProcessing[i], L_FRAME48k, sub( Q11, exp ) );           /* Q11 */
#endif
        }

        /* Render */
@@ -7093,7 +7133,11 @@ static ivas_error renderIsmToSplitBinaural(

        FOR( i = 0; i < BINAURAL_CHANNELS; ++i )
        {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
            Scale_sig32( tmpProcessing[i], output_frame, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#else
            Scale_sig32( tmpProcessing[i], L_FRAME48k, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#endif
        }

        IF( ismInput->hReverb != NULL )
@@ -7496,9 +7540,17 @@ static ivas_error renderMcToBinaural(
    {
        copyBufferTo2dArray_fx( mcInput->base.inputBuffer, tmpRendBuffer_fx );

#ifdef FIX_BASOP_2351_EXTREND_SCALE
        FOR( i = 0; i < mcInput->base.inputBuffer.config.numChannels; ++i )
#else
        FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
        {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
            Scale_sig32( tmpRendBuffer_fx[i], mcInput->base.inputBuffer.config.numSamplesPerChannel, sub( Q11, exp ) ); /* Q11 */
#else
            Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, sub( Q11, exp ) ); /* Q11 */
#endif
        }
        IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb,
                                                               0, *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer_fx, &exp ) ),
@@ -7507,9 +7559,17 @@ static ivas_error renderMcToBinaural(
            return error;
        }

#ifdef FIX_BASOP_2351_EXTREND_SCALE
        FOR( i = 0; i < outAudio.config.numChannels; ++i )
#else
        FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
        {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
            Scale_sig32( tmpRendBuffer_fx[i], outAudio.config.numSamplesPerChannel, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#else
            Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#endif
        }
    }
    ELSE
@@ -7619,9 +7679,17 @@ static ivas_error renderMcToBinauralRoom(
    {
        copyBufferTo2dArray_fx( mcInput->base.inputBuffer, tmpRendBuffer );

#ifdef FIX_BASOP_2351_EXTREND_SCALE
        FOR( i = 0; i < mcInput->base.inputBuffer.config.numChannels; ++i )
#else
        FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
        {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
            Scale_sig32( tmpRendBuffer[i], mcInput->base.inputBuffer.config.numSamplesPerChannel, sub( Q11, exp ) ); /* Q11 */
#else
            Scale_sig32( tmpRendBuffer[i], L_FRAME48k, sub( Q11, exp ) ); /* Q11 */
#endif
        }

        IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb,
@@ -7631,9 +7699,17 @@ static ivas_error renderMcToBinauralRoom(
            return error;
        }

#ifdef FIX_BASOP_2351_EXTREND_SCALE
        FOR( i = 0; i < outAudio.config.numChannels; ++i )
#else
        FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
        {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
            Scale_sig32( tmpRendBuffer[i], outAudio.config.numSamplesPerChannel, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#else
            Scale_sig32( tmpRendBuffer[i], L_FRAME48k, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#endif
        }
    }
    ELSE
@@ -7976,9 +8052,17 @@ static ivas_error renderMcToSplitBinaural(
            /* perform rotation in source format to tmpRotBuffer */
            pCombinedOrientationDataLocal = &combinedOrientationDataLocal;

#ifdef FIX_BASOP_2351_EXTREND_SCALE
            FOR( i = 0; i < mcInput->base.inputBuffer.config.numChannels; ++i )
#else
            FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
#endif
            {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
                Scale_sig32( tmpRendBuffer[i], mcInput->base.inputBuffer.config.numSamplesPerChannel, sub( Q11, exp ) ); /* Q11 */
#else
                Scale_sig32( tmpRendBuffer[i], L_FRAME48k, sub( Q11, exp ) );               /* Q11 */
#endif
            }
            /* Render */
            IF( ( error = ivas_td_binaural_renderer_ext_fx( ( pos_idx == 0 ) ? &mcInput->tdRendWrapper : &mcInput->splitTdRendWrappers[pos_idx - 1], mcInput->base.inConfig, &mcInput->customLsInput, &pCombinedOrientationDataLocal, NULL, mcInput->hReverb, 0, /* Ism Audio Metadata Delay Sync in ms for External Renderer */ *mcInput->base.ctx.pOutSampleRate, mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer, &exp ) ) != IVAS_ERR_OK )
@@ -7987,7 +8071,11 @@ static ivas_error renderMcToSplitBinaural(
            }
            FOR( i = 0; i < BINAURAL_CHANNELS; ++i )
            {
#ifdef FIX_BASOP_2351_EXTREND_SCALE
                Scale_sig32( tmpRendBuffer[i], mcInput->base.inputBuffer.config.numSamplesPerChannel, negate( sub( Q11, exp ) ) ); /* Q(exp) */
#else
                Scale_sig32( tmpRendBuffer[i], L_FRAME48k, negate( sub( Q11, exp ) ) );     /* Q(exp) */
#endif
            }

            /* Copy rendered audio to tmp storage buffer. Copying directly to output would