Commit 4fe53b30 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge branch '2137_ref_port_mr_1822_omasa_rateswitch_invalid_data' into 'ivas-float-update'

[NON-BE] Port 251 - MR 1822 to ivas-float-update

See merge request !2423
parents e96061e8 b7054fa8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@
#define FIX_NCHAN_BUFFERS                               /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */
#define FIX_RENDERER_STACK                              /* VA: issue 1322: reduction of renderers' buffers size */
#define FIX_1370_EXTERNAL_ORIENTATION_CHECK             /* Nokia: add sanity check for Euler angles for external orientations */
#define NONBE_FIX_1197_OMASA_META_BUFFER                /* Nokia: OMASA ISM_MASA_MODE_PARAM_ONE_OBJ history zero in rateswitching - port 251 */

// object-editing feature porting
#define FIX_HRTF_LOAD_API                               // solves API conflicts between HRTF and object-editing features
+18 −0
Original line number Diff line number Diff line
@@ -334,6 +334,24 @@ ivas_error ivas_omasa_dec_config(
            ivas_omasa_separate_object_renderer_close( st_ivas );
        }

#ifdef NONBE_FIX_1197_OMASA_META_BUFFER
        if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ && st_ivas->hMasaIsmData != NULL ) /* this structure is in use only in ISM_MASA_MODE_PARAM_ONE_OBJ */
        {
            MASA_ISM_DATA_HANDLE hMasaIsmData = st_ivas->hMasaIsmData;
            for ( int16_t obj_idx = 0; obj_idx < MAX_NUM_OBJECTS; obj_idx++ )
            {
                set_s( hMasaIsmData->azimuth_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
                set_s( hMasaIsmData->elevation_ism[obj_idx], 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
                for ( int16_t sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; sf++ )
                {
                    set_zero( hMasaIsmData->energy_ratio_ism[obj_idx][sf], CLDFB_NO_CHANNELS_MAX );
                }
            }
            set_s( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
            set_s( hMasaIsmData->elevation_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
        }
#endif

        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC )
        {
            if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC )
+10 −1
Original line number Diff line number Diff line
@@ -3130,16 +3130,25 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects(
                ratioAccNew += ratio;
            }

            /* Todo: Remove this comment with port 408 which would bring this back.
             *       No sense to break the code with port 251. */
            /* Limit target energies to non-negative values */
            for ( ch = 0; ch < 2; ch++ )
            {
                totalTargetEneCh[ch] = max( totalTargetEneCh[ch], 0.0f );
            }

            /* Diffuse ratio accumulation based on gaining */
#ifdef NONBE_FIX_1197_OMASA_META_BUFFER
            /* due to rounding, the sum may exceed 1.0f ever so slightly, so clip it */
            ratioAccOrig = min( ratioAccOrig, 1.0f );
#endif
            if ( masaGainEdited )
            {
#ifdef NONBE_FIX_1197_OMASA_META_BUFFER
                ratioAccNew += gainMasaPow2 * ( 1.0f - ratioAccOrig );
#else
                ratioAccNew += gainMasaPow2 * ( 1 - ratioAccOrig );
#endif
            }
            else
            {