Commit 0c399651 authored by Manuel Jander's avatar Manuel Jander
Browse files

merge conflict resolution

parents 45f1ef52 3a3a2ce7
Loading
Loading
Loading
Loading
Loading
+255 −1
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@
#ifdef IVAS_RTPDUMP
#include "ivas_rtp_file.h"
#endif
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
#include "ivas_cnst.h"
#endif

#ifdef FIXED_RTP_SEQUENCE_NUM
#define RANDOM_INITSEED_DEC ( 0xFEEDFADE )
@@ -176,13 +179,24 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef DECODER_FORMAT_SWITCHING
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
#else
#ifdef DDECODER_FORMAT_SWITCHING
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
#else
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
#endif
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );

#ifdef DECODER_FORMAT_SWITCHING
static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, IVAS_DEC_MODE codec, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData );
#endif

/*------------------------------------------------------------------------------------------*
 * main()
@@ -214,7 +228,10 @@ int main(
    IVAS_RENDER_FRAMESIZE asked_frame_size;
    IVAS_DEC_HRTF_BINARY_WRAPPER hHrtfBinary;
    ObjectEditFileReader *objectEditFileReader = NULL;

#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
    IVAS_ROOM_ACOUSTICS_CONFIG_DATA **pAE = NULL;
    uint32_t aeCount = 0;
#endif
#ifdef WMOPS
    reset_wmops();
    reset_mem( USE_BYTES );
@@ -425,7 +442,11 @@ int main(
     *------------------------------------------------------------------------------------------*/

    asked_frame_size = arg.renderFramesize;
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : IVAS_DEFAULT_AEID;
#else
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;
#endif

#ifdef IVAS_RTPDUMP
    arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM;
@@ -537,7 +558,47 @@ int main(
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
            goto cleanup;
        }
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
        aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader );
        if ( aeCount > 0 )
        {
            uint32_t n;

            pAE = malloc( aeCount * sizeof( IVAS_ROOM_ACOUSTICS_CONFIG_DATA * ) );

            if ( pAE == NULL )
            {
                fprintf( stderr, "\nError: cannot allocate memory for acoustic environment array\n\n" );
                goto cleanup;
            }

            for ( n = 0; n < aeCount; n++ )
            {
                pAE[n] = NULL;

                if ( NULL == ( pAE[n] = malloc( sizeof( IVAS_ROOM_ACOUSTICS_CONFIG_DATA ) ) ) )
                {
                    fprintf( stderr, "\nError: cannot allocate memory for acoustic environment\n\n" );
                    goto cleanup;
                }
            }

            if ( ( error = RenderConfigReader_getAcousticEnvironments( renderConfigReader, pAE ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error while getting acoustic environments\n\n" );
                goto cleanup;
            }

            for ( n = 0; n < aeCount; n++ )
            {
                if ( ( error = IVAS_DEC_AddAcousticEnvironment( hIvasDec, *pAE[n] ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Failed to add acoustic environments\n\n" );
                    goto cleanup;
                }
            }
        }
#endif
        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
@@ -576,7 +637,11 @@ int main(

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
            if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
#else
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
#endif
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
@@ -666,9 +731,17 @@ int main(
    if ( arg.voipMode )
    {
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
#ifdef DECODER_FORMAT_SWITCHING
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &hIvasDec, pcmBuf );
#else
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf );
#endif
#else
#ifdef DDECODER_FORMAT_SWITCHING
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &hIvasDec, pcmBuf );
#else
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf );
#endif
#endif
    }
    else
@@ -704,6 +777,20 @@ cleanup:

    free( pcmBuf );

#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
    if ( pAE != NULL )
    {
        uint16_t n;

        for ( n = 0; n < aeCount; n++ )
        {
            free( pAE[n] );
        }

        free( pAE );
    }
#endif

    if ( arg.aeSequence.count > 0 )
    {
        free( arg.aeSequence.pID );
@@ -2922,7 +3009,11 @@ static ivas_error decodeVoIP(
#ifdef FIX_1119_SPLIT_RENDERING_VOIP
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#endif
#ifdef DECODER_FORMAT_SWITCHING
    IVAS_DEC_HANDLE *phIvasDec,
#else
    IVAS_DEC_HANDLE hIvasDec,
#endif
    int16_t *pcmBuf )
{
    bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */
@@ -2954,6 +3045,9 @@ static ivas_error decodeVoIP(
    int16_t delayNumSamples = -1;
    int32_t delayTimeScale = -1;
    int16_t i;
#ifdef DECODER_FORMAT_SWITCHING
    IVAS_DEC_HANDLE hIvasDec = *phIvasDec;
#endif
#ifdef IVAS_RTPDUMP
    IVAS_RTP ivasRtp = { 0 };
    IVAS_RTP srRtp = { 0 };
@@ -3148,6 +3242,27 @@ static ivas_error decodeVoIP(
    {
        nSamplesRendered = 0;

#ifdef DECODER_FORMAT_SWITCHING
        if ( ivasRtp.restartNeeded )
        {
            IVAS_DEC_MODE newCodecInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
            error = restartDecoder(
                &hIvasDec,
                newCodecInPacket,
                &arg,
                NULL, /* ToDo : Provide rendererConfig */
                NULL  /* ToDo : Provide LS Custom Data */
            );
            if ( error != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newCodecInPacket );
                goto cleanup;
            }
            *phIvasDec = hIvasDec; /* Update for main()' s free */
            ivasRtp.restartNeeded = false;
        }
#endif

        /* reference vector */
        if ( arg.enableReferenceVectorTracking && vec_pos_update == 0 )
        {
@@ -3403,6 +3518,31 @@ static ivas_error decodeVoIP(

                /* Placeholder for memory reallocation */
                /* ... */
#ifdef DECODER_FORMAT_SWITCHING
                if ( IVAS_DEC_isRestartNeeded( hIvasDec ) )
                {
                    IVAS_DEC_BS_FORMAT tempFormat;
                    if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error );
                        goto cleanup;
                    }
                    IVAS_DEC_MODE codecMode = ( tempFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
                    error = restartDecoder(
                        &hIvasDec,
                        codecMode,
                        &arg,
                        NULL, /* ToDo : Provide rendererConfig */
                        NULL  /* ToDo : Provide LS Custom Data */
                    );
                    if ( error != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nFailed to restart decoder\n" );
                        goto cleanup;
                    }
                    *phIvasDec = hIvasDec; /* Update for main()' s free */
                }
#endif

                /* Load HRTF binary file data */
                if ( arg.hrtfReaderEnabled )
@@ -4180,4 +4320,118 @@ static ivas_error load_hrtf_from_file(
    return IVAS_ERR_OK;
}

#ifdef DECODER_FORMAT_SWITCHING

ivas_error restartDecoder(
    IVAS_DEC_HANDLE *phIvasDec,
    IVAS_DEC_MODE codec,
    DecArguments *arg,
    IVAS_RENDER_CONFIG_DATA *renderConfig,
    IVAS_CUSTOM_LS_DATA *hLsCustomData )
{
    ivas_error error = IVAS_ERR_OK;
    IVAS_DEC_HANDLE hIvasDec;

    if ( phIvasDec == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    if ( NULL != *phIvasDec )
    {
        IVAS_DEC_Close( phIvasDec );
    }

    if ( ( error = IVAS_DEC_Open( phIvasDec, codec ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    arg->decMode = codec;

    hIvasDec = *phIvasDec;

    uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : 65535;

    IVAS_AUDIO_CONFIG outputConfig = ( codec == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO;
#ifdef FIX_1318_ROOM_SIZE_CMD_LINE
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg->output_Fs, outputConfig, arg->renderFramesize, arg->customLsOutputEnabled, arg->hrtfReaderEnabled,
                                       arg->enableHeadRotation, arg->enableExternalOrientation, arg->orientation_tracking, arg->renderConfigEnabled, arg->roomSize, arg->non_diegetic_pan_enabled,
                                       arg->non_diegetic_pan_gain_fx, arg->dpidEnabled, aeID, arg->objEditEnabled, arg->delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg->output_Fs, outputConfig, arg->renderFramesize, arg->customLsOutputEnabled, arg->hrtfReaderEnabled,
                                       arg->enableHeadRotation, arg->enableExternalOrientation, arg->orientation_tracking, arg->renderConfigEnabled, arg->non_diegetic_pan_enabled,
                                       arg->non_diegetic_pan_gain_fx, arg->dpidEnabled, aeID, arg->objEditEnabled, arg->delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg->renderFramesize ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

        if ( ( error = IVAS_DEC_GetRenderFramesize( hIvasDec, &arg->renderFramesize ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

        arg->enableHeadRotation = true;
    }

    if ( arg->voipMode )
    {
        if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg->inputFormat ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nCould not enable VOIP: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }

    if ( ( error = IVAS_DEC_PrintConfig( hIvasDec, 1, arg->voipMode ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( arg->renderConfigEnabled && renderConfig != NULL )
    {
        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, *renderConfig ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }

    if ( arg->customLsOutputEnabled && hLsCustomData != NULL )
    {
        if ( ( error = IVAS_DEC_FeedCustomLsData( hIvasDec, *hLsCustomData ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_FeedCustomLsData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }

    return IVAS_ERR_OK;

cleanup:
    IVAS_DEC_Close( phIvasDec );
    return error;
}

#endif

#undef WMC_TOOL_SKIP
+0 −4
Original line number Diff line number Diff line
@@ -420,7 +420,6 @@ static Word16 fcb_table(
    const Word16 L_subfr )
{
    Word16 out;
    // PMT("Not floating point computation, but fixed point operator are still missing ")

    out = PulseConfTable[n].bits;
    move16();
@@ -454,7 +453,6 @@ static ivas_error acelp_FCB_allocator_fx(
    Word16 *p_fixed_cdk_index;
    Word16 max_n;
    ivas_error error;
    // PMT("Not floating point computation, but fixed point operator are still missing ")

    error = IVAS_ERR_OK;
    move32();
@@ -1693,7 +1691,6 @@ static Word16 allocate_unused(
    Word16 max_bit_per_pos = 0, bit_added = 0;
    move16();
    move16();
    // PMT("Not floating point computation, but fixed point operator are still missing ")

    IF( prm_type == GAINSPRM )
    {
@@ -1797,7 +1794,6 @@ Word16 set_ACELP_flag(
    const Word16 cng_type       /* i  : CNG type                    */
)
{
    // PMT("Not floating point computation, but fixed point operator are still missing ")
    test();
    test();
    test();
+3 −0
Original line number Diff line number Diff line
@@ -340,6 +340,9 @@ typedef enum
#endif
typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
{
#ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT
    UWord16 aeID; /* Acoustic environment ID */
#endif
    Word16 nBands;                                                                                                                       /* Number of frequency bands for which reverb properties are provided, integer, range [2..256]        */
    Word32 pFc_input_fx[IVAS_CLDFB_NO_CHANNELS_MAX];                                                                                     /*Q16 Center frequencies for which following values are provided:                                         */
    Word32 pAcoustic_rt60_fx[IVAS_CLDFB_NO_CHANNELS_MAX];                                                                                /*Q26  - The room's T60 per center frequency                                                             */
+0 −4
Original line number Diff line number Diff line
@@ -1811,7 +1811,6 @@ void apply_scale(
)
{
    Word16 i;
    // PMT("Verifiy if the basop ued are ok for stereo too")
    FOR( i = 0; i < scaleTableSize; i++ )
    {
        cast16();
@@ -1844,7 +1843,6 @@ Word16 apply_scale_ind(
)
{
    Word16 i;
    // PMT("Verifiy if the basop ued are ok for stereo too")
    FOR( i = 0; i < scaleTableSize; i++ )
    {
        cast16();
@@ -1872,7 +1870,6 @@ void apply_scale_ivas_fx(
    Word16 *index )
{
    Word16 i;
    // PMT("Verifiy if the basop ued are ok for stereo too")
    FOR( i = 0; i < scaleTableSize; i++ )
    {
        cast16();
@@ -3137,7 +3134,6 @@ void msvq_decoder(
{
    Word16 s, i, offset;

    // PMT("msvq_decoder Not verified")

    offset = i_mult( Idx[0], maxN );
    FOR( i = 0; i < N; i++ )
+0 −12
Original line number Diff line number Diff line
@@ -926,12 +926,6 @@ void ivas_harm_bwe_fx(
        {
            exp1 = add( 1, exp1 );
        }
#ifdef DEBUGGING
        else
        {
            // PMT("VERIFY if this really matches IVAS float")
        }
#endif
        tmp1 = s_max( tmp1, 16384 );
        tmp1 = div_s( 16384, tmp1 );
        L_tmp2 = L_deposit_h( tmp1 );
@@ -1095,12 +1089,6 @@ void harm_bwe_fx(
        {
            exp1 = add( 1, exp1 );
        }
#ifdef DEBUGGING
        else
        {
            // PMT("VERIFY if this really matches IVAS float")
        }
#endif
        tmp1 = s_max( tmp1, 16384 );
        tmp1 = div_s( 16384, tmp1 );        /*Q15*/
        L_tmp2 = L_deposit_h( tmp1 );       /*Q31*/
Loading