Commit 139d983f authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

Merge branch 'b_20230817_jbm-for-osba' of...

Merge branch 'b_20230817_jbm-for-osba' of git01.iis.fhg.de:ame/ivas_development/ivas-3gpp-forge-mirror into b_20230817_jbm-for-osba
parents ae599c67 aeaeb648
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@
#endif

#define JBM_FOR_OSBA
#define FIX_COMBINED_FORMATS_ISM_GAINS

/* ### API_5MS switches start ### */
#define API_5MS                                         /* FhG: 5ms rendering capability */
+8 −1
Original line number Diff line number Diff line
@@ -899,6 +899,12 @@ int16_t getNumChanSynthesis(
    if ( st_ivas->sba_dirac_stereo_flag )
    {
        n = CPE_CHANNELS;
#ifdef JBM_FOR_OSBA
        if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
            n += st_ivas->nchan_ism;
        }
#endif
    }
    else if ( ( st_ivas->hMCT != NULL || st_ivas->ivas_format == SBA_FORMAT ) && st_ivas->ivas_format != SBA_ISM_FORMAT )
    {
@@ -1471,6 +1477,8 @@ ivas_error ivas_init_decoder(
        st_ivas->ism_extmeta_active = -1;
        st_ivas->ism_extmeta_cnt = 0;

        st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );

        if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -1519,7 +1527,6 @@ ivas_error ivas_init_decoder(
            ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ),
                                     st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 );
        }
        st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );

        for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
        {
+10 −1
Original line number Diff line number Diff line
@@ -1071,7 +1071,12 @@ void ivas_ism_dec_digest_tc(
         st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ||
         st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ||
         st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ||
         ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->hDecoderConfig->Opt_Headrotation == 0 ) )
         ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->hDecoderConfig->Opt_Headrotation == 0 )
#ifdef JBM_FOR_OSBA
         ||
         st_ivas->renderer_type == RENDERER_OSBA_STEREO
#endif
    )
    {
        int16_t i, num_objects;
        int16_t azimuth, elevation;
@@ -1102,7 +1107,11 @@ void ivas_ism_dec_digest_tc(
            ivas_jbm_dec_get_adapted_linear_interpolator( (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ), st_ivas->hTcBuffer->n_samples_available, st_ivas->hIsmRendererData->interpolator );
        }
        /* also get the gains here */
#ifdef FIX_COMBINED_FORMATS_ISM_GAINS
        num_objects = st_ivas->nchan_ism;
#else
        num_objects = st_ivas->nchan_transport;
#endif
        for ( i = 0; i < num_objects; i++ )
        {
            mvr2r( st_ivas->hIsmRendererData->gains[i], st_ivas->hIsmRendererData->prev_gains[i], MAX_OUTPUT_CHANNELS );
+28 −62
Original line number Diff line number Diff line
@@ -502,7 +502,7 @@ ivas_error ivas_jbm_dec_tc(

            ivas_sba_mix_matrix_determiner( st_ivas->hSpar, &output[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames );
        }
        else if ( st_ivas->renderer_type != RENDERER_DISABLE )
        else if ( st_ivas->renderer_type != RENDERER_DISABLE && !st_ivas->sba_dirac_stereo_flag )
        {
            ivas_spar_dec_agc_pca( st_ivas, &output[sba_ch_idx], output_frame );
        }
@@ -868,6 +868,8 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer(
        {
            ivas_ism_dec_digest_tc( st_ivas );

            if ( !st_ivas->sba_dirac_stereo_flag )
            {
                if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
                {
                    n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size );
@@ -875,6 +877,7 @@ ivas_error ivas_jbm_dec_feed_tc_to_renderer(

                ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
            }
        }
        else
        {
            ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
@@ -1170,52 +1173,15 @@ ivas_error ivas_jbm_dec_render(
                }
            }
            else if ( st_ivas->renderer_type == RENDERER_OSBA_STEREO ||
				      st_ivas->renderer_type == RENDERER_MONO_DOWNMIX 
				)
            {
                int16_t slots_to_render, first_sf, last_sf, subframe_idx, ch;
                uint16_t slot_size, slot_idx_start;

                slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
                slots_to_render = min( st_ivas->hSpar->num_slots - st_ivas->hSpar->slots_rendered, nSamplesAsked / slot_size );
                *nSamplesRendered = slots_to_render * slot_size;
                first_sf = st_ivas->hSpar->subframes_rendered;
                last_sf = first_sf;

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

                for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ )
                {
                    int16_t nchan_ism;
                    int16_t n_samples_sf = slot_size * st_ivas->hSpar->subframe_nbslots[subframe_idx];

					slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
                    slot_idx_start = st_ivas->hSpar->slots_rendered;

                    nchan_ism = st_ivas->nchan_ism;

					p_tc[0] = st_ivas->hTcBuffer->tc[0 + nchan_ism] + slot_idx_start * slot_size;
                    p_tc[1] = st_ivas->hTcBuffer->tc[1 + nchan_ism] + slot_idx_start * slot_size;

					for ( n = 0; n < BINAURAL_CHANNELS; n++ )
                    {
                        int16_t ts;
                        for ( ts = 0; ts < st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered]; ts++ )
                      st_ivas->renderer_type == RENDERER_MONO_DOWNMIX )
            {
							int16_t i;
							for ( i = 0; i < slot_size; i++ )
                *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal );
                /* render objects */
                ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered );
                /* add already rendererd SBA part */
                for ( n = 0; n < nchan_out; n++ )
                {
								p_output[n][i + ts * slot_size + slot_idx_start*slot_size] = p_tc[n][i + ts * slot_size];
							}
						}
                    }

					st_ivas->hSpar->slots_rendered += st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered];
					st_ivas->hSpar->subframes_rendered++;
                    v_add( p_output[n], p_tc[n+st_ivas->nchan_ism], p_output[n], *nSamplesRendered );
                }
            }
            else
+21 −19
Original line number Diff line number Diff line
@@ -236,27 +236,30 @@ ivas_error ivas_spar_dec_open(
        buffer_mode = TC_BUFFER_MODE_RENDERER;
        nchan_tc = ivas_jbm_dec_get_num_tc_channels( st_ivas );
        nchan_to_allocate = num_channels_internal;
#ifdef JBM_FOR_OSBA
        if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
        {
            nchan_to_allocate += st_ivas->nchan_ism;
        }
#endif

#ifdef JBM_FOR_OSBA
        granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS );
#endif

        if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO )

        )
        {
#ifdef JBM_FOR_OSBA
			&& !(st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
            if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
            {
                buffer_mode = TC_BUFFER_MODE_RENDERER;
                nchan_tc = st_ivas->hDecoderConfig->nchan_out + st_ivas->nchan_ism;
                nchan_to_allocate = nchan_tc;
            }
            else
#endif
			)
            {
                buffer_mode = TC_BUFFER_MODE_BUFFER;
                nchan_tc = st_ivas->hDecoderConfig->nchan_out;
                nchan_to_allocate = nchan_tc;
            }
        }
        else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
        {
            nchan_to_allocate = 2 * BINAURAL_CHANNELS;
@@ -1672,8 +1675,7 @@ void ivas_spar_dec_upmixer_sf(
                cldfb_in_ts_re[in_ch][ts],
                cldfb_in_ts_im[in_ch][ts],
                num_cldfb_bands,
				st_ivas->cldfbAnaDec[in_ch] 
			);
                st_ivas->cldfbAnaDec[in_ch] );
        }
    }