Commit 57c1ed8d authored by vaclav's avatar vaclav
Browse files

port and activate other object-editing switches

parent 3c40b813
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -157,6 +157,9 @@ typedef struct
    AcousticEnvironmentSequence aeSequence;
    bool dpidEnabled;
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
#ifdef OBJ_EDITING_EXAMPLE
    bool objEditEnabled;
#endif

} DecArguments;

@@ -1163,6 +1166,9 @@ static bool parseCmdlIVAS_dec(
    {
        arg->directivityPatternId[i] = 65535;
    }
#ifdef OBJ_EDITING_EXAMPLE
    arg->objEditEnabled = false;
#endif

    /*-----------------------------------------------------------------*
     * Initialization
@@ -1676,6 +1682,13 @@ static bool parseCmdlIVAS_dec(

            i += tmp;
        }
#ifdef OBJ_EDITING_EXAMPLE
        else if ( strcmp( argv_to_upper, "-OBJ_EDIT" ) == 0 )
        {
            arg->objEditEnabled = true;
            i++;
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
+8 −1
Original line number Diff line number Diff line
@@ -193,13 +193,20 @@
#define ADJUST_MCT_CHANNELS_MAX                         /* FhG: set correct max mct channels constant*/
#define FIX_1053_REVERB_RECONFIGURATION

// objject-editing feature porting
#define OBJ_EDITING_INTERFACE                         /* Interface for object editing */
#ifdef OBJ_EDITING_INTERFACE
#define OBJ_EDITING_API                                /* object editing changes related to the API */
#ifdef OBJ_EDITING_API
#define FIX_HRTF_LOAD_API     // solves API conflicts between HRTF and object-editing features
#define TMP_FIX_SPLIT_REND    // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions)
#define TMP_FIX_OMASA_SR_BE   // temporary fix to keep OMASA split-rendering BE
//#define OMASA_OBJECT_EDITING  // not really verified
#endif
#define OBJ_EDITING_EXAMPLE                           /* obj editing example code in decoder.c */
#endif

#define OMASA_OBJECT_EDITING                           /* Nokia: object editing interface for OMASA */
#define OBJ_EDITING_PARAMISM_BIN                       /* Nokia: object editing for ParamISM to binaural */

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

+11 −0
Original line number Diff line number Diff line
@@ -1552,6 +1552,17 @@ ivas_error ivas_init_decoder(
        if ( st_ivas->ism_mode == ISM_MODE_PARAM )
        {
            st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2 = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed3;

#ifdef OBJ_EDITING_PARAMISM_BIN
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM )
            {
                /* reusing OMASA function for allocating and initializing MASA_ISM rendering handle (even though not in OMASA) */
                if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
#endif
        }
        else if ( st_ivas->ism_mode == ISM_MODE_DISC )
        {
+27 −0
Original line number Diff line number Diff line
@@ -189,6 +189,12 @@ static ivas_error ivas_ism_bitrate_switching_dec(
        {
            /* close the parametric binaural renderer */
            ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );

#ifdef OBJ_EDITING_PARAMISM_BIN
            /* Close omasa data struct (used for object editing) */
            ivas_omasa_data_close( &st_ivas->hMasaIsmData );
#endif

            /* Open the TD Binaural renderer */
            if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL )
            {
@@ -222,6 +228,11 @@ static ivas_error ivas_ism_bitrate_switching_dec(
            /* close the parametric binaural renderer */
            ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );

#ifdef OBJ_EDITING_PARAMISM_BIN
            /* Close omasa data struct (used for object editing) */
            ivas_omasa_data_close( &st_ivas->hMasaIsmData );
#endif

            /* Open Crend Binaural renderer */
#ifdef FIX_CREND_SIMPLIFY_CODE
            if ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
@@ -258,6 +269,14 @@ static ivas_error ivas_ism_bitrate_switching_dec(
                return error;
            }

#ifdef OBJ_EDITING_PARAMISM_BIN
            /* Open omasa data struct (used for object editing) */
            if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#endif

            /* Close the TD Binaural renderer */
            ivas_td_binaural_close( &st_ivas->hBinRendererTd );

@@ -285,6 +304,14 @@ static ivas_error ivas_ism_bitrate_switching_dec(
                return error;
            }

#ifdef OBJ_EDITING_PARAMISM_BIN
            /* Open omasa data struct (used for object editing) */
            if ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#endif

            /* close the crend binaural renderer */
#ifdef FIX_CREND_SIMPLIFY_CODE
            ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) );
+73 −1
Original line number Diff line number Diff line
@@ -1372,6 +1372,17 @@ void ivas_param_ism_dec_render(
        /* store MetaData parameters */
        for ( ch = 0; ch < st_ivas->nchan_ism; ch++ )
        {
#ifdef OBJ_EDITING_API
            if ( st_ivas->hParamIsmDec->azimuth_values[ch] > 180.0f )
            {
                st_ivas->hIsmMetaData[ch]->azimuth = st_ivas->hParamIsmDec->edited_azimuth_values[ch] - 360.0f;
            }
            else
            {
                st_ivas->hIsmMetaData[ch]->azimuth = st_ivas->hParamIsmDec->edited_azimuth_values[ch];
            }
            st_ivas->hIsmMetaData[ch]->elevation = st_ivas->hParamIsmDec->edited_elevation_values[ch];
#else
            if ( st_ivas->hParamIsmDec->azimuth_values[ch] > 180.0f )
            {
                st_ivas->hIsmMetaData[ch]->azimuth = st_ivas->hParamIsmDec->azimuth_values[ch] - 360.0f;
@@ -1382,6 +1393,7 @@ void ivas_param_ism_dec_render(
            }

            st_ivas->hIsmMetaData[ch]->elevation = st_ivas->hParamIsmDec->elevation_values[ch];
#endif
        }
    }

@@ -1409,12 +1421,23 @@ void ivas_param_ism_params_to_masa_param_mapping(
    int16_t azimuth[2];
    int16_t elevation[2];
    float power_ratio[2];
#ifdef OBJ_EDITING_PARAMISM_BIN
    MASA_ISM_DATA_HANDLE hMasaIsmData;
    int16_t obj;
    int16_t obj_idx;
#endif
#ifndef OBJ_EDITING_API
    int32_t ivas_total_brate;
#endif

    hParamIsmDec = st_ivas->hParamIsmDec;
    hSpatParamRendCom = st_ivas->hSpatParamRendCom;
#ifdef OBJ_EDITING_PARAMISM_BIN
    hMasaIsmData = st_ivas->hMasaIsmData;
#endif
    nBins = hSpatParamRendCom->num_freq_bands;

#ifndef OBJ_EDITING_API
    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;

    if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) )
@@ -1427,7 +1450,7 @@ void ivas_param_ism_params_to_masa_param_mapping(
    {
        st_ivas->hISMDTX.dtx_flag = 1;
    }

#endif
    if ( st_ivas->nchan_ism > 1 )
    {
        if ( st_ivas->hISMDTX.dtx_flag )
@@ -1461,12 +1484,22 @@ void ivas_param_ism_params_to_masa_param_mapping(
                brange[0] = hParamIsmDec->hParamIsm->band_grouping[band_idx];
                brange[1] = hParamIsmDec->hParamIsm->band_grouping[band_idx + 1];

#ifdef OBJ_EDITING_API
                azimuth[0] = (int16_t) roundf( hParamIsmDec->edited_azimuth_values[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][0]] );
                elevation[0] = (int16_t) roundf( hParamIsmDec->edited_elevation_values[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][0]] );
#else
                azimuth[0] = (int16_t) roundf( hParamIsmDec->azimuth_values[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][0]] );
                elevation[0] = (int16_t) roundf( hParamIsmDec->elevation_values[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][0]] );
#endif
                power_ratio[0] = hParamIsmDec->power_ratios[band_idx][0][0];

#ifdef OBJ_EDITING_API
                azimuth[1] = (int16_t) roundf( hParamIsmDec->edited_azimuth_values[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][1]] );
                elevation[1] = (int16_t) roundf( hParamIsmDec->edited_elevation_values[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][1]] );
#else
                azimuth[1] = (int16_t) roundf( hParamIsmDec->azimuth_values[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][1]] );
                elevation[1] = (int16_t) roundf( hParamIsmDec->elevation_values[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][1]] );
#endif
                power_ratio[1] = hParamIsmDec->power_ratios[band_idx][0][1];

                for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ )
@@ -1492,6 +1525,45 @@ void ivas_param_ism_params_to_masa_param_mapping(
                    hSpatParamRendCom->surroundingCoherence[sf_idx][bin_idx] = 0.0;
                }
            }

#ifdef OBJ_EDITING_PARAMISM_BIN
            for ( obj = 0; obj < st_ivas->nchan_ism; obj++ )
            {
                for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ )
                {
                    hMasaIsmData->azimuth_ism[obj][sf_idx] = (int16_t) roundf( hParamIsmDec->azimuth_values[obj] );
                    hMasaIsmData->elevation_ism[obj][sf_idx] = (int16_t) roundf( hParamIsmDec->elevation_values[obj] );
                }

                hMasaIsmData->azimuth_ism_edited[obj] = (int16_t) roundf( hParamIsmDec->edited_azimuth_values[obj] );
                hMasaIsmData->elevation_ism_edited[obj] = (int16_t) roundf( hParamIsmDec->edited_elevation_values[obj] );

                for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ )
                {
                    set_zero( hMasaIsmData->energy_ratio_ism[obj][sf_idx], CLDFB_NO_CHANNELS_MAX );
                }
            }

            for ( obj = 0; obj < MAX_PARAM_ISM_WAVE; obj++ )
            {
                for ( band_idx = 0; band_idx < hParamIsmDec->hParamIsm->nbands; band_idx++ )
                {
                    brange[0] = hParamIsmDec->hParamIsm->band_grouping[band_idx];
                    brange[1] = hParamIsmDec->hParamIsm->band_grouping[band_idx + 1];

                    obj_idx = hParamIsmDec->hParamIsm->obj_indices[band_idx][0][obj];
                    power_ratio[obj] = hParamIsmDec->power_ratios[band_idx][0][obj];

                    for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ )
                    {
                        for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ )
                        {
                            hMasaIsmData->energy_ratio_ism[obj_idx][sf_idx][bin_idx] = power_ratio[obj];
                        }
                    }
                }
            }
#endif
        }
    }
    else
Loading