Commit 7b563a13 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[cleanup] accept CODE_IMPROVEMENTS

parent 82893098
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -181,7 +181,6 @@
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */
#define FIX_1330_JBM_MEMORY                             /* VA: issue 1330: memory savings in the JBM decoder */
#define FIX_1330_JBM_MEMORY_FIX                         /* VA: basop issue: 2179 fix non-BE difference in FIX_1330_JBM_MEMORY */
#define CODE_IMPROVEMENTS
#define NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Nokia: issue 1339: Apply scaling to the object-part of OMASA for binaural rendering in IVAS_rend. */
#define NONBE_1362_FIX_OMASA_TO_MASA1_RENDERING         /* Nokia: Fix OMASA to MASA1 rendering in IVAS_rend */
#define FIX_1383_HEAD_TRACK_SANITIZER                   /* Nok: issue 1383: Fix head tracking struc values reading in renderer */
+0 −12
Original line number Diff line number Diff line
@@ -1742,23 +1742,11 @@ double anint(
int16_t is_numeric_float(
    float x )
{
#ifdef CODE_IMPROVEMENTS
    int16_t retval;
#define WMC_TOOL_SKIP
    retval = (int16_t) ( !isnan( x ) && !isinf( x ) );
#undef WMC_TOOL_SKIP
    return retval;
#else
    union float_int
    {
        float float_val;
        int32_t int_val;
    } float_int;

    float_int.float_val = x;

    return ( ( float_int.int_val & 0x7f800000 ) != 0x7f800000 );
#endif
}

/*-------------------------------------------------------------------*
+0 −6
Original line number Diff line number Diff line
@@ -163,15 +163,9 @@ const float ap_lattice_coeffs_3[DIRAC_DECORR_FILTER_LEN_3*DIRAC_MAX_NUM_DECORR_F

const float * const ap_lattice_coeffs[DIRAC_DECORR_NUM_SPLIT_BANDS] =
{
#ifdef CODE_IMPROVEMENTS
    ap_lattice_coeffs_1,
    ap_lattice_coeffs_2,
    ap_lattice_coeffs_3,
#else
    &ap_lattice_coeffs_1[0],
    &ap_lattice_coeffs_2[0],
    &ap_lattice_coeffs_3[0],
#endif
};

const float ap_split_frequencies[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] =
+0 −59
Original line number Diff line number Diff line
@@ -3641,7 +3641,6 @@ static ivas_error getConstInputById(
    return IVAS_ERR_OK;
}

#ifdef CODE_IMPROVEMENTS
static void *getInputByIndex(
    void *inputsArray,
    const size_t index,
@@ -3666,56 +3665,30 @@ static void *getInputByIndex(
    /* include a final return to make the linter happy and avoid problems with wmc_tool (see #1355) */
    return NULL;
}
#endif

static ivas_error findFreeInputSlot(
#ifdef CODE_IMPROVEMENTS
    void *inputs,
    const IVAS_REND_AudioConfigType inputType,
#else
    const void *inputs,
    const int32_t inputStructSize,
#endif
    const int32_t maxInputs,
    int32_t *inputIndex )
{
#ifdef CODE_IMPROVEMENTS
    /* Using a void pointer and a separately provided type is a hack for this function
       to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa).
        Assumptions:
            - input_base is always the first member in the input struct
            - memory alignments of original input type and input_base are the same
    */
#else
    /* Using a void pointer and a separately provided size is a hack for this function
       to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa).
        Assumptions:
            - input_base is always the first member in the input struct
            - provided size is correct
    */
#endif

    int32_t i;
    bool canAddInput;
#ifndef CODE_IMPROVEMENTS
    const uint8_t *pByte;
#endif
    const input_base *pInputBase;

    canAddInput = false;

    /* Find first unused input in array */
#ifdef CODE_IMPROVEMENTS
    for ( i = 0; i < maxInputs; ++i )
#else
    for ( i = 0, pByte = inputs; i < maxInputs; ++i, pByte += inputStructSize )
#endif
    {
#ifdef CODE_IMPROVEMENTS
        pInputBase = (const input_base *) getInputByIndex( inputs, i, inputType );
#else
        pInputBase = (const input_base *) pByte;
#endif

        if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID )
        {
@@ -3939,11 +3912,7 @@ ivas_error IVAS_REND_AddInput(
    ivas_error error;
    int32_t maxNumInputsOfType;
    void *inputsArray;
#ifdef CODE_IMPROVEMENTS
    IVAS_REND_AudioConfigType inputType;
#else
    int32_t inputStructSize;
#endif
    ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, hrtf_handles *hrtfs );
    void ( *setInputDelay )( void *, bool );
    int32_t inputIndex;
@@ -3976,46 +3945,30 @@ ivas_error IVAS_REND_AddInput(
        splitPreRendCldfb = ( hIvasRend->hRendererConfig->split_rend_config.codec == ISAR_SPLIT_REND_CODEC_LCLD );
    }

#ifdef CODE_IMPROVEMENTS
    inputType = getAudioConfigType( inConfig );
    switch ( inputType )
#else
    switch ( getAudioConfigType( inConfig ) )
#endif
    {
        case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED:
            maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS;
            inputsArray = hIvasRend->inputsIsm;
#ifndef CODE_IMPROVEMENTS
            inputStructSize = sizeof( *hIvasRend->inputsIsm );
#endif
            activateInput = setRendInputActiveIsm;
            setInputDelay = setRendInputDelayIsm;
            break;
        case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED:
            maxNumInputsOfType = RENDERER_MAX_MC_INPUTS;
            inputsArray = hIvasRend->inputsMc;
#ifndef CODE_IMPROVEMENTS
            inputStructSize = sizeof( *hIvasRend->inputsMc );
#endif
            activateInput = setRendInputActiveMc;
            setInputDelay = setRendInputDelayMc;
            break;
        case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS:
            maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS;
            inputsArray = hIvasRend->inputsSba;
#ifndef CODE_IMPROVEMENTS
            inputStructSize = sizeof( *hIvasRend->inputsSba );
#endif
            activateInput = setRendInputActiveSba;
            setInputDelay = setRendInputDelaySba;
            break;
        case IVAS_REND_AUDIO_CONFIG_TYPE_MASA:
            maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS;
            inputsArray = hIvasRend->inputsMasa;
#ifndef CODE_IMPROVEMENTS
            inputStructSize = sizeof( *hIvasRend->inputsMasa );
#endif
            activateInput = setRendInputActiveMasa;
            setInputDelay = setRendInputDelayMasa;
            break;
@@ -4024,29 +3977,17 @@ ivas_error IVAS_REND_AddInput(
    }

        /* Find first free input in array corresponding to input type */
#ifdef CODE_IMPROVEMENTS
    if ( ( error = findFreeInputSlot( inputsArray, inputType, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK )
#else
    if ( ( error = findFreeInputSlot( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }

    *inputId = makeInputId( inConfig, inputIndex );
#ifdef CODE_IMPROVEMENTS
    if ( ( error = activateInput( getInputByIndex( inputsArray, inputIndex, inputType ), inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK )
#else
    if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK )
#endif
    {
        return error;
    }
#ifdef CODE_IMPROVEMENTS
    setInputDelay( getInputByIndex( inputsArray, inputIndex, inputType ), splitPreRendCldfb );
#else
    setInputDelay( (uint8_t *) inputsArray + inputStructSize * inputIndex, splitPreRendCldfb );
#endif

    /* set global maximum delay after adding an input */
    setMaxGlobalDelayNs( hIvasRend );
+0 −4
Original line number Diff line number Diff line
@@ -317,11 +317,7 @@ static bool readByte( FILE *file, uint8_t *value )
static bool readLong( FILE *file, uint16_t *value )
{
    char buffer[4] = { 0 };
#ifdef CODE_IMPROVEMENTS
    if ( fread( buffer, 1, 4, file ) != 1U )
#else
    if ( fread( buffer, 4, 1, file ) != 1U )
#endif
    {
        return false;
    }
Loading