Commit 38c961d3 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

Merge branch 'main' into basop-2095-remove-unused-isar-tables

parents bbbd2962 3c80a6ef
Loading
Loading
Loading
Loading
Loading
+48 −1
Original line number Diff line number Diff line
@@ -180,14 +180,20 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS
#else
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 );
#endif
#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 );
#ifndef FIX_FMSW_DEC
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


/*------------------------------------------------------------------------------------------*
@@ -779,7 +785,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
    {
@@ -2627,6 +2637,13 @@ static ivas_error decodeG192(

                if ( restartNeeded )
                {
#ifdef FIX_FMSW_DEC
                    if ( ( error = IVAS_DEC_Restart( hIvasDec, IVAS_DEC_MODE_IVAS ) ) != IVAS_ERR_OK ) /* note: only switching within IVAS formats is supported in G.192 */
                    {
                        fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
                    }
#else
                    IVAS_DEC_BS_FORMAT tempFormat;
                    if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != IVAS_ERR_OK )
                    {
@@ -2647,6 +2664,7 @@ static ivas_error decodeG192(
                        goto cleanup;
                    }
                    *phIvasDec = hIvasDec; /* Update for main()' s free */
#endif
                }
#endif

@@ -3221,7 +3239,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 )
{
@@ -3379,6 +3399,15 @@ static ivas_error decodeVoIP(

        /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */
        rtpTimeStamp = rtpTimeStamp / 16;

#ifdef FIX_FMSW_DEC_2
        arg.decMode = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
        if ( ( error = IVAS_DEC_Restart( hIvasDec, arg.decMode ) ) != IVAS_ERR_OK ) /* note: when the RTP bitstream starts with EVS, do the restart */
        {
            fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
#endif
    }
    if ( error != IVAS_ERR_OK )
    {
@@ -3412,6 +3441,14 @@ static ivas_error decodeVoIP(
        /* restart decoder in case of format switching */
        if ( ivasRtp.restartNeeded )
        {
#ifdef FIX_FMSW_DEC
            arg.decMode = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
            if ( ( error = IVAS_DEC_Restart( hIvasDec, arg.decMode ) ) != IVAS_ERR_OK ) /* note: switching between EVS and IVAS is supported in RTP */
            {
                fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
#else
            IVAS_DEC_MODE newDecModeInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS;
            if ( ( error = restartDecoder(
                       &hIvasDec,
@@ -3426,6 +3463,7 @@ static ivas_error decodeVoIP(
            }

            *phIvasDec = hIvasDec; /* Update for main()' s free */
#endif
            ivasRtp.restartNeeded = false;
            bitstreamReadDone = false;
            parametersAvailableForEditing = false;
@@ -3657,6 +3695,13 @@ static ivas_error decodeVoIP(

                if ( restartNeeded )
                {
#ifdef FIX_FMSW_DEC
                    if ( ( error = IVAS_DEC_Restart( hIvasDec, IVAS_DEC_MODE_IVAS ) ) != IVAS_ERR_OK ) /* note: only switching within IVAS formats is supported in non-RTP VoIP */
                    {
                        fprintf( stderr, "\nIVAS_DEC_Restart restart failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
                    }
#else
                    IVAS_DEC_BS_FORMAT tempBsFormat;
                    if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempBsFormat ) ) != IVAS_ERR_OK )
                    {
@@ -3677,6 +3722,7 @@ static ivas_error decodeVoIP(
                        goto cleanup;
                    }
                    *phIvasDec = hIvasDec; /* Update for main()' s free */
#endif
                    bitstreamReadDone = false;
                    parametersAvailableForEditing = false;
                }
@@ -4364,7 +4410,7 @@ static ivas_error load_hrtf_from_file(
    return IVAS_ERR_OK;
}


#ifndef FIX_FMSW_DEC
/*---------------------------------------------------------------------*
 * restartDecoder()
 *
@@ -4469,4 +4515,5 @@ cleanup:
    return error;
}

#endif
#undef WMC_TOOL_SKIP
+27 −2
Original line number Diff line number Diff line
@@ -369,6 +369,28 @@ int main(
        }
    }

#ifdef FIX_FMSW_DEC
    /*------------------------------------------------------------------------------------------*
     * Open remote requests file for rtp packing (E-bytes)
     *------------------------------------------------------------------------------------------*/

    if ( arg.requestsFileName != NULL )
    {
        if ( !arg.rtpdumpOutput )
        {
            fprintf( stderr, "\nError: RTP requests file can be used with rtpdump output only.\n\n" );
            usage_enc();
            goto cleanup;
        }

        if ( ( error = RequestsFileReader_open( arg.requestsFileName, &requestsFileReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError: Can't open requests file %s \n\n", arg.requestsFileName );
            goto cleanup;
        }
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Handle Channel-aware mode
     *------------------------------------------------------------------------------------------*/
@@ -666,6 +688,8 @@ int main(
        }
    }

#ifndef FIX_FMSW_DEC
#ifdef FIX_1527_CMR_BITRATE_IDX
    /*------------------------------------------------------------------------------------------*
     * Open remote requests file for rtp packing (E-bytes)
     *------------------------------------------------------------------------------------------*/
@@ -677,7 +701,8 @@ int main(
            goto cleanup;
        }
    }

#endif
#endif
    /*------------------------------------------------------------------------------------------*
     * Run the encoder
     *------------------------------------------------------------------------------------------*/
@@ -2196,9 +2221,9 @@ static void usage_enc( void )
    fprintf( stdout, "                      bitstream frames into TS26.253 Annex A IVAS RTP Payload Format packets and \n" );
    fprintf( stdout, "                      writes those to the output file. In EVS mono operating mode, TS26.445 Annex A.2.2 \n" );
    fprintf( stdout, "                      EVS RTP Payload Format is used. Optional N represents number of frames per RTP packet\n" );
    fprintf( stdout, "-requests           : Remote requests file, Only used with rtpdump output.\n" );
    fprintf( stdout, "-scene_orientation  : Scene orientation trajectory file. Only used with rtpdump output.\n" );
    fprintf( stdout, "-device_orientation : Device orientation trajectory file. Only used with rtpdump output.\n" );
    fprintf( stdout, "-requests           : Remote requests file, Only used with rtpdump output.\n" );

    fprintf( stdout, "\n" );

+4 −0
Original line number Diff line number Diff line
@@ -434,7 +434,11 @@ void destroy_core_dec(
);

void ivas_destroy_dec(
#ifdef FIX_FMSW_DEC
    Decoder_Struct **st_ivas                                    /* i/o: IVAS decoder structure                  */
#else
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
#endif
);

void ivas_initialize_handles_dec(
+2 −0
Original line number Diff line number Diff line
@@ -179,6 +179,8 @@
#define FIX_FLOAT_1573_POSITION_UPDATE                  /* Eri: Float issue 1573: For static orientation and listener movement, the PoseUpdated flag is cleared and prevents 5 ms update rate. */
#define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE  /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */
#define FIX_1452_DEFAULT_REVERB                         /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */
#define FIX_FMSW_DEC                                    /* float issue 1542: fix JBM issue in format switching */
#define FIX_FMSW_DEC_2                                  /* float issue 1575: fix crash for format switching when bitsream starts with EVS */

/* ##################### End NON-BE switches ########################### */

+103 −26
Original line number Diff line number Diff line
@@ -1330,7 +1330,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 )
        {
@@ -1342,7 +1346,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 )
        {
@@ -1358,7 +1366,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 )
        {
@@ -1370,7 +1382,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 )
        {
@@ -1382,8 +1398,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 )
        {
@@ -2792,7 +2814,14 @@ void ivas_initialize_handles_dec(
        st_ivas->hCPE[i] = NULL;
    }

#ifdef FIX_FMSW_DEC
    if ( !st_ivas->restartNeeded )
    {
#endif
        st_ivas->bit_stream = NULL;
#ifdef FIX_FMSW_DEC
    }
#endif
    st_ivas->mem_hp20_out = NULL;
    st_ivas->hLimiter = NULL;

@@ -2837,6 +2866,10 @@ void ivas_initialize_handles_dec(
    st_ivas->hMasaIsmData = NULL;
    st_ivas->hSbaIsmData = NULL;

#ifdef FIX_FMSW_DEC
    if ( !st_ivas->restartNeeded )
    {
#endif
        st_ivas->hHeadTrackData = NULL;
        st_ivas->hHrtfTD = NULL;
        st_ivas->hLsSetupCustom = NULL;
@@ -2845,6 +2878,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 )
@@ -2872,10 +2908,17 @@ void ivas_initialize_handles_dec(
 *-------------------------------------------------------------------------*/

void ivas_destroy_dec(
#ifdef FIX_FMSW_DEC
    Decoder_Struct **st_ivas_out /* i/o: IVAS decoder handle      */
#else
    Decoder_Struct *st_ivas /* i/o: IVAS decoder handle      */
#endif
)
{
    int16_t i;
#ifdef FIX_FMSW_DEC
    Decoder_Struct *st_ivas = *st_ivas_out;
#endif

    /* CLDFB handles */
    for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
@@ -3005,12 +3048,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 )
    {
#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 );
@@ -3047,6 +3097,13 @@ void ivas_destroy_dec(
    /* HRTF statistics */
    ivas_HRTF_statistics_binary_close( &st_ivas->hHrtfStatistics );

#ifdef FIX_FMSW_DEC
    /* Limiter struct */
    ivas_limiter_close( &( st_ivas->hLimiter ) );

    if ( !st_ivas->restartNeeded )
    {
#endif
        /* Config. Renderer */
        ivas_render_config_close( &( st_ivas->hRenderConfig ) );

@@ -3057,15 +3114,27 @@ void ivas_destroy_dec(
            st_ivas->pAcousticEnvironments = NULL;
        }

#ifndef FIX_FMSW_DEC
        /* Limiter struct */
        ivas_limiter_close( &( st_ivas->hLimiter ) );

#endif
        /* Decoder configuration structure */
        if ( st_ivas->hDecoderConfig != NULL )
        {
            free( st_ivas->hDecoderConfig );
            st_ivas->hDecoderConfig = NULL;
        }
#ifdef FIX_FMSW_DEC
    }
    else
    {
        /* resets in case of format switching */
        st_ivas->nchan_ism = 0;
        st_ivas->ism_mode = ISM_MODE_NONE;
        st_ivas->mc_mode = MC_MODE_NONE;
        st_ivas->sba_dirac_stereo_flag = 0;
    }
#endif

    /* TC buffer structure */
    ivas_dec_tc_buffer_close( &st_ivas->hTcBuffer );
@@ -3083,7 +3152,15 @@ void ivas_destroy_dec(
    }

    /* main IVAS handle */
#ifdef FIX_FMSW_DEC
    if ( !st_ivas->restartNeeded )
    {
        free( *st_ivas_out );
        *st_ivas_out = NULL;
    }
#else
    free( st_ivas );
#endif

    return;
}
Loading