Commit ff8cd9fc authored by vaclav's avatar vaclav
Browse files

Merge branch '1901-ref-PortFlpMr1688' into 'ivas-float-update'

Port MR1688 and MR1729 from float to FLP-ref

See merge request !2091
parents 1b7dbfa6 0cd41553
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -170,6 +170,10 @@ typedef struct
    char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    int8_t orientation_tracking;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    int16_t Opt_Headrotation;
    int16_t Opt_ExternalOrientation;
#endif
    int16_t nonDiegeticPan;
    float nonDiegeticPanGain;
    IVAS_REND_COMPLEXITY_LEVEL complexityLevel;
@@ -896,7 +900,11 @@ int main(

    const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
@@ -2654,7 +2662,13 @@ static CmdlnArgs defaultArgs(
    clearString( args.renderConfigFilePath );
    clearString( args.externalOrientationFilePath );

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    args.Opt_Headrotation = 0;
    args.Opt_ExternalOrientation = 0;
#endif

    args.orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE;

    args.nonDiegeticPan = 0;
    args.nonDiegeticPanGain = 0.f;

@@ -2746,6 +2760,9 @@ static void parseOption(
            break;
        case CmdLnOptionId_trajFile:
            assert( numOptionValues == 1 );
#ifdef FIX_1135_EXT_RENDERER_HANDLES
            args->Opt_Headrotation = 1;
#endif
            strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
            break;
        case CmdLnOptionId_outputMetadata:
@@ -2766,6 +2783,9 @@ static void parseOption(
            break;
        case CmdLnOptionId_exteriorOrientationFile:
            assert( numOptionValues == 1 );
#ifdef FIX_1135_EXT_RENDERER_HANDLES
            args->Opt_ExternalOrientation = 1;
#endif
            strncpy( args->externalOrientationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
            break;
        case CmdLnOptionId_customHrtfFile:
@@ -2899,6 +2919,13 @@ static CmdlnArgs parseCmdlnArgs(
        exit( -1 ); /* Error printout handled by failing function */
    }

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        args.Opt_Headrotation = 1;
    }
#endif

    return args;
}

+3 −2
Original line number Diff line number Diff line
@@ -198,7 +198,8 @@
#define NONBE_FIX_1141_OSBA_ROOM_RENDERING              /* FhG: Fix for issue 1141: render objects in OSBA decoder with room effect  */
#define NONBE_1360_LFE_DELAY                            /* Dlb: LFE delay alignment when rendering in CLDFB domain*/
#define NONBE_1229_FIX_ISM1_DPID                        /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */
#define NONBE_SVD_OPTIMIZATION
#define NONBE_SVD_OPTIMIZATION                          /* FhG: port-2211-svd-optimization */
#define FIX_1135_EXT_RENDERER_HANDLES                   /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */
#define FIX_1209_SID_SIGNALING                          /* VA: issue 1209: remove dead code in IVAS SID signaling */
#define FIX_1158_FASTCONV_REVERB_HRTF                   /* Philips: issue 1158: Rendering with FastConv to BINAURAL_ROOM_REVERB uses BRIR convolution instead of HRTF */
#define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR       /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */
+1 −1
Original line number Diff line number Diff line
@@ -1001,7 +1001,7 @@ typedef struct decoder_config_structure
    int16_t Opt_non_diegetic_pan;                /* indicates diegetic or not */
    float non_diegetic_pan_gain;                 /* non diegetic panning gain*/
    int16_t Opt_AMR_WB;                          /* flag indicating AMR-WB IO mode */
    int16_t Opt_ExternalOrientation;             /* indiates whether external orientations are used */
    int16_t Opt_ExternalOrientation;             /* indicates whether external orientations are used */
    int16_t Opt_dpid_on;                         /* indicates whether Directivity pattern option is used */
    int16_t Opt_aeid_on;                         /* indicates whether Acoustic environment option is used */
#ifdef DEBUGGING
+2 −1
Original line number Diff line number Diff line
@@ -488,11 +488,12 @@ ivas_error IVAS_DEC_Configure(
        hDecoderConfig->render_framesize = renderFramesize;
    }

#ifndef FIX_1135_EXT_RENDERER_HANDLES
    if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        hDecoderConfig->Opt_Headrotation = TRUE;
    }

#endif
    /* Set decoder parameters to initial values */
    if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK )
    {
+83 −8
Original line number Diff line number Diff line
@@ -1108,7 +1108,11 @@ static ivas_error initHeadRotation(
static void closeHeadRotation(
    IVAS_REND_HANDLE hIvasRend )
{
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( hIvasRend != NULL && hIvasRend->headRotData.headRotEnabled && hIvasRend->headRotData.hOrientationTracker != NULL )
#else
    if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) )
#endif
    {
        free( hIvasRend->headRotData.hOrientationTracker );
    }
@@ -2761,6 +2765,10 @@ ivas_error IVAS_REND_Open(
    const bool asHrtfBinary,
    const int16_t nonDiegeticPan,
    const float nonDiegeticPanGain,
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    const int16_t Opt_Headrotation,
    const int16_t Opt_ExternalOrientation,
#endif
    const int16_t num_subframes )
{
    int16_t i;
@@ -2815,22 +2823,46 @@ ivas_error IVAS_REND_Open(
    }

    /* Initialize headrotation data */
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    hIvasRend->headRotData.headRotEnabled = 0;
    if ( Opt_Headrotation )
    {
#endif
        if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    }
#endif

    /* Initialize external orientation data */
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    hIvasRend->hExternalOrientationData = NULL;
    if ( Opt_ExternalOrientation )
    {
#endif
        if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    }
#endif

    /* Initilize combined orientation data */
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    hIvasRend->hCombinedOrientationData = NULL;
    if ( Opt_Headrotation || Opt_ExternalOrientation )
    {
#endif
        if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    }
#endif

    /* Initialize EFAP */
    if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK )
@@ -2938,10 +2970,18 @@ ivas_error IVAS_REND_Open(
            return error;
        }
    }

#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
#endif
        if ( ( error = ivas_HRTF_statistics_init( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    }
#endif

    return IVAS_ERR_OK;
}
@@ -3866,7 +3906,11 @@ ivas_error IVAS_REND_GetDelay(
    {
        if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID )
        {
#ifdef FIX_1135_EXT_RENDERER_HANDLES
            if ( hIvasRend->splitRendWrapper != NULL && hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL )
#else
            if ( hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL )
#endif
            {
                if ( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
                {
@@ -4539,6 +4583,13 @@ ivas_error IVAS_REND_SetOrientationTrackingMode(
    const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i  : Head orientation tracking type */
)
{
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( hIvasRend->headRotData.headRotEnabled == 0 )
    {
        return IVAS_ERR_OK;
    }
#endif

    return ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, orientation_tracking );
}

@@ -5169,7 +5220,11 @@ static ivas_error renderIsmToBinauralRoom(

    hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -5784,7 +5839,11 @@ static ivas_error renderMcToBinaural(

    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -5874,7 +5933,11 @@ static ivas_error renderMcToBinauralRoom(

    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -5966,7 +6029,11 @@ static ivas_error renderMcCustomLsToBinauralRoom(

    hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
@@ -6576,7 +6643,11 @@ static ivas_error renderSbaToBinaural(

        hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
        combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
        if ( *hCombinedOrientationData != NULL )
#else
        if ( hCombinedOrientationData != NULL )
#endif
        {
            for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
            {
@@ -6653,7 +6724,11 @@ static ivas_error renderSbaToBinauralRoom(

    hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
    combinedOrientationEnabled = 0;
#ifdef FIX_1135_EXT_RENDERER_HANDLES
    if ( *hCombinedOrientationData != NULL )
#else
    if ( hCombinedOrientationData != NULL )
#endif
    {
        for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
        {
Loading