Commit 2ae1d602 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Fixes issue 1344.

parent ab5ed9bb
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@
#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ 
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define NONBE_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0  */
#define NONBE_1344_REND_MASA_LOW_FS                     /* Nokia: Issue 1344: Fix sanitizer errors when using IVAS_rend to render MASA with lower sampling rates */


/* ##################### End NON-BE switches ########################### */
+8 −0
Original line number Diff line number Diff line
@@ -235,6 +235,14 @@ void ivas_dirac_ana(
    /* Estimate MASA parameters from the SBA signals */
    ivas_dirac_param_est_ana( hDirAC, data_in_f, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame );

#ifdef NONBE_1344_REND_MASA_LOW_FS
    /* Add zeros to higher bands in case of lower sampling rates */
    if ( hDirAC->nbands < MASA_FREQUENCY_BANDS )
    {
        ivas_masa_zero_high_bands( hDirAC->nbands, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence );
    }
#endif

    /* Create MASA metadata buffer from the estimated values */
    ivas_create_masa_out_meta( hDirAC->hMasaOut, hDirAC->sph_grid16, nchan_transport, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence );

+23 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@
#include "ivas_prot.h"
#include "ivas_cnst.h"
#include "prot.h"
#ifdef NONBE_1344_REND_MASA_LOW_FS
#include "ivas_rom_com.h"
#endif
#include "wmc_auto.h"


@@ -326,6 +329,9 @@ ivas_error masaPrerendOpen(
{
    MASA_PREREND_HANDLE hMasaPrerend;
    int16_t i;
#ifdef NONBE_1344_REND_MASA_LOW_FS
    int16_t maxBin;
#endif
    ivas_error error;

    error = IVAS_ERR_OK;
@@ -336,6 +342,23 @@ ivas_error masaPrerendOpen(
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA prerenderer\n" ) );
    }

#ifdef NONBE_1344_REND_MASA_LOW_FS
    /* Determine the number of bands and band grouping */
    hMasaPrerend->nbands = MASA_FREQUENCY_BANDS;
    mvs2s( MASA_band_grouping_24, hMasaPrerend->band_grouping, 24 + 1 );

    maxBin = (int16_t) ( input_Fs * INV_CLDFB_BANDWIDTH + 0.5f );
    for ( i = 1; i < hMasaPrerend->nbands + 1; i++ )
    {
        if ( hMasaPrerend->band_grouping[i] >= maxBin )
        {
            hMasaPrerend->band_grouping[i] = maxBin;
            hMasaPrerend->nbands = i;
            break;
        }
    }
#endif

    hMasaPrerend->num_Cldfb_instances = numTransports;
    for ( i = 0; i < hMasaPrerend->num_Cldfb_instances; i++ )
    {
+43 −0
Original line number Diff line number Diff line
@@ -393,6 +393,14 @@ void ivas_mcmasa_ana(
    /* Analysis */
    ivas_mcmasa_param_est_ana( hMcMasa, data_f, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame, nchan_inp );

#ifdef NONBE_1344_REND_MASA_LOW_FS
    /* Add zeros to higher bands in case of lower sampling rates */
    if ( hMcMasa->nbands < MASA_FREQUENCY_BANDS )
    {
        ivas_masa_zero_high_bands( hMcMasa->nbands, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence );
    }
#endif

    /* Create MASA metadata buffer from the estimated values */
    ivas_create_masa_out_meta( hMcMasa->hMasaOut, hMcMasa->sph_grid16, nchan_transport, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence );

@@ -1131,3 +1139,38 @@ void ivas_create_masa_out_meta(

    return;
}


#ifdef NONBE_1344_REND_MASA_LOW_FS
/*-------------------------------------------------------------------------
 * ivas_masa_zero_high_bands()
 *
 *
 *------------------------------------------------------------------------*/

void ivas_masa_zero_high_bands(
    const int16_t nbands,                                                         /* i    : Number of frequency bands with estimated values */
    float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],  /* i/o  : Estimated elevation                             */
    float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],    /* i/o  : Estimated azimuth                               */
    float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],         /* i/o  : Estimated direct-to-total ratio                 */
    float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],     /* i/o  : Estimated spread coherence                      */
    float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i/o  : Estimated surround coherence                    */
)
{
    int16_t sf, band;

    for (sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++)
    {
        for ( band = nbands; band < MASA_FREQUENCY_BANDS; band++ )
        {
            elevation_m_values[sf][band] = 0.0f;
            azimuth_m_values[sf][band] = 0.0f;
            energyRatio[sf][band] = 0.0f;
            spreadCoherence[sf][band] = 0.0f;
            surroundingCoherence[sf][band] = 0.0f;
        }
    }

    return;
}
#endif
+8 −0
Original line number Diff line number Diff line
@@ -261,6 +261,14 @@ void ivas_omasa_ana(
    /* Estimate MASA parameters from the objects */
    ivas_omasa_param_est_ana( hOMasa, data_in_f, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame, nchan_ism );

#ifdef NONBE_1344_REND_MASA_LOW_FS
    /* Add zeros to higher bands in case of lower sampling rates */
    if ( hOMasa->nbands < MASA_FREQUENCY_BANDS )
    {
        ivas_masa_zero_high_bands( hOMasa->nbands, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence );
    }
#endif

    /* Create MASA metadata buffer from the estimated values */
    ivas_create_masa_out_meta( hOMasa->hMasaOut, hOMasa->sph_grid16, nchan_transport, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence );

Loading