Commit b7054fa8 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge remote-tracking branch 'origin/ivas-float-update' into...

Merge remote-tracking branch 'origin/ivas-float-update' into 2137_ref_port_mr_1822_omasa_rateswitch_invalid_data
parents 744ae247 e96061e8
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -469,11 +469,15 @@
    <ClCompile Include="..\lib_com\ivas_lfe_com.c">
      <Filter>common_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\ivas_rotation_com.c" />
    <ClCompile Include="..\lib_com\ivas_limiter.c" />
    <ClCompile Include="..\lib_com\ivas_osba_com.c">
      <Filter>common_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\ivas_rotation_com.c">
      <Filter>common_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_com\ivas_limiter.c">
      <Filter>common_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_com\basop_proto_func.h">
+0 −35
Original line number Diff line number Diff line
@@ -147,9 +147,7 @@ typedef struct
    AcousticEnvironmentSequence aeSequence;
    bool dpidEnabled;
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
#ifdef OBJ_EDITING_COMMANDLINE
    bool objEditEnabled;
#endif
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    char *objEditFileName;
#endif
@@ -194,13 +192,11 @@ static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBs
static int16_t app_own_random( int16_t *seed );
static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar );
#endif
#ifdef OBJ_EDITING_EXAMPLE
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );
#else
static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters );
#endif
#endif


/*------------------------------------------------------------------------------------------*
@@ -462,13 +458,8 @@ int main(
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;

#ifdef LIB_DEC_REVISION
#ifdef OBJ_EDITING_COMMANDLINE
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
                                       arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
                                       arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
                                       arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
@@ -1070,9 +1061,7 @@ static bool parseCmdlIVAS_dec(
        arg->directivityPatternId[i] = 65535;
    }

#ifdef OBJ_EDITING_COMMANDLINE
    arg->objEditEnabled = false;
#endif
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    arg->objEditFileName = NULL;
#endif
@@ -1605,7 +1594,6 @@ static bool parseCmdlIVAS_dec(

            i += tmp;
        }
#ifdef OBJ_EDITING_COMMANDLINE
        else if ( strcmp( argv_to_upper, "-OBJ_EDIT" ) == 0 )
        {
            arg->objEditEnabled = true;
@@ -1629,7 +1617,6 @@ static bool parseCmdlIVAS_dec(
            i++;
#endif
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -1837,12 +1824,10 @@ static void usage_dec( void )
    fprintf( stdout, "                      ID and duration pairs, where duration is specified in frames\n" );
#endif
    fprintf( stdout, "                      for BINAURAL_ROOM_REVERB output configuration.\n" );
#ifdef OBJ_EDITING_COMMANDLINE
#ifndef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    fprintf( stdout, "-obj_edit           : Enable objects editing\n" );
#else
    fprintf( stdout, "-obj_edit File      : Object editing instructions file or NULL for built-in example\n" );
#endif
#endif
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
@@ -2599,7 +2584,6 @@ static ivas_error decodeG192(
                    return error;
                }

#ifdef OBJ_EDITING_API
                /* Object metadata editing */
                if ( arg.objEditEnabled )
                {
@@ -2624,12 +2608,10 @@ static ivas_error decodeG192(
#endif

                    /* Do object metadata editing here ... */
#ifdef OBJ_EDITING_EXAMPLE
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
                    do_object_editing( &editableParameters, objectEditFileReader );
#else
                    do_object_editing( &editableParameters );
#endif
#endif

                    /* set new object parameters*/
@@ -2639,7 +2621,6 @@ static ivas_error decodeG192(
                        return error;
                    }
                }
#endif
                /* Do the final preparations needed for rendering */
                if ( ( error = IVAS_DEC_PrepareRenderer( hIvasDec ) ) != IVAS_ERR_OK )
                {
@@ -3206,9 +3187,7 @@ static ivas_error decodeVoIP(
    int16_t vec_pos_update, vec_pos_len;
    int16_t nOutSamples = 0;
    bool bitstreamReadDone = false;
#ifdef OBJ_EDITING_API
    bool parametersAvailableForEditing = false;
#endif
    uint16_t nSamplesRendered;

    vec_pos_update = 0;
@@ -3509,17 +3488,9 @@ static ivas_error decodeVoIP(
        while ( nSamplesRendered < nOutSamples )
        {
#ifdef SUPPORT_JBM_TRACEFILE
#ifdef OBJ_EDITING_API
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, &parametersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, systemTime_ms ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef OBJ_EDITING_API
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &bitstreamReadDone, &parametersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &bitstreamReadDone, systemTime_ms ) ) != IVAS_ERR_OK )
#endif
#endif
            {
                fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -3550,7 +3521,6 @@ static ivas_error decodeVoIP(
                }
            }

#ifdef OBJ_EDITING_API
            /* Object metadata editing */
            if ( arg.objEditEnabled && parametersAvailableForEditing == true )
            {
@@ -3564,14 +3534,12 @@ static ivas_error decodeVoIP(
                }

                /* Do object metadata editing here ... */
#ifdef OBJ_EDITING_EXAMPLE
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
                do_object_editing( &editableParameters, objectEditFileReader );
#else
                do_object_editing( &editableParameters );
#endif

#endif
                /* set new object parameters */
                if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK )
                {
@@ -3579,7 +3547,6 @@ static ivas_error decodeVoIP(
                    return error;
                }
            }
#endif
        } /* while ( nSamplesRendered < nOutSamples ) */

        /* write JBM Offset file entry */
@@ -3885,7 +3852,6 @@ cleanup:
    return error;
}

#ifdef OBJ_EDITING_EXAMPLE

/*---------------------------------------------------------------------*
 * do_object_editing()
@@ -4006,7 +3972,6 @@ static void do_object_editing(
    return;
}

#endif
#ifdef DEBUGGING

/*---------------------------------------------------------------------*
+9 −9
Original line number Diff line number Diff line
@@ -682,8 +682,8 @@ int main(
    RotFileReader *headRotReader = NULL;
    RotFileReader *externalOrientationFileReader = NULL;
    RotFileReader *referenceRotReader = NULL;
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS];
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS];
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[RENDERER_MAX_INPUT_CHANNELS];
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[RENDERER_MAX_INPUT_CHANNELS];
    int16_t cldfb_in_flag, CLDFBframeSize_smpls;
    SplitRendBFIFileReader *splitRendBFIReader = NULL;
    Vector3PairFileReader *referenceVectorReader = NULL;
@@ -3876,7 +3876,7 @@ static ivas_error parseLfePanMtxFile(
       any subsequent issue in file reading will gracefully exit the function */
    for ( lfe_in = 0; lfe_in < RENDERER_MAX_INPUT_LFE_CHANNELS; lfe_in++ )
    {
        for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ )
        for ( i = 0; i < RENDERER_MAX_OUTPUT_CHANNELS; i++ )
        {
            ( *lfePanMtx )[lfe_in][i] = 0.0f;
        }
@@ -3904,7 +3904,7 @@ static ivas_error parseLfePanMtxFile(
            {
                continue;
            }
            if ( ch_out > IVAS_MAX_OUTPUT_CHANNELS )
            if ( ch_out > RENDERER_MAX_OUTPUT_CHANNELS )
            {
                break;
            }
@@ -3945,13 +3945,13 @@ static void convertInputBuffer(
    if ( cldfb_in_flag )
    {
        int16_t slotIdx, numCldfbBands, numFloatPcmSamples;
        float fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE];
        float fIn[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE];

        numFloatPcmSamples = numFloatSamplesPerChannel >> 1;
        numCldfbBands = numFloatPcmSamples / IVAS_CLDFB_NO_COL_MAX;

        /* CLDFB Analysis*/
        assert( numIntSamplesPerChannel <= IVAS_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE );
        assert( numIntSamplesPerChannel <= RENDERER_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE );
        for ( smpl = 0; smpl < numFloatPcmSamples; ++smpl )
        {
            for ( chnl = 0; chnl < numChannels; ++chnl )
@@ -4026,9 +4026,9 @@ static void convertOutputBuffer(
    if ( cldfb_in_flag )
    {
        int16_t slotIdx, numCldfbBands, numPcmSamples, b;
        float fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE];
        float re[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX];
        float im[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX];
        float fIn[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE];
        float re[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX];
        float im[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX];

        numPcmSamples = numSamplesPerChannel >> 1;
        numCldfbBands = numPcmSamples / IVAS_CLDFB_NO_COL_MAX;
+4 −9
Original line number Diff line number Diff line
@@ -50,8 +50,7 @@
#define IVAS_MAX_BITS_PER_FRAME ( 512000 / IVAS_NUM_FRAMES_PER_SEC )                 /* maximum bits per frame; corresponds to maximum bitrate of 512 kbps */

#define IVAS_MAX_NUM_OBJECTS       4
#define IVAS_MAX_INPUT_CHANNELS    16
#define IVAS_MAX_OUTPUT_CHANNELS   16 /* Note: there is an exception for OSBA and EXT otuput where it can be 20 (HOA3 + 4 ISM channels) */
#define IVAS_MAX_LS_CHANNELS       16
#define IVAS_CLDFB_NO_COL_MAX      16
#define IVAS_CLDFB_NO_CHANNELS_MAX 60

@@ -131,13 +130,10 @@ typedef struct _IVAS_ISM_METADATA
    float yaw;
    float pitch;
    int16_t non_diegetic_flag;
#ifdef OBJ_EDITING_API
    float gain;
#endif

} IVAS_ISM_METADATA;

#ifdef OBJ_EDITING_API
typedef struct _IVAS_EDITABLE_PARAMETERS
{
    int16_t num_obj;
@@ -145,7 +141,6 @@ typedef struct _IVAS_EDITABLE_PARAMETERS
    float gain_bed;

} IVAS_EDITABLE_PARAMETERS;
#endif

typedef struct
{
@@ -194,10 +189,10 @@ typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT;
typedef struct _IVAS_LS_CUSTOM_LAYOUT
{
    int16_t num_spk;
    float azimuth[IVAS_MAX_OUTPUT_CHANNELS];
    float elevation[IVAS_MAX_OUTPUT_CHANNELS];
    float azimuth[IVAS_MAX_LS_CHANNELS];
    float elevation[IVAS_MAX_LS_CHANNELS];
    int16_t num_lfe;
    int16_t lfe_idx[IVAS_MAX_OUTPUT_CHANNELS];
    int16_t lfe_idx[IVAS_MAX_LS_CHANNELS];

} IVAS_CUSTOM_LS_DATA;

+9 −7
Original line number Diff line number Diff line
@@ -128,12 +128,12 @@ typedef enum
 * IVAS general constants
 *----------------------------------------------------------------------------------*/

#define MAX_INPUT_CHANNELS                      16                          /* Maximum number of input channels (HOA 3rd order), == IVAS_MAX_INPUT_CHANNELS */
#define MAX_INPUT_CHANNELS                      16                          /* Maximum number of input channels (HOA 3rd order or IVAS_MAX_LS_CHANNELS) without separate objects in combined formats */
#define MAX_TRANSPORT_CHANNELS                  12                          /* Maximum number of transport channels */
#define MAX_INTERN_CHANNELS                     16                          /* Maximum number of intern channels (HOA 3rd order) */
#define HEAD_ROTATION_HOA_ORDER                 3                           /* HOA 3rd order */
#define MAX_CICP_CHANNELS                       16                          /* max channels for loudspeaker layouts (16 for custom layouts)*/
#define MAX_OUTPUT_CHANNELS                     16                          /* Maximum number of output channels (HOA 3rd order) without separate objects in combined formats */
#define MAX_LS_CHANNELS                         16                          /* max channels for loudspeaker layouts (16 for custom layouts), == IVAS_MAX_LS_CHANNELS */
#define MAX_OUTPUT_CHANNELS                     16                          /* Maximum number of output channels (HOA 3rd order or IVAS_MAX_LS_CHANNELS) without separate objects in combined formats */
#define MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN     2                           /* Maximum number of output channels with non diegetic panning */

#define BINAURAL_CHANNELS                       2                           /* number of channels for binaural output configuration */
@@ -175,7 +175,11 @@ typedef enum
#define MAX_JBM_L_FRAME48k                      1920
#define MAX_JBM_L_FRAME_NS                      40000000L
#define MAX_SPAR_INTERNAL_CHANNELS              IVAS_SPAR_MAX_CH
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
#define MAX_CLDFB_DIGEST_CHANNELS               3                           /* == maximum of ParamISM TCs and ParamMC TCs */
#else
#define MAX_CLDFB_DIGEST_CHANNELS               (FOA_CHANNELS + MAX_NUM_OBJECTS)
#endif

typedef enum
{
@@ -1221,11 +1225,9 @@ enum
#define MASA_MAXIMUM_TWO_DIR_BANDS              24
#define NBITS_HR_COH                            4
#define OMASA_TDREND_MATCHING_GAIN              0.7943f
#ifdef OMASA_OBJECT_EDITING
#define OMASA_GAIN_EDIT_THR                     0.06f                       /* OMASA gain change threshold */
#define OMASA_AZI_EDIT_THR                      1.0f                        /* OMASA-DISC azimuth change threshold */
#define OMASA_ELE_EDIT_THR                      2.0f                        /* OMASA-DISC elevation change threshold */
#endif

#define MASA_JBM_RINGBUFFER_FRAMES              3

@@ -1520,7 +1522,7 @@ typedef enum
 * TD Binaural Object renderer
 *----------------------------------------------------------------------------------*/

#define MAX_NUM_TDREND_CHANNELS                 MAX_CICP_CHANNELS           /* max. number of channels in TD renderer (objects or loudspeaker channels) */
#define MAX_NUM_TDREND_CHANNELS                 MAX_LS_CHANNELS             /* max. number of channels in TD renderer (objects or loudspeaker channels) */

#define SFX_SPAT_BIN_MAX_NO_OF_OUTPUT_SAMPLES   288                         /* 288 = 6 msec @ 48 kHz.                                           */
#define HRTF_MODEL_N_SECTIONS                   3                           /* No. sections used in approximate evaluation of model             */
@@ -1623,7 +1625,7 @@ typedef enum

#define IVAS_MAX_FB_MIXER_OUT_CH                IVAS_SPAR_MAX_CH
#define IVAS_MAX_SPAR_FB_MIXER_IN_CH            IVAS_SPAR_MAX_CH
#define IVAS_MAX_FB_MIXER_IN_CH                 MAX_CICP_CHANNELS
#define IVAS_MAX_FB_MIXER_IN_CH                 MAX_LS_CHANNELS

#define MAX_NUM_BANDS_DIFF_NON48K               3

Loading