Commit 44e0af3b authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Port MR1418 to main-pc

parent add4f598
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1286,7 +1286,11 @@ enum
#define MASA_RATIO_TOLERANCE                    0.1f
#define MASA_RATIO_THRESHOLD                    0.1f
#define MASA_ANGLE_TOLERANCE                    0.5f
#ifdef NONBE_FIX_1034_DRY_MASA_RATIOS
#define MASA_RATIO_THRESHOLD_FX                 322122547   // 0.15 in Q31
#else
#define MASA_RATIO_THRESHOLD_FX                 214748365   // 0.1 in Q31
#endif
#define MASA_RATIO_TOLERANCE_FX                 107374182   // 0.1 in Q30
#define MASA_ANGLE_TOLERANCE_FX                 ONE_IN_Q21  // 0.5 in Q22
#define MASA_LIMIT_NO_BANDS_SUR_COH             8
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@
#define FIX_1003_PARAMISM_BINAURAL_RECONFIG_USAN        /* FhG: fix for #1003: fix USAN caused by ParamISM reconfig                    */
#define FIX_1001_ARI_HM_OVERFLOW                        /* FhG: (no changes needed in BASOP) fix for undef behaviour in in the harmonic TCX model arithmetic coder */
#define NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE                  /* FhG: issue #1005: fix TC Buffer update at a MC rate switch */
#define NONBE_FIX_1034_DRY_MASA_RATIOS                  /* Nokia: Fix issue 1034, use of wrong numDir state. */

/* #################### End BASOP porting switches ############################ */

+22 −0
Original line number Diff line number Diff line
@@ -1857,6 +1857,9 @@ void ivas_masa_combine_directions_fx(
                hMeta->directional_meta[1].energy_ratio_fx[j][i] = 0;                                // Q30
                move16();
                move16();
#ifdef NONBE_FIX_1034_DRY_MASA_RATIOS
                hMeta->common_meta.diffuse_to_total_ratio_fx[j][i] = L_sub( ONE_IN_Q30, hMeta->directional_meta[0].energy_ratio_fx[j][i] ); // Q30
#endif

                IF( computeCoherence )
                {
@@ -2104,6 +2107,10 @@ static void detect_metadata_composition_fx(
            {
                FOR( band = 0; band < MASA_FREQUENCY_BANDS; band++ )
                {
#ifdef NONBE_FIX_1034_DRY_MASA_RATIOS
                    hMeta->directional_meta[0].spherical_index[sf][band] = hMeta->directional_meta[1].spherical_index[sf][band];
                    move16();
#endif
                    hMeta->directional_meta[0].azimuth_fx[sf][band] = hMeta->directional_meta[1].azimuth_fx[sf][band];                   /*q22*/
                    hMeta->directional_meta[0].elevation_fx[sf][band] = hMeta->directional_meta[1].elevation_fx[sf][band];               /*q22*/
                    hMeta->directional_meta[0].energy_ratio_fx[sf][band] = hMeta->directional_meta[1].energy_ratio_fx[sf][band];         /*q30*/
@@ -2228,7 +2235,12 @@ static void compensate_energy_ratios_fx(
    UWord8 numDirs;

    hMeta = &( hMasa->masaMetadata );
#ifdef NONBE_FIX_1034_DRY_MASA_RATIOS
    numDirs = hMasa->config.numberOfDirections;
    move16();
#else
    numDirs = (UWord8) add( hMeta->descriptive_meta.numberOfDirections, 1 );
#endif

    FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
    {
@@ -3137,10 +3149,20 @@ static void copy_masa_metadata_subframe_fx(
)
{
    UWord8 dir;
#ifdef NONBE_FIX_1034_DRY_MASA_RATIOS
    UWord8 band;
#endif

    /* directional metadata */
    FOR( dir = 0; dir < MASA_MAXIMUM_DIRECTIONS; dir++ )
    {
#ifdef NONBE_FIX_1034_DRY_MASA_RATIOS
        FOR ( band = 0; band < MASA_FREQUENCY_BANDS; band++ )
        {
            hMetaTo->directional_meta[dir].spherical_index[sfTo][band] = hMetaFrom->directional_meta[dir].spherical_index[sfFrom][band];
            move16();
        }
#endif
        Copy32( hMetaFrom->directional_meta[dir].azimuth_fx[sfFrom], hMetaTo->directional_meta[dir].azimuth_fx[sfTo], MASA_FREQUENCY_BANDS );                 // Q22
        Copy32( hMetaFrom->directional_meta[dir].elevation_fx[sfFrom], hMetaTo->directional_meta[dir].elevation_fx[sfTo], MASA_FREQUENCY_BANDS );             // Q22
        Copy32( hMetaFrom->directional_meta[dir].energy_ratio_fx[sfFrom], hMetaTo->directional_meta[dir].energy_ratio_fx[sfTo], MASA_FREQUENCY_BANDS );       // Q30