Commit 5b2b2dba authored by bayers's avatar bayers
Browse files

Merge branch '500-head-tracking-api-causes-extra-15ms-of-delay' of...

Merge branch '500-head-tracking-api-causes-extra-15ms-of-delay' of forge.3gpp.org:ivas-codec-pc/ivas-codec into 500-head-tracking-api-causes-extra-15ms-of-delay
parents 6d2d339b 3c5bad06
Loading
Loading
Loading
Loading
+43 −1
Original line number Diff line number Diff line
@@ -435,6 +435,48 @@ int main(
        }
    }

#ifdef API_5MS
    /*-------------------------------------------------------------------*
     * Load renderer configuration from file
     *--------------------------------------------------------------------*/

    IVAS_RENDER_CONFIG_DATA renderConfig;
    if ( arg.renderConfigEnabled )
    {
        /* sanity check */
#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB &&
             arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED &&
             arg.outputFormat != IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM )
        {
            fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" );
            exit( -1 );
        }
#else
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_IR && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM_REVERB )
        {
            fprintf( stderr, "\nExternal Renderer Config is supported only for binaural output configurations. Exiting. \n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = IVAS_DEC_GetDefaultRenderConfig( &renderConfig ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nIVAS_DEC_GetDefaultRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

        if ( RenderConfigReader_read( renderConfigReader, &renderConfig ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
            goto cleanup;
        }
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------*
 * Configure the decoder
 *------------------------------------------------------------------------------------------*/
@@ -444,7 +486,7 @@ int main(
    {
        arg.enableHeadRotation = true;
#ifdef API_5MS_BASELINE
        arg.enable5ms = false;
        arg.enable5ms = renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE || renderConfig.split_rend_config.dof == 0;
#endif
    }
#endif
+6 −0
Original line number Diff line number Diff line
@@ -132,6 +132,9 @@ typedef struct ivas_split_rend_bits_t
    int32_t buf_len; /*size of bits_buf in bytes. This field should be set by allocator of bits_buf*/
    int32_t bits_written;
    int32_t bits_read;
#ifdef API_5MS
    int16_t codec_frame_size_ms; /* TODO complete implementation */
#endif
    IVAS_SPLIT_REND_CODEC codec;
    IVAS_SPLIT_REND_POSE_CORRECTION_MODE pose_correction;
} ivas_split_rend_bits_t, IVAS_SPLIT_REND_BITS, *IVAS_SPLIT_REND_BITS_HANDLE;
@@ -202,6 +205,9 @@ typedef struct _IVAS_SPLIT_REND_CONFIG
                              3 - (3dof correction. By default YAW, PITCH and ROLL correction)
                              */
    int16_t codec_delay_ms;   /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/
#ifdef API_5MS
    int16_t codec_frame_size_ms; /*Codec frame size in milliseconds, only relevant with LC3plus */
#endif
    IVAS_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
    IVAS_SPLIT_REND_CODEC codec;
    IVAS_SPLIT_REND_RENDERER_SELECTION rendererSelection;
+1 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@
#define FIX_XXX_JBM_USAN                                /* FhG: fix usan in acessing transport channel buffers */
#define FIX_XXX_PARAMISM_JBM_ENER_CORRECTION            /* FhG: fix energy correction in ParamISM rendering */
#define NONBE_FIX_589_JBM_TC_OFFSETS
#define FIX_JBM_MC2SBA                                  /* FhG: fix check for transport vs. internal channel count in JBM prior to ivas_mc2sba() */
#define API_5MS                                         /* FhG: 5ms rendering capability */
#ifdef API_5MS 
#define API_5MS_BASELINE                                /* FhG: baseline with 20ms rendering and split rendering through 20ms branch */
+10 −0
Original line number Diff line number Diff line
@@ -2162,6 +2162,10 @@ void ivas_initialize_handles_dec(
    st_ivas->splitBinRend.hMultiBinCldfbData = NULL;
    st_ivas->splitBinRend.hSplitRendBits = NULL;
    st_ivas->splitBinRend.hCldfbDataOut = NULL;
#ifdef API_5MS
    st_ivas->splitBinRend.tdDataOut = NULL;
    st_ivas->splitBinRend.numTdSamplesPerChannelCached = 0;
#endif
    ivas_init_split_rend_handles( &st_ivas->splitBinRend.splitrend );
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
@@ -2343,6 +2347,12 @@ void ivas_destroy_dec(
    {
        free( st_ivas->splitBinRend.hCldfbDataOut );
    }
#ifdef API_5MS
    if ( st_ivas->splitBinRend.tdDataOut != NULL )
    {
        free( st_ivas->splitBinRend.tdDataOut );
    }
#endif
#endif

    /* Parametric binaural renderer handle */
+35 −4
Original line number Diff line number Diff line
@@ -370,7 +370,14 @@ ivas_error ivas_jbm_dec_tc(

            if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) )
            {
                if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) <= ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) )
                if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe )
#ifdef FIX_JBM_MC2SBA
                     >=
#else
                     <=
#endif
                     ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) )

                {
                    ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE );
                }
@@ -941,10 +948,21 @@ ivas_error ivas_jbm_dec_render(
    {
        if ( st_ivas->mc_mode == MC_MODE_MCT )
        {
#ifdef FIX_JBM_MC2SBA
            int16_t crendInPlaceRotation = FALSE;
#endif
            *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal );
            if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) )
            {
#ifdef FIX_JBM_MC2SBA
                if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) )
                {
                    crendInPlaceRotation = TRUE;
#endif
                    ivas_mc2sba( st_ivas->hTransSetup, p_tc, p_output, *nSamplesRendered, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE );
#ifdef FIX_JBM_MC2SBA
                }
#endif
            }

            /* Rendering */
@@ -952,7 +970,14 @@ ivas_error ivas_jbm_dec_render(
            {
                if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig,
                                                               st_ivas->hCombinedOrientationData,
                                                               &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, p_tc, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK )
                                                               &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer,
#ifdef FIX_JBM_MC2SBA
                                                               crendInPlaceRotation ? p_output : p_tc,
#else
                                                               p_tc,
#endif
                                                               p_output,
                                                               *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
@@ -1637,7 +1662,13 @@ int16_t ivas_jbm_dec_get_num_tc_channels(
            /* do all static dmx already in the TC decoder if less channels than transported... */
            if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) )
            {
                if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) > ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) )
                if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe )
#ifdef FIX_JBM_MC2SBA
                     >=
#else
                     >
#endif
                     ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) )
                {
                    num_tc = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe;
                }
Loading