Commit bbe9444f authored by bayers's avatar bayers
Browse files

moved changes for the ISM BRIR rendering to explixit MR, connected to #968

parent 745f55ee
Loading
Loading
Loading
Loading
+35 −109
Original line number Diff line number Diff line
@@ -254,71 +254,31 @@ void ivas_ism_render_sf(
    int16_t tc_offset;
    int16_t interp_offset;
    float gain, prev_gain;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    int16_t ism_md_subframe_update_jbm, slots_to_render, first_sf, last_sf, subframe_idx;
    int16_t n_samples_rendered_loop;
#endif

    num_objects = st_ivas->nchan_transport;
    if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
        num_objects = st_ivas->nchan_ism;
    }
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */
    slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_to_render / st_ivas->hTcBuffer->n_samples_granularity );
    first_sf = st_ivas->hTcBuffer->subframes_rendered;
    last_sf = first_sf;
    n_samples_rendered_loop = 0;

    while ( slots_to_render > 0 )
    {
        slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf];
        last_sf++;
    }

#endif
    nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;

    tc_offset = st_ivas->hTcBuffer->n_samples_rendered;
    interp_offset = st_ivas->hTcBuffer->n_samples_rendered;

#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    /* Number of subframes to delay metadata to sync with audio */
    if ( st_ivas->hDecoderConfig->Opt_delay_comp )
    {
        ism_md_subframe_update_jbm = max( 0, st_ivas->hTcBuffer->nb_subframes - 3 );
    }
    else
    {
        ism_md_subframe_update_jbm = st_ivas->hTcBuffer->nb_subframes - 2;
    }

#endif
    for ( i = 0; i < nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ )
    {
        set_f( output_f[i], 0.0f, n_samples_to_render );
    }

#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ )
    {
        int16_t n_samples_in_subframe;

        n_samples_in_subframe = st_ivas->hTcBuffer->n_samples_granularity * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx];
#endif

#ifdef NONBE_UNIFIED_DECODING_PATHS
    if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] == 1 )
#else
    if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] )
#endif
    {
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
            ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_in_subframe, n_samples_in_subframe, st_ivas->hIsmRendererData->interpolator );
#else
        ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator );
#endif
        interp_offset = 0;
    }

@@ -331,18 +291,7 @@ void ivas_ism_render_sf(
        if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
#endif
        {
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
                if ( subframe_idx >= ism_md_subframe_update_jbm )
                {
                    rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx], st_ivas->hIntSetup.is_planar_setup );
                }
                else
                {
                    rotateAziEle( st_ivas->hIsmMetaData[i]->last_azimuth, st_ivas->hIsmMetaData[i]->last_elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx], st_ivas->hIntSetup.is_planar_setup );
                }
#else
            rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup );
#endif

            if ( st_ivas->hEFAPdata != NULL )
            {
@@ -364,18 +313,10 @@ void ivas_ism_render_sf(
            {
                g1 = &st_ivas->hIsmRendererData->interpolator[interp_offset];
                tc = &st_ivas->hTcBuffer->tc[i][tc_offset];
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
                    for ( k = 0; k < n_samples_in_subframe; k++ )
#else
                for ( k = 0; k < n_samples_to_render; k++ )
#endif
                {
                    g2 = 1.0f - *g1;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
                        output_f[j2][k + n_samples_rendered_loop] += ( *( g1++ ) * gain + g2 * prev_gain ) * *( tc++ );
#else
                    output_f[j2][k] += ( *( g1++ ) * gain + g2 * prev_gain ) * *( tc++ );
#endif
                }
            }

@@ -393,23 +334,8 @@ void ivas_ism_render_sf(

#ifdef NONBE_UNIFIED_DECODING_PATHS
    /* update combined orientation access index */
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
        ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_in_subframe );
#else
    ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_to_render );
#endif
#endif
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
        n_samples_rendered_loop += n_samples_in_subframe;
        if ( st_ivas->renderer_type == RENDERER_TD_PANNING )
        {
            st_ivas->hTcBuffer->subframes_rendered += 1;
            st_ivas->hTcBuffer->slots_rendered += st_ivas->hTcBuffer->subframe_nbslots[subframe_idx];
        }
        tc_offset += n_samples_in_subframe;
        interp_offset += n_samples_in_subframe;
    }
#endif

    return;
}