Commit 976f7fb6 authored by multrus's avatar multrus
Browse files

[cleanup] accept NOKIA_MASA_EXTERNAL_RENDERER

parent d04fc2ae
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
@@ -426,10 +426,8 @@ static int16_t getTotalNumInChannels(
    IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS],
    IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS],
    IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS]
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    ,
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS]
#endif
)
{
    int16_t totalNumInChannels = 0;
@@ -485,7 +483,6 @@ static int16_t getTotalNumInChannels(
        totalNumInChannels += numInputChannels;
    }

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
    {
        if ( masaIds[i] == 0 )
@@ -501,7 +498,6 @@ static int16_t getTotalNumInChannels(
        }
        totalNumInChannels += numInputChannels;
    }
#endif

    return totalNumInChannels;
}
@@ -675,9 +671,7 @@ int main(
    IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS] = { 0 };
    IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS] = { 0 };
    IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS] = { 0 };
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] = { 0 };
#endif

    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
    {
@@ -786,7 +780,6 @@ int main(
        }
    }

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    for ( i = 0; i < args.inConfig.numMasaBuses; ++i )
    {
        if ( ( error = IVAS_REND_AddInput( hIvasRend, args.inConfig.masaBuses[i].audioConfig, &masaIds[i] ) ) != IVAS_ERR_OK )
@@ -801,13 +794,8 @@ int main(
            exit( -1 );
        }
    }
#endif

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds, masaIds );
#else
    const int16_t totalNumInChannels = getTotalNumInChannels( hIvasRend, mcIds, ismIds, sbaIds );
#endif

    if ( AudioFileReader_getNumChannels( audioReader ) != 0 /* If input file is raw PCM, audio reader has no info about number of channels */
         && totalNumInChannels != AudioFileReader_getNumChannels( audioReader ) )
@@ -904,18 +892,6 @@ int main(
        }
#endif

#ifndef NOKIA_MASA_EXTERNAL_RENDERER
        for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
        {
            if ( masaReaders[i] != NULL )
            {
                MasaFileReader_readNextFrame( masaReaders[i] );
                /* TODO: Feed MASA metadata here once MASA inputs are supported.
                         For now avoid unused var warning */
                (void) hMasaMetadata;
            }
        }
#endif

        ObjectPositionBuffer mtdBuffer;
        IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer );
@@ -981,7 +957,6 @@ int main(
            }
        }

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
        for ( i = 0; i < args.inConfig.numMasaBuses; ++i )
        {
            if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, masaIds[i], &numChannels ) ) != IVAS_ERR_OK )
@@ -1009,7 +984,6 @@ int main(
                }
            }
        }
#endif

        IVAS_REND_GetSamples( hIvasRend, outBuffer );

+0 −2
Original line number Diff line number Diff line
@@ -60,9 +60,7 @@ typedef enum
    IVAS_ERR_INVALID_BITRATE,
    IVAS_ERR_INVALID_MASA_CONFIG,
    IVAS_ERR_TOO_MANY_INPUTS,
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    IVAS_ERR_MISSING_METADATA,
#endif
    IVAS_ERR_INDEX_OUT_OF_BOUNDS,
    IVAS_ERR_RECONFIGURE_NOT_SUPPORTED,
    IVAS_ERR_INVALID_FEC_CONFIG,
+0 −1
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@
/*#define ITD_WINNER_GAIN_MODIFY */                     /* ITD optimization - WORK IN PROGRESS */
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define FIX_I1_113                                      /* under review : MCT bit distribution optimization for SBA high bitrates*/
#define NOKIA_MASA_EXTERNAL_RENDERER                    /* Nokia: MASA support for external renderer */
#define FIX_EFAP_MATH                                   /* fix for EFAP: remove angle quantization and a bug in polygon lookup causing incorrect gains. minor tweak for ALLRAD. non-BE for modes using EFAP */
#define FIX_124_DONT_ALLOC_PLCINFO_IN_IVAS              /* Issue 124: do not allocate unused plc struct in IVAS modes which is only used in EVS mono */
#define FIX_MCT_PLC_RECOVERY                            /* Issue 184: scale the old synthesis part correctly in the first good frame after lost frames in MCT modes - to be activated after previous switch is merged */
+0 −28
Original line number Diff line number Diff line
@@ -139,7 +139,6 @@ typedef struct
    rotation_gains rot_gains_prev;
} input_sba;

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
/* Due to API of some rendering methods, the renderer has to use the decoder struct.
   Only struct members relevant for rendering will be initialized, therefore typedef as "dummy" decoder struct */
typedef Decoder_Struct DecoderDummy;
@@ -151,7 +150,6 @@ typedef struct
    MASA_METADATA_FRAME masaMetadata;
    bool metadataHasBeenFed;
} input_masa;
#endif

struct IVAS_REND
{
@@ -165,9 +163,7 @@ struct IVAS_REND
    input_ism inputsIsm[RENDERER_MAX_ISM_INPUTS];
    input_mc inputsMc[RENDERER_MAX_MC_INPUTS];
    input_sba inputsSba[RENDERER_MAX_SBA_INPUTS];
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    input_masa inputsMasa[RENDERER_MAX_MASA_INPUTS];
#endif

    /* TODO @Philips - inputConfig should not be stored here, but read from e.g. input_mc->input_base.inConfig, please remove this */
    IVAS_REND_AudioConfig inputConfig;
@@ -1871,7 +1867,6 @@ static void clearInputSba(
    return;
}

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
static ivas_error initMasaDummyDecForMcOut( input_masa *inputMasa, IVAS_REND_AudioConfig outConfig )
{
    ivas_error error;
@@ -2233,7 +2228,6 @@ static void freeDecoderDummy( DecoderDummy **ppDecDummy )
    }
    ivas_render_config_close( &pDecDummy->hRenderConfig );

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    /* CLDFB handles */
    for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
    {
@@ -2275,7 +2269,6 @@ static void freeDecoderDummy( DecoderDummy **ppDecDummy )

    /* Parametric binaural renderer handle */
    ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin );
#endif

    count_free( pDecDummy );
    pDecDummy = NULL;
@@ -2290,7 +2283,6 @@ static void clearInputMasa( input_masa *inputMasa )
    initRendInputBase( &inputMasa->base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, rendCtx );
    freeDecoderDummy( &inputMasa->decDummy );
}
#endif

ivas_error IVAS_REND_Open(
    IVAS_REND_HANDLE *phIvasRend,
@@ -2368,7 +2360,6 @@ ivas_error IVAS_REND_Open(
        initRendInputBase( &hIvasRend->inputsSba[i].base, IVAS_REND_AUDIO_CONFIG_UNKNOWN, 0, getRendCtx( hIvasRend ) );
        hIvasRend->inputsSba[i].crendWrapper.hCrend = NULL;
    }
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
    {
        initRendInputBase( &hIvasRend->inputsMasa[i].base,
@@ -2378,7 +2369,6 @@ ivas_error IVAS_REND_Open(
        hIvasRend->inputsMasa[i].decDummy = NULL;
        hIvasRend->inputsMasa[i].metadataHasBeenFed = false;
    }
#endif

    return IVAS_ERR_OK;
}
@@ -2599,7 +2589,6 @@ static ivas_error getInputById(
            }
            pInputBase = &hIvasRend->inputsSba[inputIndex].base;
            break;
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
        case IVAS_REND_AUDIO_CONFIG_TYPE_MASA:
            if ( inputIndex > RENDERER_MAX_MASA_INPUTS )
            {
@@ -2607,7 +2596,6 @@ static ivas_error getInputById(
            }
            pInputBase = &hIvasRend->inputsMasa[inputIndex].base;
            break;
#endif
        default:
            return IVAS_ERR_INVALID_INPUT_ID;
    }
@@ -2666,7 +2654,6 @@ static ivas_error getConstInputById(
            }
            pInputBase = &hIvasRend->inputsSba[inputIndex].base;
            break;
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
        case IVAS_REND_AUDIO_CONFIG_TYPE_MASA:
            if ( inputIndex > RENDERER_MAX_MASA_INPUTS )
            {
@@ -2674,7 +2661,6 @@ static ivas_error getConstInputById(
            }
            pInputBase = &hIvasRend->inputsMasa[inputIndex].base;
            break;
#endif
        default:
            return IVAS_ERR_INVALID_INPUT_ID;
    }
@@ -2773,14 +2759,12 @@ ivas_error IVAS_REND_AddInput(
            inputStructSize = sizeof( *hIvasRend->inputsSba );
            activateInput = setRendInputActiveSba;
            break;
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
        case IVAS_REND_AUDIO_CONFIG_TYPE_MASA:
            maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS;
            inputsArray = hIvasRend->inputsMasa;
            inputStructSize = sizeof( *hIvasRend->inputsMasa );
            activateInput = setRendInputActiveMasa;
            break;
#endif
        default:
            return IVAS_ERR_INVALID_INPUT_FORMAT;
    }
@@ -2975,11 +2959,9 @@ ivas_error IVAS_REND_RemoveInput(
        case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS:
            clearInputSba( (input_sba *) inputBase );
            break;
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
        case IVAS_REND_AUDIO_CONFIG_TYPE_MASA:
            clearInputMasa( (input_masa *) inputBase );
            break;
#endif
        default:
            return IVAS_ERR_INVALID_INPUT_FORMAT;
    }
@@ -3070,7 +3052,6 @@ ivas_error IVAS_REND_GetDelay(
        }
    }

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; i++ )
    {
        if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_REND_AUDIO_CONFIG_UNKNOWN )
@@ -3079,7 +3060,6 @@ ivas_error IVAS_REND_GetDelay(
            *nSamples = max( *nSamples, NS2SA( *timeScale, latency_ns ) );
        }
    }
#endif

    return IVAS_ERR_OK;
}
@@ -3172,7 +3152,6 @@ ivas_error IVAS_REND_FeedInputObjectMetadata(
    return IVAS_ERR_OK;
}

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
ivas_error IVAS_REND_FeedInputMasaMetadata(
    IVAS_REND_HANDLE hIvasRend,
    const IVAS_REND_InputId inputId,
@@ -3206,7 +3185,6 @@ ivas_error IVAS_REND_FeedInputMasaMetadata(

    return IVAS_ERR_OK;
}
#endif

ivas_error IVAS_REND_InitConfig( IVAS_REND_HANDLE st,
                                 bool rendererConfigEnabled )
@@ -4547,7 +4525,6 @@ static ivas_error renderActiveInputsSba(
    return IVAS_ERR_OK;
}

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
static void copyMasaMetadataToDiracRenderer( MASA_METADATA_FRAME *meta, DIRAC_DEC_HANDLE hDirAC )
{
    int16_t band, sf, bin;
@@ -4717,7 +4694,6 @@ static ivas_error renderActiveInputsMasa(

    return IVAS_ERR_OK;
}
#endif

ivas_error IVAS_REND_GetSamples(
    IVAS_REND_HANDLE hIvasRend,
@@ -4772,12 +4748,10 @@ ivas_error IVAS_REND_GetSamples(
    {
        return error;
    }
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    if ( ( error = renderActiveInputsMasa( hIvasRend, outAudio ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#endif

#ifdef DEBUGGING
    hIvasRend->numClipping +=
@@ -4821,12 +4795,10 @@ void IVAS_REND_Close(
    {
        clearInputSba( &hIvasRend->inputsSba[i] );
    }
#ifdef NOKIA_MASA_EXTERNAL_RENDERER
    for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
    {
        clearInputMasa( &hIvasRend->inputsMasa[i] );
    }
#endif

    /* clear Config. Renderer */
    ivas_render_config_close( &( hIvasRend->hRendererConfig ) );
+0 −9
Original line number Diff line number Diff line
@@ -228,20 +228,11 @@ ivas_error IVAS_REND_FeedInputObjectMetadata(
    const IVAS_REND_AudioObjectPosition objectPosition /* i  : object position struct                           */
);

#ifdef NOKIA_MASA_EXTERNAL_RENDERER
ivas_error IVAS_REND_FeedInputMasaMetadata(
    IVAS_REND_HANDLE hIvasRend,                     /* i/o: Renderer handle                                     */
    const IVAS_REND_InputId inputId,                /* i  : ID of the input                                     */
    IVAS_MASA_METADATA_HANDLE masaMetadata          /* i  : MASA metadata frame                                 */
);
#else
/* Support for MASA input will be added in the future. */
ivas_error IVAS_REND_FeedInputMasaMetadata(
    IVAS_REND_HANDLE hIvasRend,                     /* i/o: Renderer handle                                     */
    const IVAS_REND_InputId inputId,                /* i  : ID of the input                                     */
    void* TODO
);
#endif

ivas_error IVAS_REND_InitConfig(
    IVAS_REND_HANDLE st,                            /* i/o: Renderer handle */