Commit 4d99621d authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

implement OSBA output to BINAURAL_ROOM_IR in JBM path

parent 04464059
Loading
Loading
Loading
Loading
+85 −0
Original line number Diff line number Diff line
@@ -2401,6 +2401,91 @@ void ivas_dirac_dec_render_sf(

    if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
    {

#ifdef JBM_FOR_OSBA
		/* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */
        if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
        {
            int16_t in_ch;
            for ( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ )
            {
                int16_t i, j, k, j2, l;
                float *g1, g2;
                int16_t num_objects, nchan_out_woLFE, lfe_index;
                int16_t azimuth, elevation;
                int16_t tc_offset;
                int16_t n_slots_to_render;
                int16_t n_samples_to_render;
                int16_t interp_offset;
                float gain, prev_gain;
                num_objects = st_ivas->nchan_ism;
                nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
                n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered];
                n_samples_to_render = hSpatParamRendCom->num_freq_bands * n_slots_to_render;
                tc_offset = st_ivas->hTcBuffer->n_samples_rendered;
                interp_offset = st_ivas->hTcBuffer->n_samples_rendered;
                
				if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] )
                {
                    ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render,
                                                                  n_samples_to_render,
                                                                   st_ivas->hIsmRendererData->interpolator );
                    interp_offset = 0;
                    
                }

                for ( i = 0; i < num_objects; i++ )
                {
                    /* Combined rotation: rotate the object positions depending the head and external orientations */
                    if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
                    {
                        rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup );
                        if ( st_ivas->hEFAPdata != NULL )
                        {
                            efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], azimuth, elevation, EFAP_MODE_EFAP );
                        }
                    }

                    lfe_index = 0;
                    for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ )
                    {
                        if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[lfe_index] == j ) )
                        {
                            ( lfe_index < ( st_ivas->hIntSetup.num_lfe - 1 ) ) ? ( lfe_index++, j2++ ) : j2++;
                        }
                        
						gain = st_ivas->hIsmRendererData->gains[i][j];
                        prev_gain = st_ivas->hIsmRendererData->prev_gains[i][j];
                        if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f )
                        {
                            g1 = &st_ivas->hIsmRendererData->interpolator[interp_offset];
                            float *tc_re = pppQMfFrame_ts_re[nchan_transport + i][0];
                            float *tc_im = pppQMfFrame_ts_im[nchan_transport + i][0];
                            
							for ( k = 0; k < n_slots_to_render; k++ )
                            {
                                g2 = 1.0f - *g1;
                                for ( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ )
                                {
                                    Cldfb_RealBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += ( *g1 * gain + g2 * prev_gain ) * *( tc_re++ );
                                    Cldfb_ImagBuffer[j2][0][k * hSpatParamRendCom->num_freq_bands + l] += ( *g1 * gain + g2 * prev_gain ) * *( tc_im++ );
                                }
                                g1 += hSpatParamRendCom->num_freq_bands;
                            }
                        }

                        /* update here only in case of head rotation */
                        if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
                        {
                            st_ivas->hIsmRendererData->prev_gains[i][j] = gain;
                        }
                    }
                }
            }
        }
#endif


#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
        {
+17 −1
Original line number Diff line number Diff line
@@ -1163,6 +1163,16 @@ ivas_error ivas_init_decoder(

    ivas_output_init( &( st_ivas->hOutSetup ), output_config );

#ifdef JBM_FOR_OSBA
	if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == AUDIO_CONFIG_BINAURAL_ROOM_IR )
    {
        st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER;
        st_ivas->intern_config = AUDIO_CONFIG_7_1_4;
        st_ivas->hOutSetup.output_config = st_ivas->intern_config;
        st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config );   
    }
#endif

    if ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == AUDIO_CONFIG_EXTERNAL )
    {
        st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER;
@@ -2926,6 +2936,12 @@ void ivas_init_dec_get_num_cldfb_instances(
                    {
                        *numCldfbSyntheses = MAX_OUTPUT_CHANNELS;
                    }
#ifdef JBM_FOR_OSBA
					if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
                    {
                        *numCldfbAnalyses = st_ivas->nchan_ism + st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans;
                    }
#endif
				}
            }
            else if ( st_ivas->mc_mode == MC_MODE_PARAMMC )
+1 −0
Original line number Diff line number Diff line
@@ -1057,6 +1057,7 @@ void ivas_ism_dec_digest_tc(
                if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM
#ifdef JBM_FOR_OSBA
                       || st_ivas->renderer_type == RENDERER_OSBA_LS
					  || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM
#endif
                       ) &&
                     st_ivas->hCombinedOrientationData == NULL )
+32 −25
Original line number Diff line number Diff line
@@ -1213,10 +1213,17 @@ ivas_error ivas_jbm_dec_render(
                 }

                 ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output );
                 if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM )
                 {
                     ivas_ism_render_sf( st_ivas, p_output_ism, *nSamplesRendered );
                 }

                 for ( n = 0; n < nchan_out; n++ )
                 {
                     if ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM )
                     {
						v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered );
					 }
                     v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered );
                 }
            }
+6 −0
Original line number Diff line number Diff line
@@ -170,6 +170,12 @@ void ivas_renderer_select(
            {
                *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
            }
 #ifdef JBM_FOR_OSBA
			if ( st_ivas->ivas_format == SBA_ISM_FORMAT && *renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
            {
                *internal_config = AUDIO_CONFIG_7_1_4;
            }
#endif

            if ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
            {
Loading