Commit c3478cf3 authored by vaclav's avatar vaclav
Browse files

fix

parent 6302b1f3
Loading
Loading
Loading
Loading
Loading
+30 −4
Original line number Diff line number Diff line
@@ -176,14 +176,22 @@ typedef struct
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_FMSW_DEC
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_RENDER_CONFIG_DATA *renderConfig, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf );
#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 );
#ifdef DEBUGGING
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
static int16_t app_own_random( int16_t *seed );
#endif
static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );
#ifdef FIX_FMSW_DEC
static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, const IVAS_DEC_MODE decMode, DecArguments *arg );
#else
static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, const IVAS_DEC_MODE decMode, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData );
#endif


/*------------------------------------------------------------------------------------------*
@@ -775,7 +783,11 @@ int main(

    if ( arg.voipMode )
    {
#ifdef FIX_FMSW_DEC
        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, &renderConfig, &hIvasDec, pcmBuf );
#endif
    }
    else
    {
@@ -3165,7 +3177,9 @@ static ivas_error decodeVoIP(
    Vector3PairFileReader *referenceVectorReader,
    ObjectEditFileReader *objectEditFileReader,
    ISAR_SPLIT_REND_BITS_DATA *splitRendBits,
#ifndef FIX_FMSW_DEC
    IVAS_RENDER_CONFIG_DATA *renderConfig,
#endif
    IVAS_DEC_HANDLE *phIvasDec,
    int16_t *pcmBuf )
{
@@ -3357,6 +3371,9 @@ static ivas_error decodeVoIP(
        if ( ivasRtp.restartNeeded )
        {
            IVAS_DEC_MODE newDecModeInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
#ifdef FIX_FMSW_DEC
            if ( ( error = restartDecoder( &hIvasDec, newDecModeInPacket, &arg ) ) != IVAS_ERR_OK )
#else
            if ( ( error = restartDecoder(
                       &hIvasDec,
                       newDecModeInPacket,
@@ -3364,6 +3381,7 @@ static ivas_error decodeVoIP(
                       renderConfig,
                       NULL /* ToDo : Provide LS Custom Data */
                       ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newDecModeInPacket );
                goto cleanup;
@@ -3609,6 +3627,9 @@ static ivas_error decodeVoIP(
                    }

                    IVAS_DEC_MODE newDecModeInPacket = ( tempBsFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
#ifdef FIX_FMSW_DEC
                    if ( ( error = restartDecoder( &hIvasDec, newDecModeInPacket, &arg ) ) != IVAS_ERR_OK )
#else
                    if ( ( error = restartDecoder(
                               &hIvasDec,
                               newDecModeInPacket,
@@ -3616,6 +3637,7 @@ static ivas_error decodeVoIP(
                               NULL, /* ToDo : Provide rendererConfig */
                               NULL  /* ToDo : Provide LS Custom Data */
                               ) ) != IVAS_ERR_OK )
#endif
                    {
                        fprintf( stderr, "\nFailed to restart decoder\n" );
                        goto cleanup;
@@ -4318,9 +4340,13 @@ static ivas_error load_hrtf_from_file(
static ivas_error restartDecoder(
    IVAS_DEC_HANDLE *phIvasDec,
    const IVAS_DEC_MODE decMode,
    DecArguments *arg,
    DecArguments *arg
#ifndef FIX_FMSW_DEC
    ,
    IVAS_RENDER_CONFIG_DATA *renderConfig,
    IVAS_CUSTOM_LS_DATA *hLsCustomData )
    IVAS_CUSTOM_LS_DATA *hLsCustomData
#endif
)
{
    ivas_error error = IVAS_ERR_OK;
    IVAS_DEC_HANDLE hIvasDec;
@@ -4384,7 +4410,7 @@ static ivas_error restartDecoder(
            goto cleanup;
        }
    }
#endif

    /* ISAR frame size is set from command line, not renderer config file.
     * This will be ignored if output format is not split rendering. */
    if ( renderConfig != NULL )
@@ -4409,7 +4435,7 @@ static ivas_error restartDecoder(
            goto cleanup;
        }
    }

#endif
    return IVAS_ERR_OK;

cleanup:
+1 −1
Original line number Diff line number Diff line
@@ -167,9 +167,9 @@

/* #################### Start NON-BE switches ############################ */
/* any switch which is non-be wrt. TS 26.258 V3.0 */
#define FIX_FMSW_DEC                                    /* float issue 1542: fix JBM issue in format switching */

#define FIX_1543_MID_LSF_BITS                           /* VA: float issue 1543: Resolve "MSAN: use-of-uninitialized-value in lib_enc/lsf_enc.c:262:5 for EVS encoder" */
#define FIX_FMSW_DEC                                    /* float issue 1542: fix JBM issue in format switching */


/* ##################### End NON-BE switches ########################### */
+48 −12
Original line number Diff line number Diff line
@@ -1277,7 +1277,11 @@ ivas_error ivas_init_decoder_front(
     * Allocate and initialize Custom loudspeaker layout handle
     *--------------------------------------------------------------------*/

#ifdef FIX_FMSW_DEC
    if ( st_ivas->hDecoderConfig->Opt_LsCustom && st_ivas->hLsSetupCustom == NULL )
#else
    if ( st_ivas->hDecoderConfig->Opt_LsCustom )
#endif
    {
        if ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK )
        {
@@ -1289,7 +1293,11 @@ ivas_error ivas_init_decoder_front(
     * Allocate and initialize Head-Tracking handle
     *--------------------------------------------------------------------*/

#ifdef FIX_FMSW_DEC
    if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData == NULL )
#else
    if ( st_ivas->hDecoderConfig->Opt_Headrotation )
#endif
    {
        if ( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK )
        {
@@ -1305,7 +1313,11 @@ ivas_error ivas_init_decoder_front(
     * Allocate and initialize external orientation handle
     *--------------------------------------------------------------------*/

#ifdef FIX_FMSW_DEC
    if ( st_ivas->hDecoderConfig->Opt_ExternalOrientation && st_ivas->hExtOrientationData == NULL )
#else
    if ( st_ivas->hDecoderConfig->Opt_ExternalOrientation )
#endif
    {
        if ( ( error = ivas_external_orientation_open( &( st_ivas->hExtOrientationData ), st_ivas->hDecoderConfig->render_num_subframes ) ) != IVAS_ERR_OK )
        {
@@ -1317,7 +1329,11 @@ ivas_error ivas_init_decoder_front(
     * Allocate and initialize combined orientation handle
     *--------------------------------------------------------------------*/

#ifdef FIX_FMSW_DEC
    if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) && st_ivas->hCombinedOrientationData == NULL )
#else
    if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
#endif
    {
        if ( ( error = ivas_combined_orientation_open( &( st_ivas->hCombinedOrientationData ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hDecoderConfig->render_num_subframes ) ) != IVAS_ERR_OK )
        {
@@ -1329,8 +1345,14 @@ ivas_error ivas_init_decoder_front(
     * Allocate and initialize Binaural Renderer configuration handle
     *--------------------------------------------------------------------*/

#ifdef FIX_FMSW_DEC
    if ( ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ||
           ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) ) &&
         st_ivas->hRenderConfig == NULL )
#else
    if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ||
         ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
#endif
    {
        if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK )
        {
@@ -2791,6 +2813,10 @@ void ivas_initialize_handles_dec(
    st_ivas->hMasaIsmData = NULL;
    st_ivas->hSbaIsmData = NULL;

#ifdef FIX_FMSW_DEC
    if ( st_ivas->restartNeeded == 0 )
    {
#endif
        st_ivas->hHeadTrackData = NULL;
        st_ivas->hHrtfTD = NULL;
        st_ivas->hLsSetupCustom = NULL;
@@ -2799,6 +2825,9 @@ void ivas_initialize_handles_dec(
        st_ivas->hCombinedOrientationData = NULL;
        st_ivas->acousticEnvironmentsCount = 0;
        st_ivas->pAcousticEnvironments = NULL;
#ifdef FIX_FMSW_DEC
    }
#endif

    st_ivas->hSplitBinRend = NULL;
    for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
@@ -2966,12 +2995,19 @@ void ivas_destroy_dec(
    /* LS config converter handle */
    ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion );

#ifdef FIX_FMSW_DEC
    if ( st_ivas->restartNeeded == 0 )
    {
#endif
        /* Custom LS configuration handle */
        if ( st_ivas->hLsSetupCustom != NULL )
        {
            free( st_ivas->hLsSetupCustom );
            st_ivas->hLsSetupCustom = NULL;
        }
#ifdef FIX_FMSW_DEC
    }
#endif

    /* Mono downmix structure */
    ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer );
+1 −0
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ ivas_error IVAS_DEC_Open(
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for Decoder config structure" );
        }
        hIvasDec->st_ivas->restartNeeded = 0;
#ifdef FIX_FMSW_DEC
    }
#endif