Commit 4e957874 authored by vaclav's avatar vaclav
Browse files

editorial improvements in lib_rend.c

parent db4e1648
Loading
Loading
Loading
Loading
Loading
+29 −75
Original line number Diff line number Diff line
@@ -954,6 +954,8 @@ static void closeHeadRotation(
    {
        free( hIvasRend->headRotData.hOrientationTracker );
    }

    return;
}
#endif

@@ -1065,7 +1067,9 @@ static CREND_WRAPPER defaultCrendWrapper(
    return w;
}

static bool isIoConfigPairSupported( IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig )
static bool isIoConfigPairSupported(
    IVAS_REND_AudioConfig inConfig,
    IVAS_REND_AudioConfig outConfig )
{
    /* Rendering mono or stereo to binaural is not supported */
    if ( ( inConfig == IVAS_REND_AUDIO_CONFIG_MONO || inConfig == IVAS_REND_AUDIO_CONFIG_STEREO ) &&
@@ -1224,6 +1228,8 @@ static void fillIdentityPanMatrix(
    {
        panMatrix[i][i] = 1.0f;
    }

    return;
}

static ivas_error initMcPanGainsWithIdentMatrix(
@@ -1248,8 +1254,7 @@ static ivas_error initMcPanGainsWithConversionMapping(
     * Stay with default panning matrix if conversion_matrix is NULL */
    for ( i = 0; i < LS_SETUP_CONVERSION_NUM_MAPPINGS; ++i )
    {
        if ( ls_conversion_mapping[i].input_config == ivasConfigIn &&
             ls_conversion_mapping[i].output_config == ivasConfigOut )
        if ( ls_conversion_mapping[i].input_config == ivasConfigIn && ls_conversion_mapping[i].output_config == ivasConfigOut )
        {
            /* Mapping found with valid matrix - copy */
            if ( ls_conversion_mapping[i].conversion_matrix != NULL )
@@ -1881,7 +1886,7 @@ static lfe_routing defaultLfeRouting(
    const IVAS_REND_AudioConfig outConfig,
    const LSSETUP_CUSTOM_STRUCT customLsOut )
{
    int32_t i;
    int16_t i;
    lfe_routing routing;

    /* Set all output gains to zero, then route each input LFE consecutively to the next available output LFE. */
@@ -2473,7 +2478,7 @@ static DecoderDummy *initDecoderDummy(
    decDummy = malloc( sizeof( DecoderDummy ) );
    decDummy->hDecoderConfig = malloc( sizeof( DECODER_CONFIG ) );
    decDummy->hDecoderConfig->output_Fs = sampleRate;
    decDummy->hDecoderConfig->nchan_out = (int16_t) numOutChannels;
    decDummy->hDecoderConfig->nchan_out = numOutChannels;
    decDummy->hDecoderConfig->Opt_Headrotation = 0;

    decDummy->hBinRenderer = NULL;
@@ -2557,7 +2562,7 @@ static ivas_error setRendInputActiveMasa(
    {
        return error;
    }
    inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, (int16_t) numInChannels, outConfig, 0 );
    inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 );
    inputMasa->metadataHasBeenFed = false;

    if ( ( error = updateMasaDummyDec( inputMasa, outConfig ) ) != IVAS_ERR_OK )
@@ -2662,10 +2667,7 @@ ivas_error IVAS_REND_Open(
    ivas_error error;
    int16_t numOutChannels;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( phIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -2824,10 +2826,7 @@ ivas_error IVAS_REND_ConfigureCustomOutputLoudspeakerLayout(
    input_mc *inputMc;
    input_sba *inputSba;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -2909,10 +2908,7 @@ ivas_error IVAS_REND_NumOutChannels(
{
    ivas_error error;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL || numOutChannels == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3135,10 +3131,7 @@ ivas_error IVAS_REND_AddInput(
    ivas_error ( *activateInput )( void *, IVAS_REND_AudioConfig, IVAS_REND_InputId, RENDER_CONFIG_DATA * );
    int32_t inputIndex;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL || inputId == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3207,10 +3200,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout(
    input_mc *inputMc;
    ivas_error error;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3276,10 +3266,7 @@ ivas_error IVAS_REND_SetInputGain(
    input_base *inputBase;
    ivas_error error;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3313,10 +3300,7 @@ ivas_error IVAS_REND_SetInputLfeMtx(
    input_mc *pInputMc;
    ivas_error error;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3367,10 +3351,7 @@ ivas_error IVAS_REND_SetInputLfePos(
    input_mc *pInputMc;
    ivas_error error;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3416,10 +3397,7 @@ ivas_error IVAS_REND_RemoveInput(
    ivas_error error;
    input_base *inputBase;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3467,10 +3445,7 @@ ivas_error IVAS_REND_GetInputNumChannels(
    ivas_error error;
    const input_base *pInput;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL || numChannels == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3509,10 +3484,7 @@ ivas_error IVAS_REND_GetDelay(
    int32_t latency_ns;
    int32_t max_latency_ns;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL || nSamples == NULL || timeScale == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3583,10 +3555,7 @@ ivas_error IVAS_REND_FeedInputAudio(
    input_base *inputBase;
    int16_t numInputChannels;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL || inputAudio.data == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3650,10 +3619,7 @@ ivas_error IVAS_REND_FeedInputObjectMetadata(
    input_ism *inputIsm;
    ivas_error error;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3694,10 +3660,7 @@ ivas_error IVAS_REND_FeedInputMasaMetadata(
    input_base *inputBase;
    input_masa *inputMasa;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -3881,10 +3844,7 @@ ivas_error IVAS_REND_SetHeadRotation(
    IVAS_QUATERNION rotQuat;
#endif

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -4224,7 +4184,7 @@ static ivas_error rotateFrameMc(
    /* initialize gains to passthrough */
    for ( ch_in = 0; ch_in < nchan; ch_in++ )
    {
        set_zero( gains[ch_in], (int16_t) nchan );
        set_zero( gains[ch_in], nchan );
        gains[ch_in][ch_in] = 1.f;
    }

@@ -5586,10 +5546,7 @@ ivas_error IVAS_REND_GetSamples(
    ivas_error error;
    int16_t numOutChannels;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( hIvasRend == NULL || outAudio.data == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -5667,10 +5624,7 @@ void IVAS_REND_Close(
    uint16_t i;
    IVAS_REND_HANDLE hIvasRend;

    /*-----------------------------------------------------------------*
     * Validate function arguments
     *-----------------------------------------------------------------*/

    /* Validate function arguments */
    if ( phIvasRend == NULL || *phIvasRend == NULL )
    {
        return;