Commit c138b25b authored by bayers's avatar bayers
Browse files

fix split rendering compilation, add a few API functions for render frame size...

fix split rendering compilation, add a few API functions for render frame size handling, add split rendering for JBM and crend and td object renderer
parent f93f72b6
Loading
Loading
Loading
Loading
+86 −15
Original line number Diff line number Diff line
@@ -630,22 +630,39 @@ int main(
        }

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

#ifdef REMOVE_5MS_FLAG
        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 )
@@ -2034,13 +2051,27 @@ static ivas_error initOnFirstGoodFrame(
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( *splitRendWriter != NULL )
    {
#ifndef REMOVE_5MS_FLAG
        int16_t enable5ms;
#endif

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

#ifdef REMOVE_5MS_FLAG
        /* 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;
@@ -2057,6 +2088,7 @@ static ivas_error initOnFirstGoodFrame(
            *numOutSamples = (int16_t) ( arg.output_Fs / 1000 * DEFAULT_FETCH_FRAMESIZE_MS );
            *vec_pos_len = 1;
        }
#endif
    }
#endif

@@ -2179,8 +2211,16 @@ static ivas_error decodeG192(

    vec_pos_update = 0;
#ifdef REMOVE_5MS_FLAG
    nOutSamples = (int16_t) ( arg.output_Fs * arg.renderFramesize / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
    vec_pos_len = (int16_t) ( IVAS_MAX_PARAM_SPATIAL_SUBFRAMES / arg.renderFramesize );
    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 )
    {
@@ -2247,7 +2287,11 @@ static ivas_error decodeG192(
        num_subframes = ( arg.enable5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
#else
        int16_t num_subframes;
        num_subframes = (int16_t) arg.renderFramesize;
        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 */
@@ -2971,8 +3015,29 @@ static ivas_error decodeVoIP(

#ifdef NONBE_UNIFIED_DECODING_PATHS
    vec_pos_update = 0;
    nOutSamples = (int16_t) ( arg.output_Fs * arg.renderFramesize / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
    vec_pos_len = (int16_t) ( IVAS_MAX_PARAM_SPATIAL_SUBFRAMES / arg.renderFramesize );
#ifdef REMOVE_5MS_FLAG
    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 );
        vec_pos_len = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
    }
    else
    {
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * DEFAULT_FETCH_FRAMESIZE_MS );
        vec_pos_len = 1;
    }
#endif
#endif

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -3127,12 +3192,19 @@ static ivas_error decodeVoIP(
        }
#ifndef REMOVE_5MS_FLAG
        int16_t enable5ms, num_subframes;
        IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
        if ( ( error = IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms ) ) != IVAS_ERR_OK )
        {
            return error;
        }
        arg.enable5ms = enable5ms;
        num_subframes = ( arg.enable5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
#else
        int16_t num_subframes;
        num_subframes = (int16_t) arg.renderFramesize;
        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 */
@@ -3270,7 +3342,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
+3 −3
Original line number Diff line number Diff line
@@ -5287,15 +5287,15 @@ void ivas_binRenderer(
    BINAURAL_RENDERER_HANDLE hBinRenderer,                      /* i/o: binaural renderer handle                                */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
    HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData,
#endif
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,       /* i  : combined head and external orientation handle           */
#ifndef NONBE_UNIFIED_DECODING_PATHS
    int16_t subframe_idx,                                       /* i  : subframe index                                          */
#endif
    const int16_t numTimeSlots,                                 /* i  : number of time slots to process                         */
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
    HEAD_TRACK_DATA_HANDLE hPostRendHeadTrackData,
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    float Cldfb_RealBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : Rotated Binaural signals */
    float Cldfb_ImagBuffer_Binaural[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : Rotated Binaural signals */
+1 −1
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */

/*#define SPLIT_REND_WITH_HEAD_ROT */                   /* Dlb,FhG: Split Rendering contributions 21 and 35 */
#define SPLIT_REND_WITH_HEAD_ROT                       /* Dlb,FhG: Split Rendering contributions 21 and 35 */
#ifdef SPLIT_REND_WITH_HEAD_ROT
#define SPLIT_REND_PRED_QUANT_63_PNTS
#define SPLIT_REND_WITH_HEAD_ROT_PARAMBIN               /* Nokia: Issue 623: Split rendering support for parambin renderer */
+9 −1
Original line number Diff line number Diff line
@@ -1646,6 +1646,7 @@ void ivas_binaural_cldfb(
        ivas_binRenderer(
            st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
            &st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
#endif
            st_ivas->hCombinedOrientationData,
#ifndef NONBE_UNIFIED_DECODING_PATHS
@@ -2193,11 +2194,18 @@ void ivas_rend_CldfbMultiBinRendProcess(
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
#ifdef NONBE_UNIFIED_DECODING_PATHS
        ivas_binRenderer( hCldfbRend, pMultiBinPoseData, *pCombinedOrientationData, MAX_PARAM_SPATIAL_SUBFRAMES, &head_track_post, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn );
#else
        ivas_binRenderer( hCldfbRend, pMultiBinPoseData, *pCombinedOrientationData, sf_idx, MAX_PARAM_SPATIAL_SUBFRAMES, &head_track_post, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn );
#endif
#else
#ifdef NONBE_UNIFIED_DECODING_PATHS
        ivas_binRenderer( hCldfbRend, pMultiBinPoseData, *pCombinedOrientationData, MAX_PARAM_SPATIAL_SUBFRAMES, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn );
#else
        ivas_binRenderer( hCldfbRend, pMultiBinPoseData, *pCombinedOrientationData, sf_idx, MAX_PARAM_SPATIAL_SUBFRAMES, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn );
#endif

#endif
        for ( pose_idx = 0; pose_idx < hCldfbRend->numPoses; pose_idx++ )
        {
            for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
+4 −1
Original line number Diff line number Diff line
@@ -259,8 +259,11 @@ static ivas_error ivas_dec_init_split_rend(
    }
#endif

#ifdef REMOVE_5MS_FLAG
    error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->render_framesize == RENDER_FRAMESIZE_5MS );
#else
    error = ivas_split_renderer_open( &st_ivas->hSplitBinRend.splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->Opt_5ms );

#endif
    return error;
}
#endif
Loading