Commit fd468dd2 authored by vaclav's avatar vaclav
Browse files

port CR

parent 8435dd9f
Loading
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;
@@ -2641,7 +2649,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;

@@ -2733,6 +2747,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:
@@ -2753,6 +2770,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:
@@ -2886,6 +2906,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;
}

+1 −0
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@
#define NONBE_1894_OSBA_SCALING                         /* FhG: port OSBA scaling MRs (298,355,360) jointly */
#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 FIX_1135_EXT_RENDERER_HANDLES                   /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. *

/* #################### End BASOP porting switches ############################ */

+1 −1
Original line number Diff line number Diff line
@@ -996,7 +996,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
@@ -496,11 +496,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 )
    {
+84 −9
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 )
                {
@@ -4535,6 +4579,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 );
}

@@ -5165,7 +5216,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++ )
        {
@@ -5780,7 +5835,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++ )
        {
@@ -5870,7 +5929,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++ )
        {
@@ -5962,7 +6025,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++ )
        {
@@ -6572,7 +6639,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++ )
            {
@@ -6649,7 +6720,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