Commit 565774e3 authored by bayers's avatar bayers
Browse files

object editing interface, fix API changes in conjunction with split rendering,...

object editing interface, fix API changes in conjunction with split rendering, add a new define OBJ_EDITING_EXAMPLE for the example code in decoder.c since DEBUGGING is broken at the moment, clang-format, fix small bug in inactive code
parent 1ac962c3
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@
#endif
#include "wmc_auto.h"
#ifdef OBJ_EDITING_API
#ifdef DEBUGGING
#ifdef OBJ_EDITING_EXAMPLE
#include <math.h>
#endif
#endif
@@ -165,7 +165,7 @@ typedef struct
    int16_t Opt_dpid_on;
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
#ifdef OBJ_EDITING_API
#ifdef DEBUGGING
#ifdef OBJ_EDITING_EXAMPLE
    bool objEditEnabled;
#endif
#endif
@@ -1161,7 +1161,7 @@ static bool parseCmdlIVAS_dec(
    }

#ifdef OBJ_EDITING_API
#ifdef DEBUGGING
#ifdef OBJ_EDITING_EXAMPLE
    arg->objEditEnabled = false;
#endif
#endif
@@ -1672,7 +1672,7 @@ static bool parseCmdlIVAS_dec(
            i += tmp;
        }
#ifdef OBJ_EDITING_API
#ifdef DEBUGGING
#ifdef OBJ_EDITING_EXAMPLE
        else if ( strcmp( argv_to_upper, "-OBJ_EDIT" ) == 0 )
        {
            arg->objEditEnabled = true;
@@ -2579,7 +2579,7 @@ static ivas_error decodeG192(
                    goto cleanup;
                }
#ifdef OBJ_EDITING_API
#ifdef DEBUGGING
#ifdef OBJ_EDITING_EXAMPLE
                if ( arg.objEditEnabled )
                {

+2 −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") */
@@ -154,6 +154,7 @@
#ifdef OBJ_EDITING_INTERFACE
#define OBJ_EDITING_API                                 /* object editing changes related to the API */
#define OBJ_EDITING_DECODER                             /* object editing changes realted to the decoder functions */
#define OBJ_EDITING_EXAMPLE                             /* obj editing example code in decoder.c */
#endif

/* ################### Start BE switches ################################# */
+3 −4
Original line number Diff line number Diff line
@@ -2151,8 +2151,7 @@ ivas_error ivas_init_decoder(
#ifdef OBJ_EDITING_DECODER
           || st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD
#endif
           )
    )
           ) )
    {
        if ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
        {
+55 −3
Original line number Diff line number Diff line
@@ -98,7 +98,12 @@ struct IVAS_DEC

#ifdef OBJ_EDITING_API
    uint16_t nSamplesFlushed;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    void *flushbuffer;
    IVAS_DEC_PCM_TYPE pcmType;
#else
    int16_t *flushbuffer;
#endif
    bool hasEditableParameters;
    bool enableParameterEditing;
    bool hasBeenPreparedRendering;
@@ -188,6 +193,9 @@ ivas_error IVAS_DEC_Open(
    hIvasDec->updateOrientation = false;
#ifdef OBJ_EDITING_API
    hIvasDec->flushbuffer = NULL;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    hIvasDec->pcmType = PCM_NOT_KNOW;
#endif
    hIvasDec->nSamplesFlushed = 0;
    hIvasDec->hasEditableParameters = false;
    hIvasDec->enableParameterEditing = false;
@@ -544,8 +552,14 @@ ivas_error IVAS_DEC_Configure(
    /* init flush buffer if necessary (only needed for binaural)*/
    if ( tsmEnabled && ( outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
        hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) );
        hIvasDec->pcmType = PCM_INT16;
        set_s( (int16_t *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
#else
        hIvasDec->flushbuffer = (int16_t *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) );
        set_s( hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
#endif
    }
#endif

@@ -815,10 +829,16 @@ ivas_error IVAS_DEC_EnableVoIP(

#ifdef OBJ_EDITING_API
    /* init flush buffer if necessary (only needed for binaural)*/
    if ( hIvasDec->flushbuffer == NULL && ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
    if ( hIvasDec->flushbuffer == NULL && ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
        hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) );
        hIvasDec->pcmType = PCM_INT16;
        set_s( (int16_t *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
#else
        hIvasDec->flushbuffer = (int16_t *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t ) );
        set_s( hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
#endif
    }
#endif

@@ -922,7 +942,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial(
        uint8_t nTransportChannels, nOutChannels;
        int16_t nResidualSamples, nSamplesTcsScaled, nOutSamplesElse;
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmType, pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels ) ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &hIvasDec->nSamplesFlushed, hIvasDec->pcmType, hIvasDec->flushbuffer ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &hIvasDec->nSamplesFlushed, hIvasDec->flushbuffer ) ) != IVAS_ERR_OK )
#endif
@@ -1133,7 +1153,7 @@ ivas_error IVAS_DEC_GetSamples(
#ifndef OBJ_EDITING_API
    uint8_t nTransportChannels;
    int16_t nOutSamplesElse;
    uint16_t nTimeScalerOutSamples. l_ts;
    uint16_t nTimeScalerOutSamples, l_ts;
#endif
    nSamplesRendered = 0;
    nOutChannels = 0;
@@ -1294,7 +1314,29 @@ ivas_error IVAS_DEC_GetSamples(
            /* check for possible flushed samples from a rate switch */
            if ( hIvasDec->nSamplesFlushed > 0 )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                void *pPcmBuffer;
#ifdef DEBUGGING
                assert( hIvasDec->pcmType == pcmType );
#endif
                pPcmBuffer = pcm_buffer_offset( pcmBuf, pcmType, nSamplesRendered * nOutChannels );
                if ( pcmType == PCM_INT16 )
                {
                    mvs2s( (int16_t *) hIvasDec->flushbuffer, pPcmBuffer, hIvasDec->nSamplesFlushed * nOutChannels );
                }
                else if ( pcmType == PCM_FLOAT32 )
                {
                    mvr2r( (float *) hIvasDec->flushbuffer, pPcmBuffer, hIvasDec->nSamplesFlushed * nOutChannels );
                }
#ifdef DEBUGGING
                else
                {
                    assert( 0 & "wrong PCM type for the flush buffer!" );
                }
#endif
#else
                mvs2s( hIvasDec->flushbuffer, pcmBuf + nSamplesRendered * nOutChannels, hIvasDec->nSamplesFlushed * nOutChannels );
#endif
                nSamplesRendered += hIvasDec->nSamplesFlushed;
                hIvasDec->nSamplesFlushed = 0;
            }
@@ -1382,6 +1424,16 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(

    numPoses = hSplitBinRend->splitrend.multiBinPoseData.num_poses;

#ifdef OBJ_EDITING_API
    /* init flush buffer for rate switch if not already initizalized */
    if ( hIvasDec->flushbuffer == NULL )
    {
        hIvasDec->flushbuffer = (void *) malloc( numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float ) );
        hIvasDec->pcmType = PCM_FLOAT32;
        set_zero( (float *) hIvasDec->flushbuffer, numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
    }
#endif

    if ( st_ivas->hDecoderConfig->render_framesize != IVAS_RENDER_FRAMESIZE_20MS &&
         ( hIvasDec->st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
           hIvasDec->st_ivas->hRenderConfig->split_rend_config.dof == 0 ) )
+1 −1

File changed.

Contains only whitespace changes.