Commit 058a7643 authored by Jan Kiene's avatar Jan Kiene
Browse files

turn md delay renderer argument into integer type

parent a5f850f6
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@
#include "lib_rend.h"
#include "lib_rend.h"
#include <assert.h>
#include <assert.h>
#include <math.h>
#include <math.h>
#include <stdint.h>
#include <string.h>
#include <string.h>
#include "audio_file_reader.h"
#include "audio_file_reader.h"
#include "audio_file_writer.h"
#include "audio_file_writer.h"
@@ -186,7 +187,7 @@ typedef struct
    float lfeConfigElevation;
    float lfeConfigElevation;
    bool lfeCustomRoutingEnabled;
    bool lfeCustomRoutingEnabled;
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
    float syncMdDelay;
    int16_t syncMdDelay;
    IVAS_RENDER_FRAMESIZE render_framesize;
    IVAS_RENDER_FRAMESIZE render_framesize;
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
    AcousticEnvironmentSequence aeSequence;
    AcousticEnvironmentSequence aeSequence;
@@ -2904,7 +2905,7 @@ static void parseOption(
        case CmdLnOptionId_syncMdDelay:
        case CmdLnOptionId_syncMdDelay:
            assert( numOptionValues == 1 );
            assert( numOptionValues == 1 );
            /* Metadata Delay to sync with audio delay in ms */
            /* Metadata Delay to sync with audio delay in ms */
            args->syncMdDelay = strtof( optionValues[0], NULL );
            args->syncMdDelay = (int16_t) strtol( optionValues[0], NULL, 10 );
            break;
            break;
        default:
        default:
            assert( 0 && "This should be unreachable - all command line options should be explicitly handled." );
            assert( 0 && "This should be unreachable - all command line options should be explicitly handled." );
+12 −21
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@
#include <math.h>
#include <math.h>
#include <stdbool.h>
#include <stdbool.h>
#include "wmc_auto.h"
#include "wmc_auto.h"
#include <stdint.h>




/*-------------------------------------------------------------------*
/*-------------------------------------------------------------------*
@@ -125,7 +126,7 @@ typedef struct
#ifdef NONBE_1377_REND_DIRATT_CONF
#ifdef NONBE_1377_REND_DIRATT_CONF
    int16_t object_id;
    int16_t object_id;
#endif
#endif
    float ism_metadata_delay_ms;
    int16_t ism_metadata_delay_ms;
} input_ism;
} input_ism;


typedef struct
typedef struct
@@ -1510,7 +1511,7 @@ static ivas_error alignInputDelay(
            if ( getAudioConfigType( inputBase->inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED )
            if ( getAudioConfigType( inputBase->inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED )
            {
            {
                inputIsm = (input_ism *) inputBase;
                inputIsm = (input_ism *) inputBase;
                inputIsm->ism_metadata_delay_ms = maxGlobalDelayNs / 1e6f;
                inputIsm->ism_metadata_delay_ms = (int16_t) roundf( inputIsm->ism_metadata_delay_ms + maxGlobalDelayNs / 1e6f / ( 1000.f / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
            }
            }
        }
        }
    }
    }
@@ -5473,14 +5474,12 @@ static ivas_error renderIsmToBinaural(
{
{
    float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    ivas_error error;
    ivas_error error;
    int16_t ism_md_subframe_update_ext;


    push_wmops( "renderIsmToBinaural" );
    push_wmops( "renderIsmToBinaural" );
    /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */

    ism_md_subframe_update_ext = (int16_t) roundf( ismInput->ism_metadata_delay_ms / ( 1000.f / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
    copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer );
    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,
    if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ismInput->ism_metadata_delay_ms,
                                                  *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK )
                                                  *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpTDRendBuffer ) ) != IVAS_ERR_OK )
    {
    {
        return error;
        return error;
@@ -5675,17 +5674,13 @@ static ivas_error renderIsmToBinauralReverb(
{
{
    float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    ivas_error error;
    ivas_error error;
    int16_t ism_md_subframe_update_ext;


    push_wmops( "renderIsmToBinauralRoom" );
    push_wmops( "renderIsmToBinauralRoom" );


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

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


    if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb,
    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, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK )
                                                  ismInput->ism_metadata_delay_ms, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK )
    {
    {
        return error;
        return error;
    }
    }
@@ -5852,16 +5847,12 @@ static ivas_error renderIsmToSplitBinaural(
    float tmpBinaural_CldfbIm[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
    float tmpBinaural_CldfbIm[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
    int16_t output_frame = ismInput->base.inputBuffer.config.numSamplesPerChannel;
    int16_t output_frame = ismInput->base.inputBuffer.config.numSamplesPerChannel;
    COMBINED_ORIENTATION_HANDLE pCombinedOrientationData;
    COMBINED_ORIENTATION_HANDLE pCombinedOrientationData;
    int16_t ism_md_subframe_update_ext;


    push_wmops( "renderIsmToSplitBinaural" );
    push_wmops( "renderIsmToSplitBinaural" );


    pSplitRendWrapper = ismInput->base.ctx.pSplitRendWrapper;
    pSplitRendWrapper = ismInput->base.ctx.pSplitRendWrapper;
    pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData;
    pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData;


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

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


    if ( pMultiBinPoseData->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    if ( pMultiBinPoseData->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
@@ -5911,7 +5902,7 @@ static ivas_error renderIsmToSplitBinaural(


        /* Render */
        /* Render */
        if ( ( error = ivas_td_binaural_renderer_ext( ( pos_idx == 0 ) ? &ismInput->tdRendWrapper : &ismInput->splitTdRendWrappers[pos_idx - 1], ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos,
        if ( ( error = ivas_td_binaural_renderer_ext( ( pos_idx == 0 ) ? &ismInput->tdRendWrapper : &ismInput->splitTdRendWrappers[pos_idx - 1], ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos,
                                                      NULL, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, output_frame, tmpProcessing ) ) != IVAS_ERR_OK )
                                                      NULL, ismInput->ism_metadata_delay_ms, *ismInput->base.ctx.pOutSampleRate, output_frame, tmpProcessing ) ) != IVAS_ERR_OK )
        {
        {
            return error;
            return error;
        }
        }
@@ -7683,7 +7674,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects(


ivas_error IVAS_REND_SetIsmMetadataDelay(
ivas_error IVAS_REND_SetIsmMetadataDelay(
    IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle    */
    IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle    */
    const float sync_md_delay   /* i  : ISM Metadata Delay in ms to sync with audio delay   */
    const int16_t sync_md_delay /* i  : ISM Metadata Delay in ms to sync with audio delay   */
)
)
{
{
    int16_t i;
    int16_t i;
@@ -7695,7 +7686,7 @@ ivas_error IVAS_REND_SetIsmMetadataDelay(


    for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
    {
        hIvasRend->inputsIsm[i].ism_metadata_delay_ms = sync_md_delay;
        hIvasRend->inputsIsm[i].ism_metadata_delay_ms = (int16_t) roundf( sync_md_delay / ( 1000.f / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
    }
    }


    return IVAS_ERR_OK;
    return IVAS_ERR_OK;
+1 −1
Original line number Original line Diff line number Diff line
@@ -380,7 +380,7 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects(


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


ivas_error IVAS_REND_GetNumAllObjects(
ivas_error IVAS_REND_GetNumAllObjects(