Commit b28d759a authored by multrus's avatar multrus
Browse files

merge from main

parents 1005d09b 3bb8fda9
Loading
Loading
Loading
Loading
Loading
+49 −3
Original line number Diff line number Diff line
@@ -164,10 +164,16 @@ 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 );
static void do_object_editing_fx( 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


/*------------------------------------------------------------------------------------------*
@@ -668,7 +674,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
    {
@@ -1650,7 +1660,7 @@ static void resetHeadRotation(
        pPos[i].y_fx = 0;
        pPos[i].z_fx = 0;
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
        pPos[i].q_fact = 22;
        pPos[i].q_fact = 31;
#else
        pPos[i].q_fact = 25;
#endif
@@ -2319,6 +2329,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 )
                    {
@@ -2339,6 +2356,7 @@ static ivas_error decodeG192(
                        goto cleanup;
                    }
                    *phIvasDec = hIvasDec; /* Update for main()' s free */
#endif
                }
#endif

@@ -2818,7 +2836,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 )
{
@@ -2974,6 +2994,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 )
    {
@@ -3007,6 +3036,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,
@@ -3021,6 +3058,7 @@ static ivas_error decodeVoIP(
            }

            *phIvasDec = hIvasDec; /* Update for main()' s free */
#endif
            ivasRtp.restartNeeded = false;
            bitstreamReadDone = false;
            parametersAvailableForEditing = false;
@@ -3252,6 +3290,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 )
                    {
@@ -3273,6 +3318,7 @@ static ivas_error decodeVoIP(
                    }

                    *phIvasDec = hIvasDec; /* Update for main()' s free */
#endif
                    bitstreamReadDone = false;
                    parametersAvailableForEditing = false;
                }
@@ -3965,7 +4011,7 @@ static ivas_error load_hrtf_from_file(
    return IVAS_ERR_OK;
}


#ifndef FIX_FMSW_DEC
/*---------------------------------------------------------------------*
 * restartDecoder()
 *
@@ -4070,5 +4116,5 @@ cleanup:

    return error;
}

#endif
#undef WMC_TOOL_SKIP
+26 −2
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@ int main(
        fprintf( stderr, "Opening IVAS encoder failed: %s\n", IVAS_ENC_GetErrorMessage( error ) );
        goto cleanup;
    }

    /*------------------------------------------------------------------------------------------*
     * Open output bitstream file
     *------------------------------------------------------------------------------------------*/
@@ -364,6 +365,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
     *------------------------------------------------------------------------------------------*/
@@ -661,6 +684,7 @@ int main(
        }
    }

#ifndef FIX_FMSW_DEC
    /*------------------------------------------------------------------------------------------*
     * Open remote requests file for rtp packing (E-bytes)
     *------------------------------------------------------------------------------------------*/
@@ -672,7 +696,7 @@ int main(
            goto cleanup;
        }
    }

#endif
    /*------------------------------------------------------------------------------------------*
     * Run the encoder
     *------------------------------------------------------------------------------------------*/
@@ -2133,9 +2157,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" );

+46 −0
Original line number Diff line number Diff line
@@ -1174,7 +1174,53 @@ int main(
        fprintf( stderr, "\nError in Renderer Config Init: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
    }
#ifdef FIX_1452_DEFAULT_REVERB

    if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
        /* Set reverb room size if specified or select based automatically based on default per input formats */
        IVAS_ROOM_SIZE_T selectedReverbRoomSize = args.reverbRoomSize;
        if ( selectedReverbRoomSize == IVAS_ROOM_SIZE_AUTO )
        {
            bool combinedFormat = false;
            selectedReverbRoomSize = IVAS_ROOM_SIZE_MEDIUM;

            /* ISM present with MASA/SBA inputs; treat as combined format */
            if ( args.inConfig.numAudioObjects > 0 && ( args.inConfig.numMasaBuses > 0 || args.inConfig.numAmbisonicsBuses > 0 ) )
            {
                combinedFormat = true;
            }

            if ( combinedFormat )
            {
                selectedReverbRoomSize = IVAS_ROOM_SIZE_MEDIUM;
            }
            else
            {
                /* Only set large if ISM is present alone, MASA and Ambisonic have been checked above */
                if ( args.inConfig.numAudioObjects > 0 && args.inConfig.numMultiChannelBuses == 0 )
                {
                    selectedReverbRoomSize = IVAS_ROOM_SIZE_LARGE;
                }
                /* if only MC is present, set medium; Will not be overridden by the subsequent block */
                else if ( args.inConfig.numMultiChannelBuses > 0 )
                {
                    selectedReverbRoomSize = IVAS_ROOM_SIZE_MEDIUM;
                }
                else if ( args.inConfig.numMasaBuses > 0 || args.inConfig.numAmbisonicsBuses > 0 )
                {
                    selectedReverbRoomSize = IVAS_ROOM_SIZE_SMALL;
                }
            }
        }

        if ( ( error = IVAS_REND_SetReverbRoomSize( hIvasRend, selectedReverbRoomSize ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError setting reverb room size\n" );
            goto cleanup;
        }
    }
#endif

    if ( args.renderConfigFilePath[0] != '\0' )
    {
+7 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@
#include "prot_fx.h"
#include "cnst.h"


#ifndef FIX_2402_SIMPLIFY_ARI_CODEC
/**
 * \brief  31x16 Bit multiply (x*y)
 *
@@ -26,6 +28,7 @@ Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y )

    return z;
}
#endif

/*---------------------------------------------------------------
  Ari 14 bits common routines
@@ -39,6 +42,9 @@ Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y )
 *
 * \return r*c
 */
#ifndef FIX_2402_INLINE_FCT_ARI_CODEC
/* Note: moved to proto_fx.h */

Word32 mul_sbc_14bits(
    Word32 r, /* Q0 */
    Word16 c  /* Q0 */
@@ -57,3 +63,4 @@ Word32 mul_sbc_14bits(

    return ( ret );
}
#endif
+3 −1
Original line number Diff line number Diff line
@@ -163,9 +163,11 @@ typedef struct

typedef struct
{

    float x, y, z;

#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
    Word32 x_fx, y_fx, z_fx; /* Q22, Q22, Q22 */
    Word32 x_fx, y_fx, z_fx; /* q_fact, q_fact, q_fact */
#else
    Word32 x_fx, y_fx, z_fx;
#endif
Loading