Commit ff68f8cc authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'renderer-md-sync-delay-data-type' into 'main'

change md sync delay in ext renderer to integer type

See merge request !2319
parents d8321cbb b9b31e1e
Loading
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@
#include "lib_rend.h"
#include <assert.h>
#include <math.h>
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
#include <stdint.h>
#endif
#include <string.h>
#include "audio_file_reader.h"
#include "audio_file_writer.h"
@@ -189,7 +192,11 @@ typedef struct
    float lfeConfigElevation;
    bool lfeCustomRoutingEnabled;
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
    int16_t syncMdDelay;
#else
    float syncMdDelay;
#endif
    IVAS_RENDER_FRAMESIZE render_framesize;
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
    AcousticEnvironmentSequence aeSequence;
@@ -2844,7 +2851,11 @@ static void parseOption(
        case CmdLnOptionId_syncMdDelay:
            assert( numOptionValues == 1 );
            /* Metadata Delay to sync with audio delay in ms */
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
            args->syncMdDelay = (int16_t) strtol( optionValues[0], NULL, 10 );
#else
            args->syncMdDelay = strtof( optionValues[0], NULL );
#endif
            break;
        default:
            assert( 0 && "This should be unreachable - all command line options should be explicitly handled." );
+1 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@
#define FIX_1119_SPLIT_RENDERING_VOIP                   /* FhG: Add split rendering support to decoder in VoIP mode */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */
#define RENDERER_MD_SYNC_DELAY_TO_INTEGER               /* FhG: change data type of metadata sync delay in ext renderer to int16_t for better BASOP portability (and nicer code) */


/* #################### End BE switches ################################## */
+29 −1
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@
#include <math.h>
#include <stdbool.h>
#include "wmc_auto.h"
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
#include <stdint.h>
#endif


/*-------------------------------------------------------------------*
@@ -123,7 +126,11 @@ typedef struct
    OMASA_ANA_HANDLE hOMasa;
    uint16_t total_num_objects;
    int16_t object_id;
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
    int16_t ism_metadata_delay_ms;
#else
    float ism_metadata_delay_ms;
#endif
} input_ism;

typedef struct
@@ -1517,7 +1524,11 @@ static ivas_error alignInputDelay(
            if ( getAudioConfigType( inputBase->inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED )
            {
                inputIsm = (input_ism *) inputBase;
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
                inputIsm->ism_metadata_delay_ms = (int16_t) roundf( inputIsm->ism_metadata_delay_ms + maxGlobalDelayNs / 1e6f );
#else
                inputIsm->ism_metadata_delay_ms = maxGlobalDelayNs / 1e6f;
#endif
            }
        }
    }
@@ -5485,7 +5496,12 @@ static ivas_error renderIsmToBinaural(

    push_wmops( "renderIsmToBinaural" );
    /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
    ism_md_subframe_update_ext = (int16_t) roundf( ismInput->ism_metadata_delay_ms / (float) BINAURAL_RENDERING_FRAME_SIZE_MS );
#else
    ism_md_subframe_update_ext = (int16_t) roundf( ismInput->ism_metadata_delay_ms / ( 1000.f / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif

    copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer );

    if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext,
@@ -5689,7 +5705,11 @@ static ivas_error renderIsmToBinauralReverb(
    push_wmops( "renderIsmToBinauralRoom" );

    /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
    ism_md_subframe_update_ext = (int16_t) roundf( ismInput->ism_metadata_delay_ms / (float) BINAURAL_RENDERING_FRAME_SIZE_MS );
#else
    ism_md_subframe_update_ext = (int16_t) roundf( ismInput->ism_metadata_delay_ms / ( 1000.f / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif

    copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer );

@@ -5869,7 +5889,11 @@ static ivas_error renderIsmToSplitBinaural(
    pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData;

    /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
    ism_md_subframe_update_ext = (int16_t) roundf( ismInput->ism_metadata_delay_ms / (float) BINAURAL_RENDERING_FRAME_SIZE_MS );
#else
    ism_md_subframe_update_ext = (int16_t) roundf( ismInput->ism_metadata_delay_ms / ( 1000.f / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif

    pCombinedOrientationData = *ismInput->base.ctx.pCombinedOrientationData;

@@ -7685,7 +7709,11 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects(

ivas_error IVAS_REND_SetIsmMetadataDelay(
    IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle    */
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
    const int16_t sync_md_delay /* i  : ISM Metadata Delay in ms to sync with audio delay   */
#else
    const float sync_md_delay /* i  : ISM Metadata Delay in ms to sync with audio delay   */
#endif
)
{
    int16_t i;
+4 −0
Original line number Diff line number Diff line
@@ -371,7 +371,11 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects(

ivas_error IVAS_REND_SetIsmMetadataDelay(
    IVAS_REND_HANDLE hIvasRend,                     /* i/o: IVAS renderer handle                                */
#ifdef RENDERER_MD_SYNC_DELAY_TO_INTEGER
    const int16_t sync_md_delay                       /* i  :   Metadata Delay in ms to sync with audio delay     */
#else
    const float sync_md_delay                       /* i  :   Metadata Delay in ms to sync with audio delay     */
#endif
);

ivas_error IVAS_REND_GetNumAllObjects(