Commit 21050401 authored by bayers's avatar bayers
Browse files

Merge remote-tracking branch 'remotes/origin/5ms_api_main_merge' into...

Merge remote-tracking branch 'remotes/origin/5ms_api_main_merge' into 500-head-tracking-api-causes-extra-15ms-of-delay
parents 6cf36d1d ab70c281
Loading
Loading
Loading
Loading
Loading
+31 −2
Original line number Diff line number Diff line
@@ -143,6 +143,9 @@ typedef struct
    IVAS_DEC_COMPLEXITY_LEVEL complexityLevel;
#ifdef API_5MS
    bool tsmEnabled;
#ifdef API_5MS_BASELINE
    bool enable5ms;
#endif
#endif
#ifdef DEBUGGING
    IVAS_DEC_FORCED_REND_MODE forcedRendMode;
@@ -439,10 +442,17 @@ int main(
    if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM )
    {
        arg.enableHeadRotation = true;
#ifdef API_5MS_BASELINE
        arg.enable5ms = false;
#endif
    }
#endif
#ifdef API_5MS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.tsmEnabled, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.tsmEnabled,
#ifdef API_5MS_BASELINE
                                       arg.enable5ms,
#endif
                                       arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
@@ -975,6 +985,9 @@ static bool parseCmdlIVAS_dec(
    arg->non_diegetic_pan_gain = 0.f;
#ifdef API_5MS
    arg->tsmEnabled = false;
#ifdef API_5MS_BASELINE
    arg->enable5ms = false;
#endif
#endif
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
@@ -1132,6 +1145,9 @@ static bool parseCmdlIVAS_dec(
            int32_t tmp = 100;
#ifdef API_5MS
            arg->tsmEnabled = true;
#ifdef API_5MS_BASELINE
            arg->enable5ms = true;
#endif
#else
            arg->variableSpeedMode = true;
#endif
@@ -1191,6 +1207,9 @@ static bool parseCmdlIVAS_dec(
        else if ( strcmp( argv_to_upper, "-T" ) == 0 )
        {
            arg->enableHeadRotation = true;
#ifdef API_5MS_BASELINE
            arg->enable5ms = true;
#endif
            i++;

            if ( argc - i <= 4 || argv[i][0] == '-' )
@@ -1915,7 +1934,11 @@ static ivas_error decodeG192(
    nSamplesAvailableNext = 0;

    vec_pos_update = 0;
    if ( arg.enableHeadRotation )
    if ( arg.enableHeadRotation
#ifdef API_5MS_BASELINE
         && arg.enable5ms
#endif
    )
    {
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
        vec_pos_len = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
@@ -1993,6 +2016,12 @@ static ivas_error decodeG192(
                Quaternion.x = 0.0f;
                Quaternion.y = 0.0f;
                Quaternion.z = 0.0f;

#ifdef API_5MS
                Pos.x = 0.0f;
                Pos.y = 0.0f;
                Pos.z = 0.0f;
#endif
            }
            else
            {
+2 −2
Original line number Diff line number Diff line
@@ -305,11 +305,11 @@ void stereo_dmx_evs_close_encoder(
    STEREO_DMX_EVS_ENC_HANDLE *hStereoDmxEVS                    /* i/o: Stereo downmix for EVS encoder handle   */
);

#ifndef API_5MS
#if !defined(API_5MS) || defined (API_5MS_BASELINE) 
ivas_error ivas_dec(
    Decoder_Struct *st_ivas,                                    /* i  : IVAS decoder structure                  */
    int16_t *data                                               /* o  : output synthesis signal                 */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT && !defined(API_5MS)
    ,
    IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits
#endif
+2 −1
Original line number Diff line number Diff line
@@ -164,7 +164,8 @@
#define NONBE_FIX_589_JBM_TC_OFFSETS
#define API_5MS
#ifdef API_5MS
#define JITTER_MEM_OPTIM_RENDERING
/*#define JITTER_MEM_OPTIM_RENDERING*/
#define API_5MS_BASELINE
#endif
#define LIB_REND_FIX_HRTFPARAMBIN_MEMLEAK
// 5 ms branch switches end
+48 −10
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@

#include <stdint.h>
#include "options.h"
#ifndef API_5MS
#if !defined( API_5MS ) || defined( API_5MS_BASELINE )
#include "cnst.h"
#include "ivas_cnst.h"
#include "rom_com.h"
@@ -55,7 +55,7 @@
ivas_error ivas_dec(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure      */
    int16_t *data            /* o  : output synthesis signal     */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT && !defined( API_5MS )
    ,
    IVAS_SPLIT_REND_BITS_HANDLE hSplitRendBits
#endif
@@ -128,7 +128,7 @@ ivas_error ivas_dec(
        return error;
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined SPLIT_REND_WITH_HEAD_ROT && !defined( API_5MS )
    if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
         ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
@@ -236,7 +236,12 @@ ivas_error ivas_dec(

                ivas_param_ism_params_to_masa_param_mapping( st_ivas );

                ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport );
                ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport
#ifdef API_5MS
                                         ,
                                         MAX_PARAM_SPATIAL_SUBFRAMES
#endif
                );
            }
            else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX )
            {
@@ -313,6 +318,10 @@ ivas_error ivas_dec(
            {
                if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM_IR, NULL,
                                                       NULL, NULL, NULL, p_output, output_Fs
#ifdef API_5MS
                                                       ,
                                                       MAX_PARAM_SPATIAL_SUBFRAMES
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                       ,
                                                       0
@@ -490,7 +499,12 @@ ivas_error ivas_dec(
        /* Loudspeakers, Ambisonics or Binaural rendering */
        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
        {
            ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, nchan_remapped );
            ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, nchan_remapped
#ifdef API_5MS
                                     ,
                                     MAX_PARAM_SPATIAL_SUBFRAMES
#endif
            );
        }
        else if ( st_ivas->ivas_format == MASA_FORMAT )
        {
@@ -503,7 +517,12 @@ ivas_error ivas_dec(
            }
            else if ( st_ivas->renderer_type == RENDERER_DIRAC )
            {
                ivas_dirac_dec( st_ivas, output, nchan_remapped );
                ivas_dirac_dec( st_ivas, output, nchan_remapped
#ifdef API_5MS
                                ,
                                MAX_PARAM_SPATIAL_SUBFRAMES
#endif
                );
            }
        }
        else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 )
@@ -592,7 +611,12 @@ ivas_error ivas_dec(
            }
            else
            {
                ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport );
                ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport
#ifdef API_5MS
                                         ,
                                         MAX_PARAM_SPATIAL_SUBFRAMES
#endif
                );
            }
        }
        else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX )
@@ -683,6 +707,10 @@ ivas_error ivas_dec(
#endif
                    if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig,
                                                           st_ivas->hCombinedOrientationData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs
#ifdef API_5MS
                                                           ,
                                                           MAX_PARAM_SPATIAL_SUBFRAMES
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                                           ,
                                                           0
@@ -923,11 +951,21 @@ ivas_error ivas_dec(
            /* Rendering */
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
            {
                ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport );
                ivas_dirac_dec_binaural( st_ivas, st_ivas->hCombinedOrientationData, output, st_ivas->nchan_transport
#ifdef API_5MS
                                         ,
                                         MAX_PARAM_SPATIAL_SUBFRAMES
#endif
                );
            }
            else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) /* rendering to CICPxx and Ambisonics */
            {
                ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport );
                ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport
#ifdef API_5MS
                                ,
                                MAX_PARAM_SPATIAL_SUBFRAMES
#endif
                );

                if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC )
                {
@@ -949,7 +987,7 @@ ivas_error ivas_dec(
    }


#ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && !defined( API_5MS )
    /*split rendering process calls*/
    if ( ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
         ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+4 −0
Original line number Diff line number Diff line
@@ -993,7 +993,11 @@ ivas_error ivas_dirac_dec_config(
    if ( dec_config_flag == DIRAC_OPEN )
    {
#ifdef API_5MS
#ifdef API_5MS_BASELINE
        if ( st_ivas->hDecoderConfig->Opt_5ms && st_ivas->hTcBuffer == NULL )
#else
        if ( st_ivas->hTcBuffer == NULL )
#endif
#else
        if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL )
#endif
Loading