Commit 9e5c8aae authored by bayers's avatar bayers
Browse files

object editing interface, start populating the API functions, add example code...

object editing interface, start populating the API functions, add example code in the decoder, add functionality for discrete ISM object editing.
parent a24d12dd
Loading
Loading
Loading
Loading
+71 −1
Original line number Diff line number Diff line
@@ -55,6 +55,11 @@
#include "debug.h"
#endif
#include "wmc_auto.h"
#ifdef OBJ_EDITING_INTERFACE
#ifdef DEBUGGING
#include <math.h>
#endif
#endif


#define WMC_TOOL_SKIP
@@ -144,7 +149,11 @@ typedef struct
    uint16_t acousticEnvironmentId;
    int16_t Opt_dpid_on;
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];

#ifdef OBJ_EDITING_INTERFACE
#ifdef DEBUGGING
    bool objEditEnabled;
#endif
#endif
} DecArguments;


@@ -1096,6 +1105,13 @@ static bool parseCmdlIVAS_dec(
        arg->directivityPatternId[i] = 65535;
    }

#ifdef OBJ_EDITING_INTERFACE
#ifdef DEBUGGING
    arg->objEditEnabled = false;
#endif
#endif


    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/
@@ -1521,6 +1537,15 @@ static bool parseCmdlIVAS_dec(

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

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -2355,6 +2380,51 @@ static ivas_error decodeG192(
                }

                /* edit object parameters...*/
#ifdef DEBUGGING
                if ( arg.objEditEnabled )
                {
                    /* put the objects equally spaced at the horizontal plane */
                    /* and play a little bit with the gains... */
                    int16_t obj_idx, non_diegetic_obj_idx;
                    int16_t num_nondiegetic_objects;
                    float gain_mean;
                    float gain_amplitude;
                    float gain_freq;
                    float gain_freq_offset;

                    num_nondiegetic_objects = 0;
                    for ( obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ )
                    {
                        if ( !editableParameters.ism_metadata[obj_idx].non_diegetic_flag )
                        {
                            num_nondiegetic_objects++;
                        }
                    }
                    if ( num_nondiegetic_objects )
                    {
                        float start_angle, angle_inc;
                        angle_inc = 360.0f / (float) num_nondiegetic_objects;
                        start_angle = angle_inc / 2.0f;
                        for ( obj_idx = 0, non_diegetic_obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ )
                        {
                            if ( !editableParameters.ism_metadata[obj_idx].non_diegetic_flag )
                            {
                                editableParameters.ism_metadata[obj_idx].elevation = 0.0f;
                                editableParameters.ism_metadata[obj_idx].azimuth = start_angle + (float) non_diegetic_obj_idx * angle_inc;
                                non_diegetic_obj_idx++;
                            }
                        }
                    }
                    gain_mean = 1.0f;
                    gain_amplitude = 0.7f;
                    gain_freq = ( 2.0f * 3.1415f ) / 100.0f;
                    gain_freq_offset = 2.0f * 3.1415f / (float) ( editableParameters.num_obj + 1 );
                    for ( obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ )
                    {
                        editableParameters.ism_metadata[obj_idx].gain = gain_mean + gain_amplitude * sinf( (float) frame * gain_freq + gain_freq_offset * (float) obj_idx );
                    }
                }
#endif
                /* set new object parameters*/
                if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK )
                {
+0 −1
Original line number Diff line number Diff line
@@ -130,7 +130,6 @@ typedef struct _IVAS_ISM_METADATA

typedef struct _IVAS_EDITABLE_PARAMETERS
{

	int16_t num_obj;
    IVAS_ISM_METADATA ism_metadata[IVAS_MAX_NUM_OBJECTS];
    float gain_bed;
+3 −0
Original line number Diff line number Diff line
@@ -417,6 +417,9 @@ void ivas_ism_reset_metadata(
    hIsmMeta->radius = 1.0f;
    hIsmMeta->ism_metadata_flag = 0;
    hIsmMeta->non_diegetic_flag = 0;
#ifdef OBJ_EDITING_INTERFACE
    hIsmMeta->gain = 1.0f;
#endif

    return;
}
+5 −0
Original line number Diff line number Diff line
@@ -1033,6 +1033,11 @@ ivas_error ivas_ism_metadata_dec(
    DEC_CORE_HANDLE st0                                         /* i  : core-coder handle                           */
);

#ifdef OBJ_EDITING_INTERFACE
void ivas_ism_renderer_update_md(
	Decoder_Struct *st_ivas                                     /* i/o:  main IVAS decoder handle                   */
);
#endif

/*----------------------------------------------------------------------------------*
 * Parametric ISM prototypes
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
/* ################### Start DEBUGGING switches ########################### */

#ifndef RELEASE
/*#define DEBUGGING*/                               /* Activate debugging part of the code */
#define DEBUGGING                               /* Activate debugging part of the code */
#endif
/*#define WMOPS*/                               /* Activate complexity and memory counters */
/*#define WMOPS_PER_FRAME*/                     /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */
Loading