Commit 0f75e581 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[cleanup] actually accept SPLIT_REND_LC3PLUS_MC (buggy coan on arm64 :( )

parent 28585fbb
Loading
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1741,7 +1741,6 @@ ivas_error ivas_rend_crendProcessSubframe(

    return IVAS_ERR_OK;
}
#ifdef SPLIT_REND_LC3PLUS_MC


/*-----------------------------------------------------------------------------------------*
@@ -1861,4 +1860,3 @@ ivas_error ivas_rend_crendProcessSplitBin(

    return IVAS_ERR_OK;
}
#endif
+0 −16
Original line number Diff line number Diff line
@@ -718,17 +718,9 @@ void ObjRenderIvasFrame_splitBinaural(
)
{
    int32_t i;
#ifdef SPLIT_REND_LC3PLUS_MC
    float tmpProcessing[MAX_OUTPUT_CHANNELS][L_FRAME48k];
#else
    float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k];
#endif
    float tmpBinaural[MAX_HEAD_ROT_POSES * 2][L_FRAME48k];
#ifdef SPLIT_REND_LC3PLUS_MC
    float *p_tmpProcessing[MAX_OUTPUT_CHANNELS];
#else
    float *p_tmpProcessing[MAX_NUM_OBJECTS];
#endif

    int16_t pos_idx;
    IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -766,11 +758,7 @@ void ObjRenderIvasFrame_splitBinaural(

    /* Copy input audio to a processing buffer. Cannot render in-place because binaurally rendered
     * audio would overwrite original material, which is still needed for rendering next head pose. */
#ifdef SPLIT_REND_LC3PLUS_MC
    for ( i = 0; i < st_ivas->nchan_transport; ++i )
#else
    for ( i = 0; i < MAX_NUM_OBJECTS; ++i )
#endif
    {
        mvr2r( output[i], tmpProcessing[i], output_frame );
    }
@@ -802,12 +790,8 @@ void ObjRenderIvasFrame_splitBinaural(
                }
            }
        }
#ifdef SPLIT_REND_LC3PLUS_MC
        /* Handle the 1 ISM case where there is only one channel in the input buffer */
        for ( i = 0; i < max( st_ivas->nchan_transport, BINAURAL_CHANNELS ); ++i )
#else
        for ( i = 0; i < BINAURAL_CHANNELS; i++ )
#endif
        {
            p_tmpProcessing[i] = tmpProcessing[i];
        }
+0 −2
Original line number Diff line number Diff line
@@ -637,14 +637,12 @@ ivas_error ivas_rend_crendProcessSubframe(
    const int32_t output_Fs                                     /* i  : output sampling rate                    */
);

#ifdef SPLIT_REND_LC3PLUS_MC
/* TODO tmu : interface cleanup */
ivas_error ivas_rend_crendProcessSplitBin(
    Decoder_Struct *st_ivas,
    float output[][L_FRAME48k],
    const int16_t output_frame 
);
#endif

/*----------------------------------------------------------------------------------*
 * Reverberator
+0 −81
Original line number Diff line number Diff line
@@ -177,9 +177,7 @@ typedef struct
    EFAP_WRAPPER efapInWrapper;
    TDREND_WRAPPER tdRendWrapper;
    CREND_WRAPPER_HANDLE crendWrapper;
#ifdef SPLIT_REND_LC3PLUS_MC
    TDREND_WRAPPER splitTdRendWrappers[MAX_HEAD_ROT_POSES - 1]; /* Additional TD Rend instances used for split rendering */
#endif
    REVERB_HANDLE hReverb;
    rotation_gains rot_gains_prev;
    int16_t nonDiegeticPan;
@@ -2138,10 +2136,8 @@ static ivas_error updateMcPanGains(
            switch ( outConfig )
            {
                case IVAS_REND_AUDIO_CONFIG_BINAURAL:
#ifdef SPLIT_REND_LC3PLUS_MC
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
#endif
                    break; /* Do nothing */
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR:
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
@@ -2188,9 +2184,7 @@ static ivas_error initMcBinauralRendering(
    RENDER_CONFIG_DATA *hRendCfg )
{
    ivas_error error;
#ifdef SPLIT_REND_LC3PLUS_MC
    int16_t i;
#endif
    int32_t outSampleRate;

    /* check if re-initialization */
@@ -2200,7 +2194,6 @@ static ivas_error initMcBinauralRendering(
        inputMc->tdRendWrapper.hHrtfTD = NULL;
    }

#ifdef SPLIT_REND_LC3PLUS_MC
    for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
    {
        if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL )
@@ -2209,7 +2202,6 @@ static ivas_error initMcBinauralRendering(
            inputMc->splitTdRendWrappers[i].hHrtfTD = NULL;
        }
    }
#endif

    ivas_rend_closeCrend( &inputMc->crendWrapper
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -2256,7 +2248,6 @@ static ivas_error initMcBinauralRendering(
            return error;
        }

#ifdef SPLIT_REND_LC3PLUS_MC
        if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
            /* Open TD renderer wrappers */
@@ -2276,7 +2267,6 @@ static ivas_error initMcBinauralRendering(
            }
        }

#endif
        if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK )
@@ -2291,11 +2281,7 @@ static ivas_error initMcBinauralRendering(
                                            NULL, outSampleRate
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                            ,
#ifdef SPLIT_REND_LC3PLUS_MC
                                            ( ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1
#else
                                            1
#endif
#endif
                                            ) ) != IVAS_ERR_OK )
        {
@@ -2411,9 +2397,7 @@ static ivas_error setRendInputActiveMc(
    const IVAS_REND_InputId id,
    RENDER_CONFIG_DATA *hRendCfg )
{
#ifdef SPLIT_REND_LC3PLUS_MC
    int16_t i;
#endif
    ivas_error error;
    rendering_context rendCtx;
    IVAS_REND_AudioConfig outConfig;
@@ -2448,19 +2432,13 @@ static ivas_error setRendInputActiveMc(
    inputMc->hMcMasa = NULL;
    initRotGains( inputMc->rot_gains_prev );
    inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut );
#ifdef SPLIT_REND_LC3PLUS_MC
    for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i )
    {
        inputMc->splitTdRendWrappers[i] = defaultTdRendWrapper();
    }
#endif


#ifdef SPLIT_REND_LC3PLUS_MC
    if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL )
#else
    if ( outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#endif
    {
        if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg ) ) != IVAS_ERR_OK )
        {
@@ -2487,9 +2465,7 @@ static ivas_error setRendInputActiveMc(
static void clearInputMc(
    input_mc *inputMc )
{
#ifdef SPLIT_REND_LC3PLUS_MC
    int16_t i;
#endif
    rendering_context rendCtx;

    rendCtx = inputMc->base.ctx;
@@ -2525,7 +2501,6 @@ static void clearInputMc(
        inputMc->tdRendWrapper.hHrtfTD = NULL;
    }

#ifdef SPLIT_REND_LC3PLUS_MC
    for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i )
    {
        if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL )
@@ -2534,7 +2509,6 @@ static void clearInputMc(
            inputMc->splitTdRendWrappers[i].hHrtfTD = NULL;
        }
    }
#endif

    ivas_mcmasa_ana_close( &( inputMc->hMcMasa ) );

@@ -3722,13 +3696,11 @@ ivas_error IVAS_REND_Open(
        hIvasRend->inputsMc[i].nonDiegeticPanGain = nonDiegeticPanGain;
        hIvasRend->inputsMc[i].hMcMasa = NULL;

#ifdef SPLIT_REND_LC3PLUS_MC
        for ( j = 0; j < (int16_t) ( sizeof( hIvasRend->inputsMc[i].splitTdRendWrappers ) / sizeof( *hIvasRend->inputsMc[i].splitTdRendWrappers ) ); ++j )
        {
            hIvasRend->inputsMc[i].splitTdRendWrappers[j].hBinRendererTd = NULL;
            hIvasRend->inputsMc[i].splitTdRendWrappers[j].hHrtfTD = NULL;
        }
#endif
    }

    for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i )
@@ -4318,11 +4290,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout(
        return error;
    }

#ifdef SPLIT_REND_LC3PLUS_MC
    if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL )
#else
    if ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#endif
    {
        if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK )
        {
@@ -6370,24 +6338,16 @@ static ivas_error renderActiveInputsIsm(

static ivas_error renderLfeToBinaural(
    const input_mc *mcInput,
#ifdef SPLIT_REND_LC3PLUS_MC
    const IVAS_REND_AudioConfig outConfig,
#endif
    IVAS_REND_AudioBuffer outAudio )
{
    int16_t i;
    int16_t lfe_idx;
#ifdef SPLIT_REND_LC3PLUS_MC
    int16_t pose_idx, num_poses;
#endif
    float gain;
    float *readPtr, *writePtr;

#ifdef SPLIT_REND_LC3PLUS_MC
    assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" );
#else
    assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" );
#endif

    push_wmops( "renderLfeToBinaural" );

@@ -6407,7 +6367,6 @@ static ivas_error renderLfeToBinaural(
        return IVAS_ERR_OK;
    }

#ifdef SPLIT_REND_LC3PLUS_MC
    /* Copy LFE to left and right binaural channels */
    if ( mcInput->base.ctx.pSplitRendWrapper != NULL )
    {
@@ -6434,22 +6393,6 @@ static ivas_error renderLfeToBinaural(
            *writePtr++ += gain * ( *readPtr++ );
        }
    }
#else
    /* Copy LFE to left and right ears */
    readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 );
    writePtr = getSmplPtr( outAudio, 0, 0 );
    for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ )
    {
        *writePtr++ += gain * ( *readPtr++ );
    }

    readPtr = getSmplPtr( mcInput->base.inputBuffer, lfe_idx, 0 );
    writePtr = getSmplPtr( outAudio, 1, 0 );
    for ( i = 0; i < mcInput->base.inputBuffer.config.numSamplesPerChannel; i++ )
    {
        *writePtr++ += gain * ( *readPtr++ );
    }
#endif

    pop_wmops();

@@ -6548,11 +6491,7 @@ static ivas_error renderMcToBinaural(

    accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio );

#ifdef SPLIT_REND_LC3PLUS_MC
    if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK )
#else
    if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
@@ -6650,11 +6589,7 @@ static ivas_error renderMcToBinauralRoom(

    accumulate2dArrayToBuffer( tmpRendBuffer, &outAudio );

#ifdef SPLIT_REND_LC3PLUS_MC
    if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK )
#else
    if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
@@ -6752,11 +6687,7 @@ static ivas_error renderMcCustomLsToBinauralRoom(

    accumulate2dArrayToBuffer( tmpCrendBuffer, &outAudio );

#ifdef SPLIT_REND_LC3PLUS_MC
    if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK )
#else
    if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
@@ -6831,7 +6762,6 @@ static ivas_error renderMcToMasa(
    return IVAS_ERR_OK;
}

#ifdef SPLIT_REND_LC3PLUS_MC
static ivas_error renderMcToSplitBinaural(
    input_mc *mcInput,
    const IVAS_REND_AudioConfig outConfig,
@@ -7005,7 +6935,6 @@ static ivas_error renderMcToSplitBinaural(
    return IVAS_ERR_OK;
}

#endif
static ivas_error renderInputMc(
    input_mc *mcInput,
    IVAS_REND_AudioConfig outConfig,
@@ -7056,12 +6985,10 @@ static ivas_error renderInputMc(
                        error = renderMcToBinauralRoom( mcInput, outConfig, outAudio );
                    }
                    break;
#ifdef SPLIT_REND_LC3PLUS_MC
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
                    error = renderMcToSplitBinaural( mcInput, outConfig, outAudio );
                    break;
#endif
                default:
                    return IVAS_ERR_INVALID_OUTPUT_FORMAT;
            }
@@ -8600,12 +8527,8 @@ ivas_error IVAS_REND_GetSamples(
    /* Use internal buffer if outputting split rendering bitstream */
    if ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
         ( ( hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) &&
#ifdef SPLIT_REND_LC3PLUS_MC
           ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ||
             ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) )
#else
           ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN )
#endif
               ) )
    {
        outAudio = hIvasRend->splitRendEncBuffer;
@@ -8670,12 +8593,8 @@ ivas_error IVAS_REND_GetSamples(
#endif
           )
    /* The condition below is a temp fix for differences in procesing paths between split rendering of SBA and ISM. Should be unified */
#ifdef SPLIT_REND_LC3PLUS_MC
         && ( ( hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ||
              ( hIvasRend->inputsMc[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN ) ) )
#else
         && hIvasRend->inputsIsm[0].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN )
#endif
    {
        /* TODO: doesn't work for multiple SBA inputs, needs to be updated like the ISM path for TD */
        ivas_split_rend_bits_t bits;