Commit ea15f288 authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into...

- Merge remote-tracking branch 'remotes/origin/main' into basop-2347-remove-various-duplicated-code-in-core-decoder
parents 06866c1f f4115b1a
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -111,6 +111,10 @@
#define FIX_BASOP_2324_MISSING_SET_TO_ZERO              /* Nokia: basop issue 2324: Fix issue by setting the exponent to zero where it should be */
#define FIX_BASOP_2326_WRONG_SIG_LENGTH                 /* Nokia: basop issue 2326: Fix issue by using correct signal length in multiple places */
#define FIX_BASOP_2327_WRONG_LOOP_END                   /* Nokia: basop inssue 2327: Correct loop end to solve MSAN error */
#define FIX_BASOP_2328_MSAN_WRONG_ASSIGNMENT            /* Nokia: basop issue 2328: Fix MSAN error by correcting the variable assignment */
#define FIX_BASOP_2329_UNINIT_VALUE                     /* Nokia: basop issue 2329: Fix issue by checking for structure instead of length */
#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  */

/* #################### End BE switches ################################## */
+4 −0
Original line number Diff line number Diff line
@@ -211,7 +211,11 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx(
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) );
        }
#ifdef FIX_BASOP_2328_MSAN_WRONG_ASSIGNMENT
        dirac_output_synthesis_state->cy_auto_diff_smooth_prev_len = imult1616( dirac_output_synthesis_params->max_band_decorr, hDirACRend->num_outputs_diff );
#else
        dirac_output_synthesis_state->cy_auto_dir_smooth_prev_len = imult1616( dirac_output_synthesis_params->max_band_decorr, hDirACRend->num_outputs_diff );
#endif
        move16();
    }
    ELSE
+5 −0
Original line number Diff line number Diff line
@@ -856,6 +856,11 @@ ivas_error ivas_dirac_alloc_mem_fx(
    /* Prototypes */
    hDirAC_mem->proto_direct_buffer_f_fx = NULL;
    hDirAC_mem->proto_diffuse_buffer_f_fx = NULL;
#ifdef FIX_BASOP_2329_UNINIT_VALUE
    hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len = 0;
    hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len = 0;
    hDirAC_mem->proto_diffuse_buffer_f_len = 0;
#endif
    test();
    test();
    IF( NE_32( renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_32( renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) && NE_32( renderer_type, RENDERER_STEREO_PARAMETRIC ) )
+14 −3
Original line number Diff line number Diff line
@@ -423,14 +423,25 @@ void ivas_mcmasa_ana_close(
            ( *hMcMasa )->direction_vector_m_fx[i][j] = NULL;
        }

        free( ( *hMcMasa )->direction_vector_m_fx[i] );
        ( *hMcMasa )->direction_vector_m_fx[i] = NULL;
#ifdef FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK

        FOR( j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ )
        {
            free( ( *hMcMasa )->direction_vector_e[i][j] );
            ( *hMcMasa )->direction_vector_e[i][j] = NULL;
        }

        free( ( *hMcMasa )->direction_vector_e[i] );
        ( *hMcMasa )->direction_vector_e[i] = NULL;
#endif

        FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ )
        {
            free( ( *hMcMasa )->buffer_intensity_real_fx[i][j] );
            ( *hMcMasa )->buffer_intensity_real_fx[i][j] = NULL;
        }

        free( ( *hMcMasa )->direction_vector_m_fx[i] );
        ( *hMcMasa )->direction_vector_m_fx[i] = NULL;
    }

    FOR( j = 0; j < DIRAC_NO_COL_AVG_DIFF; j++ )
+18 −1
Original line number Diff line number Diff line
@@ -11153,12 +11153,17 @@ static void intermidiate_ext_dirac_render(

        IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx )
        {
#ifdef FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND
            Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len );
#else
            Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, imult1616( hDirACRend->num_outputs_dir, hSpatParamRendCom->num_freq_bands ) );
#endif
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len, shift ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth + shift) */
            hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, shift );
            move16();
        }

#ifndef FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND
        Word16 num_channels_dir = hDirACRend->num_outputs_dir;
        move16();

@@ -11167,10 +11172,14 @@ static void intermidiate_ext_dirac_render(
            num_channels_dir = hDirACRend->hOutSetup.nchan_out_woLFE;
            move16();
        }

#endif
        IF( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx )
        {
#ifdef FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND
            tmp = L_norm_arr( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len );
#else
            tmp = L_norm_arr( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, imult1616( num_channels_dir, hSpatParamRendCom->num_freq_bands ) );
#endif
            scale_sig32( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len, tmp ); /* Q(h_dirac_output_synthesis_state->q_cy_auto_diff_smooth + tmp) */
            h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = add( h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, tmp );
            move16();
@@ -11192,7 +11201,11 @@ static void intermidiate_ext_dirac_render(
        move16();
        IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx )
        {
#ifdef FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND
            Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len );
#else
            Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, imult1616( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_dir ) );
#endif
            scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len, shift ); /* Q(hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev + shift) */
            hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, shift );
            move16();
@@ -11206,7 +11219,11 @@ static void intermidiate_ext_dirac_render(
            move16();
        }

#ifdef FIX_BASOP_2329_UNINIT_VALUE
        IF( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx )
#else
        IF( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len > 0 )
#endif
        {
            Word16 shift, norm1, norm2;
            Word32 tmp1, tmp2;