Commit fe7d67b9 authored by sagnowski's avatar sagnowski
Browse files

Merge branch 'b_20230601_API_5ms_rendering_bay' into 68-ensure-5ms-framing-capability-in-ivas-rend

parents 6e1fe92f b61cb898
Loading
Loading
Loading
Loading
+30 −21
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ static
#define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20
#ifdef API_5MS
#define HEADROTATION_FETCH_FRAMESIZE_MS 5
#define DEFAULT_FETCH_FRAMESIZE_MS      20
#endif

typedef struct
@@ -1734,7 +1735,7 @@ static ivas_error decodeG192(
    }
    else
    {
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * VARIABLE_SPEED_FETCH_FRAMESIZE_MS );
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * DEFAULT_FETCH_FRAMESIZE_MS );
        vec_pos_len = 1;
    }
    /*------------------------------------------------------------------------------------------*
@@ -1782,45 +1783,45 @@ static ivas_error decodeG192(
            }
        }

        if ( arg.enableExternalOrientation )
        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
            IVAS_QUATERNION Quaternion;
            int8_t enableHeadRotation;
            int8_t enableExternalOrientation;
            int8_t enableRotationInterpolation;
            int16_t numFramesToTargetOrientation;


            if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternion, &enableHeadRotation, &enableExternalOrientation, &enableRotationInterpolation, &numFramesToTargetOrientation ) ) != IVAS_ERR_OK )
            if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                         RotationFileReader_getFilePath( externalOrientationFileReader ) );
                fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                goto cleanup;
            }


            if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternion, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternion;
            int8_t enableHeadRotation;
            int8_t enableExternalOrientation;
            int8_t enableRotationInterpolation;
            int16_t numFramesToTargetOrientation;

            if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos ) ) != IVAS_ERR_OK )

            if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternion, &enableHeadRotation, &enableExternalOrientation, &enableRotationInterpolation, &numFramesToTargetOrientation ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                         RotationFileReader_getFilePath( externalOrientationFileReader ) );
                goto cleanup;
            }


            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternion, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }
@@ -2201,7 +2202,11 @@ cleanup:

    AudioFileWriter_close( &afWriter );
    MasaFileWriter_close( &masaWriter );
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
    TsmScaleFileReader_close( &tsmScaleFileReader );
#endif
#endif
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; i++ )
    {
        IsmFileWriter_close( &ismWriters[i] );
@@ -3325,7 +3330,11 @@ static ivas_error decodeVariableSpeed(
                        fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename );
                        goto cleanup;
                    }
#ifdef API_5MS
                    IVAS_DEC_VoIP_SetScale( hIvasDec, scale, scale );
#else
                    IVAS_DEC_VoIP_SetScale( hIvasDec, scale );
#endif
                }

                if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK )
@@ -3581,7 +3590,7 @@ static ivas_error decodeVariableSpeed(
        }

        /* decode and get samples */
        if ( ( error = IVAS_DEC_VoIP_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesAvailableNext, &nSamplesFlushed ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesAvailableNext, &nSamplesFlushed ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
+2 −0
Original line number Diff line number Diff line
@@ -308,10 +308,12 @@ void stereo_dmx_evs_close_encoder(
    STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS                    /* i/o: Stereo downmix for EVS encoder handle   */
);

#ifndef API_5MS
ivas_error ivas_dec(
    Decoder_Struct *st_ivas,                                    /* i  : IVAS decoder structure                  */
    int16_t *data                                               /* o  : output synthesis signal                 */
);
#endif

ivas_error ivas_dec_setup(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
+2 −0
Original line number Diff line number Diff line
@@ -156,6 +156,8 @@

#define FIX_XXX_JITTER_SBA_BINAURAL_GAIN
#define FIX_XXX_HEADTRACKER_INIT
#define FIX_XXX_TDOBJRENDERER_INPUT
#define FIX_XXX_ISM_SBA_ASAN
#define API_5MS

/* ################## End DEVELOPMENT switches ######################### */
+2 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@

#include <stdint.h>
#include "options.h"
#ifndef API_5MS
#include "cnst.h"
#include "ivas_cnst.h"
#include "rom_com.h"
@@ -755,3 +756,4 @@ ivas_error ivas_dec(
    pop_wmops();
    return error;
}
#endif
 No newline at end of file
+25 −1
Original line number Diff line number Diff line
@@ -477,6 +477,21 @@ ivas_error ivas_jbm_dec_tc(
                ivas_mono_stereo_downmix_mcmasa( st_ivas, output, output_frame );
            }
        }
#ifdef API_5MS
        else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
        {

            /* at least decode everything here, the rest is ToDo, for this we just output zeroes atm */
            ivas_lfe_dec( st_ivas->hLFE, st, output_frame, st_ivas->bfi, output_lfe_ch );

            ivas_mc_paramupmix_dec_read_BS( st_ivas, st, st_ivas->hMCParamUpmix, &nb_bits_metadata[0] );

            if ( ( error = ivas_mct_dec( st_ivas, output, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#endif
    }


@@ -846,7 +861,13 @@ ivas_error ivas_jbm_dec_render(
#ifdef API_5MS
        else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
        {
            return IVAS_ERR_NOT_IMPLEMENTED;
            /* zero output for now, not yet implemented...  */
            int16_t ch;
            *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal );
            for ( ch = 0; ch < nchan_out; ch++ )
            {
                set_zero( p_output[ch], *nSamplesRendered );
            }
        }
#endif
        else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
@@ -1645,6 +1666,9 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
        n_samp_full = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
        n_samp_residual = 0;
    }
#else
    n_samp_full = ( NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_L_FRAME_NS ) + hTcBuffer->n_samples_granularity - 1 );
    n_samp_residual = hTcBuffer->n_samples_granularity - 1;
#endif
    nsamp_to_allocate = hTcBuffer->nchan_buffer_full * n_samp_full;
    nsamp_to_allocate += nchan_residual * n_samp_residual;
Loading