Commit c0c0f4a2 authored by sagnowski's avatar sagnowski
Browse files

Merge branch 'main' into 823-cmake-build-fails-with-dinclude_split-1

parents a221eadf 084e3e7f
Loading
Loading
Loading
Loading
Loading
+321 −68
Original line number Diff line number Diff line
@@ -128,16 +128,16 @@ typedef struct
#endif
    IVAS_DEC_COMPLEXITY_LEVEL complexityLevel;
    bool tsmEnabled;
#ifndef NONBE_UNIFIED_DECODING_PATHS
    bool enable5ms;
#else
    IVAS_RENDER_FRAMESIZE renderFramesize;
#endif
#ifdef DEBUGGING
    IVAS_DEC_FORCED_REND_MODE forcedRendMode;
#ifdef DEBUG_FOA_AGC
    FILE *agcBitstream; /* temporary */
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    bool noBadFrameDelay;
    uint16_t frontendFetchSizeMs;
#endif
#ifdef VARIABLE_SPEED_DECODING
    bool tsmScaleFileEnabled;
    char *tsmScaleFileName;
@@ -162,7 +162,12 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotF
#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
#ifndef NONBE_UNIFIED_DECODING_PATHS
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
#else
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
#endif

#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 );
@@ -197,6 +202,9 @@ int main(
    Vector3PairFileReader *referenceVectorReader = NULL;
    RenderConfigReader *renderConfigReader = NULL;
    int16_t *pcmBuf = NULL;
#ifdef NONBE_UNIFIED_DECODING_PATHS
    IVAS_RENDER_FRAMESIZE asked_frame_size;
#endif
#ifdef DEBUGGING
    int32_t noClipping;
    int32_t cnt_frames_limited;
@@ -429,13 +437,32 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation,
                                       arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#ifndef NONBE_UNIFIED_DECODING_PATHS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.enable5ms, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking,
                                       arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    asked_frame_size = arg.renderFramesize;
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain,
                                       arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif

    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }
#ifdef NONBE_UNIFIED_DECODING_PATHS
    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.renderFramesize != asked_frame_size )
    {
        fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for decoding to EXT!\n" );
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Configure Split rendering
     *------------------------------------------------------------------------------------------*/
@@ -443,12 +470,28 @@ int main(
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
#ifdef NONBE_UNIFIED_DECODING_PATHS
        asked_frame_size = arg.renderFramesize;
#endif
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

#ifdef NONBE_UNIFIED_DECODING_PATHS
        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.renderFramesize != asked_frame_size )
        {
            fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for split rendering!\n" );
        }
#endif

        arg.enableHeadRotation = true;
    }
#endif
@@ -602,22 +645,39 @@ int main(
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( arg.enable5ms &&
             ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
#ifdef NONBE_UNIFIED_DECODING_PATHS
        if ( arg.renderFramesize == IVAS_RENDER_FRAMESIZE_5MS && ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
                                                                   renderConfig.split_rend_config.dof == 0 ) )
#else
        if ( arg.enable5ms && ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
                                renderConfig.split_rend_config.dof == 0 ) )
#endif
        {
/*TODO : needs to be refined as this wont work with LCLD codec*/
#ifdef NONBE_UNIFIED_DECODING_PATHS
            arg.renderFramesize = IVAS_RENDER_FRAMESIZE_5MS;
#else
            arg.enable5ms = true;
#endif
        }
        else
        {
            arg.enable5ms = false;
#ifdef NONBE_UNIFIED_DECODING_PATHS
            arg.renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
#else
            arg.enable5ms = true;
#endif
        }

#ifdef NONBE_UNIFIED_DECODING_PATHS
        if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_DEC_Set5msFlag( hIvasDec, arg.enable5ms ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }

#endif

        if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK )
@@ -758,7 +818,11 @@ int main(

    if ( arg.voipMode )
    {
#ifdef NONBE_UNIFIED_DECODING_PATHS
        error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec );
#else
        error = decodeVoIP( arg, hBsReader, hIvasDec );
#endif
    }
    else
    {
@@ -1012,19 +1076,17 @@ static bool parseCmdlIVAS_dec(
    arg->Opt_non_diegetic_pan = 0;
    arg->non_diegetic_pan_gain = 0.f;
    arg->tsmEnabled = false;
#ifndef NONBE_UNIFIED_DECODING_PATHS
    arg->enable5ms = false;
#else
    arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
#endif
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
    arg->tsmScale = 100;
    arg->tsmScaleFileEnabled = false;
    arg->tsmScaleFileName = NULL;
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    arg->frontendFetchSizeMs = JBM_FRONTEND_FETCH_FRAMESIZE_MS;
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    arg->noBadFrameDelay = false;
#endif
#endif
    arg->acousticEnvironmentId = 65535;
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -1156,13 +1218,6 @@ static bool parseCmdlIVAS_dec(
        }
#endif /* #ifdef DEBUG_MODE_INFO_TWEAK */
#endif /* #ifdef DEBUG_MODE_INFO */
#ifdef DEBUG_JBM_CMD_OPTION
        else if ( strcmp( argv_to_upper, "-VOIP_NO_BAD_FRAME" ) == 0 )
        {
            arg->noBadFrameDelay = true;
            i++;
        }
#endif
#ifdef VARIABLE_SPEED_DECODING
        else if ( strcmp( argv_to_upper, "-VS" ) == 0 )
        {
@@ -1196,26 +1251,6 @@ static bool parseCmdlIVAS_dec(
            }
        }
#endif
#ifdef DEBUG_JBM_CMD_OPTION
        else if ( strcmp( argv_to_upper, "-VOIP_FRAMESIZE" ) == 0 )
        {
            i++;
            int32_t tmp;
            if ( i < argc - 3 )
            {
                if ( !is_digits_only( argv[i] ) )
                {
                    return false;
                }

                if ( sscanf( argv[i], "%d", &tmp ) > 0 )
                {
                    i++;
                }
                arg->frontendFetchSizeMs = (uint16_t) tmp;
            }
        }
#endif
#endif /* #ifdef DEBUGGING */

        else if ( strcmp( argv_to_upper, "-MIME" ) == 0 )
@@ -1238,11 +1273,47 @@ static bool parseCmdlIVAS_dec(
            arg->headrotTrajFileName = argv[i];
            i++;
        }
#ifndef NONBE_UNIFIED_DECODING_PATHS
        else if ( strcmp( argv_to_upper, "-FR5" ) == 0 )
        {
            arg->enable5ms = true;
            i++;
        }
#else
        else if ( strcmp( argv_to_upper, "-FR" ) == 0 )
        {
            int32_t tmp;
            i++;
            if ( i < argc - 3 )
            {
                if ( !is_digits_only( argv[i] ) )
                {
                    return false;
                }

                if ( sscanf( argv[i], "%d", &tmp ) > 0 )
                {
                    i++;
                }
                switch ( (int16_t) tmp )
                {
                    case 5:
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_5MS;
                        break;
                    case 10:
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_10MS;
                        break;
                    case 20:
                        arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
                        break;
                    default:
                        fprintf( stderr, "Error: Invalid render frame size %d \n\n", tmp );
                        usage_dec();
                        return false;
                }
            }
        }
#endif
        else if ( strcmp( argv_to_upper, "-OTR" ) == 0 )
        {

@@ -1549,11 +1620,13 @@ static bool parseCmdlIVAS_dec(
        return false;
    }

#ifndef NONBE_UNIFIED_DECODING_PATHS
    if ( ( !arg->enableHeadRotation ) && ( !arg->enableExternalOrientation ) && ( !arg->tsmEnabled ) )
    {
        arg->enable5ms = false;
    }

#endif
    return true;
}

@@ -1591,9 +1664,6 @@ static void usage_dec( void )
    fprintf( stdout, "-VOIP               : VoIP mode: RTP in G192\n" );
    fprintf( stdout, "-VOIP_hf_only=0     : VoIP mode: EVS RTP Payload Format hf_only=0 in rtpdump\n" );
    fprintf( stdout, "-VOIP_hf_only=1     : VoIP mode: EVS RTP Payload Format hf_only=1 in rtpdump\n" );
#ifdef DEBUG_JBM_CMD_OPTION
    fprintf( stdout, "-VOIP_no_bad_frame  : VoIP mode: do not put out bad frames in the beginning as silence \n" );
#endif
    fprintf( stdout, "                      The decoder may read rtpdump files containing TS26.445 Annex A.2.2\n" );
    fprintf( stdout, "                      EVS RTP Payload Format. The SDP parameter hf_only is required.\n" );
    fprintf( stdout, "                      Reading RFC4867 AMR/AMR-WB RTP payload format is not supported.\n" );
@@ -1605,11 +1675,12 @@ static void usage_dec( void )
    fprintf( stdout, "-VS fac             : Variable Speed mode: change speed of playout fac as integer in percent.\n" );
    fprintf( stdout, "                      50 <= fac <= 150; fac<100 faster, fac>100 slower\n" );
#endif
#ifdef DEBUG_JBM_CMD_OPTION
    fprintf( stdout, "-VOIP_framesize     : VoIP mode: acoustic frontend fetch frame size (must be multiples of 5!)\n" );
#endif
#endif
#ifndef NONBE_UNIFIED_DECODING_PATHS
    fprintf( stdout, "-fr5                : option to perform rendering + head-tracking with 5ms frame size\n" );
#else
    fprintf( stdout, "-fr L               : render frame size in ms L=(5,10,20), default is 20)\n" );
#endif
    fprintf( stdout, "-fec_cfg_file       : Optimal channel aware configuration computed by the JBM   \n" );
    fprintf( stdout, "                      as described in Section 6.3.1 of TS26.448. The output is \n" );
    fprintf( stdout, "                      written into a .txt file. Each line contains the FER indicator \n" );
@@ -1690,7 +1761,11 @@ static ivas_error initOnFirstGoodFrame(
    const DecArguments arg,            /* i  : */
    const int16_t numInitialBadFrames, /* i  : */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifdef NONBE_UNIFIED_DECODING_PATHS
    int16_t *numOutSamples, /* i/o: */
#else
    uint16_t *numOutSamples, /* i/o: */
#endif
    int16_t *vec_pos_len, /* i/o: */
#else
    const uint16_t numOutSamples, /* i  : */
@@ -1933,13 +2008,27 @@ static ivas_error initOnFirstGoodFrame(
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( *splitRendWriter != NULL )
    {
#ifndef NONBE_UNIFIED_DECODING_PATHS
        int16_t enable5ms;

#endif
        if ( numOutSamples == NULL || vec_pos_len == NULL )
        {
            return IVAS_ERR_UNEXPECTED_NULL_POINTER;
        }

#ifdef NONBE_UNIFIED_DECODING_PATHS
        /* real setting of the 5ms mode for split rendering is only known after the decoded first good frame, reset the variables needed in the main decoding loop accordingly here*/
        if ( ( error = IVAS_DEC_GetRenderFramesizeSamples( hIvasDec, numOutSamples ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError getting render frame size in samples\n" );
            return error;
        }
        if ( ( error = IVAS_DEC_GetReferencesUpdateFrequency( hIvasDec, vec_pos_len ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError getting render frame size in samples\n" );
            return error;
        }
#else
        if ( ( error = IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -1956,6 +2045,7 @@ static ivas_error initOnFirstGoodFrame(
            *numOutSamples = (int16_t) ( arg.output_Fs / 1000 * DEFAULT_FETCH_FRAMESIZE_MS );
            *vec_pos_len = 1;
        }
#endif
    }
#endif

@@ -1997,7 +2087,7 @@ static ivas_error decodeG192(
    int16_t nOutChannels = 0;
    int16_t delayNumSamples = -1;
    int16_t delayNumSamples_orig[3];
#ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && !defined( NONBE_UNIFIED_DECODING_PATHS )
    uint16_t nOutSamples = 0;
#else
    int16_t nOutSamples = 0;
@@ -2077,6 +2167,18 @@ static ivas_error decodeG192(
    nSamplesAvailableNext = 0;

    vec_pos_update = 0;
#ifdef NONBE_UNIFIED_DECODING_PATHS
    if ( ( error = IVAS_DEC_GetRenderFramesizeSamples( hIvasDec, &nOutSamples ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError getting render frame size in samples\n" );
        return error;
    }
    if ( ( error = IVAS_DEC_GetReferencesUpdateFrequency( hIvasDec, &vec_pos_len ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError getting render frame size in samples\n" );
        return error;
    }
#else
    if ( arg.enableHeadRotation && arg.enable5ms )
    {
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
@@ -2087,6 +2189,7 @@ static ivas_error decodeG192(
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * DEFAULT_FETCH_FRAMESIZE_MS );
        vec_pos_len = 1;
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Loop for every packet (frame) of bitstream data
@@ -2133,6 +2236,7 @@ static ivas_error decodeG192(
            }
        }

#ifndef NONBE_UNIFIED_DECODING_PATHS
        int16_t enable5ms, num_subframes;
        if ( ( error = IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms ) ) != IVAS_ERR_OK )
        {
@@ -2140,7 +2244,14 @@ static ivas_error decodeG192(
        }
        arg.enable5ms = enable5ms;
        num_subframes = ( arg.enable5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;

#else
        int16_t num_subframes;
        if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetNumOrientationSubframes failed: \n" );
            goto cleanup;
        }
#endif
        /* Head-tracking input simulation */
        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
@@ -2795,6 +2906,12 @@ static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer
static ivas_error decodeVoIP(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
#ifdef NONBE_UNIFIED_DECODING_PATHS
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
#endif
    IVAS_DEC_HANDLE hIvasDec )
{
    bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */
@@ -2837,6 +2954,30 @@ static ivas_error decodeVoIP(

    IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN;
    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
#ifdef NONBE_UNIFIED_DECODING_PATHS
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
    int16_t vec_pos_update, vec_pos_len;
    int16_t nOutSamples = 0;
#endif

#ifdef NONBE_UNIFIED_DECODING_PATHS
    vec_pos_update = 0;
    if ( ( error = IVAS_DEC_GetRenderFramesizeMs( hIvasDec, &systemTimeInc_ms ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError getting render frame size in samples\n" );
        return error;
    }
    if ( ( error = IVAS_DEC_GetRenderFramesizeSamples( hIvasDec, &nOutSamples ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError getting render frame size in samples\n" );
        return error;
    }
    if ( ( error = IVAS_DEC_GetReferencesUpdateFrequency( hIvasDec, &vec_pos_len ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError getting render frame size in samples\n" );
        return error;
    }
#endif

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
@@ -2935,23 +3076,138 @@ static ivas_error decodeVoIP(
     * Main receiving/decoding loop
     *------------------------------------------------------------------------------------------*/

#ifdef DEBUG_JBM_CMD_OPTION
    systemTimeInc_ms = arg.frontendFetchSizeMs;
#endif

    while ( 1 )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifndef NONBE_UNIFIED_DECODING_PATHS
#if defined( SPLIT_REND_WITH_HEAD_ROT )
        uint16_t nOutSamples = 0;
#else
        int16_t nOutSamples = 0;
#endif
#ifdef DEBUG_JBM_CMD_OPTION
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs );
#else
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS );
#endif

#ifdef NONBE_UNIFIED_DECODING_PATHS
        /* reference vector */
        if ( arg.enableReferenceVectorTracking && vec_pos_update == 0 )
        {
            IVAS_VECTOR3 listenerPosition, referencePosition;
            if ( ( error = Vector3PairFileReader_read( referenceVectorReader, &listenerPosition, &referencePosition ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading listener and reference positions from %s\n", IVAS_DEC_GetErrorMessage( error ), Vector3PairFileReader_getFilePath( referenceVectorReader ) );
                goto cleanup;
            }

            if ( ( error = IVAS_DEC_FeedRefVectorData( hIvasDec, listenerPosition, referencePosition ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedRefVectorData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }

        /* Reference rotation */
        if ( arg.enableReferenceRotation && vec_pos_update == 0 )
        {
            IVAS_QUATERNION quaternion;
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( refRotReader ) );
                goto cleanup;
            }

            if ( ( error = IVAS_DEC_FeedRefRotData( hIvasDec, quaternion ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedRefRotData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }
        int16_t num_subframes;
        if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetNumOrientationSubframes failed: \n" );
            goto cleanup;
        }

        /* Head-tracking input simulation */
        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( headRotReader == NULL )
            {
                for ( i = 0; i < num_subframes; i++ )
                {
                    Quaternions[i].w = -3.0f;
                    Quaternions[i].x = 0.0f;
                    Quaternions[i].y = 0.0f;
                    Quaternions[i].z = 0.0f;
                    Pos[i].x = 0.0f;
                    Pos[i].y = 0.0f;
                    Pos[i].z = 0.0f;
                }
            }
            else
            {
#endif
                for ( i = 0; i < num_subframes; i++ )
                {
                    if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                                 RotationFileReader_getFilePath( headRotReader ) );
                        goto cleanup;
                    }
                }
#ifdef SPLIT_REND_WITH_HEAD_ROT
            }
#endif

            for ( i = 0; i < num_subframes; i++ )
            {
                if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                           ,
                                                           DEFAULT_AXIS
#endif
                                                           ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }
            }
        }

        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

            for ( i = 0; i < num_subframes; i++ )
            {

                if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternions[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                             RotationFileReader_getFilePath( externalOrientationFileReader ) );
                    goto cleanup;
                }
            }
            for ( i = 0; i < num_subframes; i++ )
            {
                if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternions[i], enableHeadRotation[i], enableExternalOrientation[i], enableRotationInterpolation[i], numFramesToTargetOrientation[i], i ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }
            }
        }
#endif

        /* read all packets with a receive time smaller than the system time */
        while ( nextPacketRcvTime_ms <= systemTime_ms )
        {
@@ -3005,7 +3261,6 @@ static ivas_error decodeVoIP(
        /* decode and get samples */

#ifdef SPLIT_REND_WITH_HEAD_ROT

#ifdef SUPPORT_JBM_TRACEFILE
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK )
#else
@@ -3066,11 +3321,7 @@ static ivas_error decodeVoIP(
                    goto cleanup;
                }
            }
#ifdef DEBUG_JBM_CMD_OPTION
            else if ( arg.noBadFrameDelay == false )
#else
            else
#endif
            {
                ++numInitialBadFrames;
            }
@@ -3144,7 +3395,9 @@ static ivas_error decodeVoIP(
        {
            fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame );
        }

#ifdef NONBE_UNIFIED_DECODING_PATHS
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
#endif
        frame++;
        systemTime_ms += systemTimeInc_ms;

+83 −0

File changed.

Preview size limit exceeded, changes collapsed.

+11 −0
Original line number Diff line number Diff line
@@ -150,6 +150,17 @@ typedef enum

} IVAS_HEAD_ORIENT_TRK_T;

#ifdef NONBE_UNIFIED_DECODING_PATHS
typedef enum
{
    IVAS_RENDER_FRAMESIZE_UNKNOWN = 0,
    IVAS_RENDER_FRAMESIZE_5MS = 1,
    IVAS_RENDER_FRAMESIZE_10MS = 2,
    IVAS_RENDER_FRAMESIZE_20MS = 4

} IVAS_RENDER_FRAMESIZE;
#endif

typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE;

+1 −1
Original line number Diff line number Diff line
@@ -190,6 +190,7 @@ typedef enum
    TC_BUFFER_MODE_BUFFER
} TC_BUFFER_MODE;


/*----------------------------------------------------------------------------------*
 * IVAS Bitrates
 *----------------------------------------------------------------------------------*/
@@ -1213,7 +1214,6 @@ enum
#define MASA_STEREO_MIN_BITRATE                 IVAS_24k4
#define MAXIMUM_OMASA_FREQ_BANDS                8                           /* Corresponds to maximum number of coding bands at 32 kbps */
#define OMASA_STEREO_SW_CNT_MAX                 100

#define MASA_BIT_REDUCT_PARAM                   10
#define MASA_MAXIMUM_TWO_DIR_BANDS              24
#define NBITS_HR_COH                            4
+6 −2

File changed.

Preview size limit exceeded, changes collapsed.

Loading