Commit 33d12e41 authored by bayers's avatar bayers
Browse files

fix #982, fix problems with the delay of the discrete objects for OMASA, set...

fix #982, fix problems with the delay of the discrete objects for OMASA, set the correct offset for copying the discrete objects into intermediate buffers in case of unified memory.
parent 296cd9fe
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1219,6 +1219,9 @@ enum
#define MASA_BIT_REDUCT_PARAM                   10
#define MASA_MAXIMUM_TWO_DIR_BANDS              24
#define NBITS_HR_COH                            4
#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
#define OMASA_TDREND_MATCHING_GAIN              0.7943f
#endif

#define MASA_JBM_RINGBUFFER_FRAMES              3

+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@
#define NONBE_FIX_967_ISM_MONO_DMX                            /* FhG: issue 967: accumulating energies in ISM mono DMX */
#define NONBE_FIX_968_ISM_BRIR_WITH_HEADROTATION_5MS_FIX      /* FhG : issue #968: differences between 5ms and 20ms rendering for discrete ISM with BRIR and head rotation*/
#define NONBE_FIX_977_OSBA_GAIN_MISMATCH                      /* Dlb : issue 977 : Output gain mismatch for different bit rates in OSBA */

#define NONBE_FIX_982_OMASA_DELAY_COMP_5MS                     /* FhG : issue #982 : 5ms and 20ms output different for OMASA */
/* ##################### End NON-BE switches ########################### */

/* ################## End DEVELOPMENT switches ######################### */
+2 −0
Original line number Diff line number Diff line
@@ -555,6 +555,7 @@ void ivas_omasa_separate_object_render_jbm(

    for ( obj = 0; obj < num_objects; obj++ )
    {
#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
        /* Delay the signal to match CLDFB delay. Delay the whole buffer with the first rendering call of the stretched buffer. */
        if ( slots_rendered == 0 )
        {
@@ -563,6 +564,7 @@ void ivas_omasa_separate_object_render_jbm(
            tcBufferSize = hSpatParamRendCom->num_slots * hSpatParamRendCom->slot_size;
            delay_signal( input_f[obj], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer[obj], st_ivas->hMasaIsmData->delayBuffer_size );
        }
#endif
        offsetSamples = 0;

        for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ )
+24 −0
Original line number Diff line number Diff line
@@ -904,6 +904,30 @@ void ivas_jbm_dec_feed_tc_to_renderer(
        {
            ivas_ism_dec_digest_tc( st_ivas );
        }
#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_DIRAC )
        {
            int16_t obj, num_objects;
            /* Delay the signal to match CLDFB delay. Delay the whole buffer. */
            num_objects = 0;
            if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
            {
                num_objects = 1;
            }
            else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC )
            {
                num_objects = st_ivas->nchan_ism;
            }
            for ( obj = 0; obj < num_objects; obj++ )
            {
                if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC )
                {
                    v_multc( st_ivas->hTcBuffer->tc[CPE_CHANNELS + obj], OMASA_TDREND_MATCHING_GAIN, st_ivas->hTcBuffer->tc[CPE_CHANNELS + obj], st_ivas->hTcBuffer->n_samples_available );
                }
                delay_signal( st_ivas->hTcBuffer->tc[CPE_CHANNELS + obj], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer[obj], st_ivas->hMasaIsmData->delayBuffer_size );
            }
        }
#endif
    }
    else if ( st_ivas->ivas_format == MC_FORMAT )
    {
+16 −2
Original line number Diff line number Diff line
@@ -46,9 +46,9 @@
/*-------------------------------------------------------------------------
 * Local constants
 *------------------------------------------------------------------------*/

#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
#define OMASA_TDREND_MATCHING_GAIN 0.7943f

#endif
/*-------------------------------------------------------------------*
 * ivas_omasa_data_open()
 *
@@ -595,13 +595,21 @@ void ivas_omasa_dirac_rend_jbm(

    if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
    {
#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
        mvr2r( &output_f[CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[0], nSamplesAsked );
#else
        mvr2r( output_f[CPE_CHANNELS], data_separated_objects[0], nSamplesAsked );
#endif
    }
    else
    {
        for ( n = 0; n < st_ivas->nchan_ism; n++ )
        {
#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
            mvr2r( &output_f[n + CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[n], nSamplesAsked );
#else
            mvr2r( output_f[n + CPE_CHANNELS], data_separated_objects[n], nSamplesAsked );
#endif
        }
    }

@@ -633,16 +641,21 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
{
    int16_t n;
    float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];
#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
    float gain = OMASA_TDREND_MATCHING_GAIN;
#endif
    ivas_error error;
    float *p_sepobj[MAX_NUM_OBJECTS];
#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
    float *tc_local[MAX_TRANSPORT_CHANNELS];
#endif

    for ( n = 0; n < MAX_NUM_OBJECTS; n++ )
    {
        p_sepobj[n] = &data_separated_objects[n][0];
    }

#ifndef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
    /* Delay the object signals to match the CLDFB delay. Delay the whole buffer with the first rendering call of the stretched buffer. */
    if ( st_ivas->hSpatParamRendCom->slots_rendered == 0 )
    {
@@ -657,6 +670,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
            delay_signal( tc_local[n], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size );
        }
    }
#endif

    ivas_dirac_dec_binaural_render( st_ivas, nSamplesAsked, nSamplesRendered, nSamplesAvailable, nchan_transport, output_f );