Commit e232ca35 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Integrating ivas_td_binaural_renderer_fx and cleanup of some structure members...

Integrating ivas_td_binaural_renderer_fx and cleanup of some structure members of PARAM_MC_DEC_DATA and TDREND_SRC_t

[x] cleanup of buffers/variables of PARAM_MC_DEC_DATA, TDREND_SRC_t
[x] Integrated ivas_td_binaural_renderer_fx in ivas_jbm_dec_render
parent dad40b78
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2221,4 +2221,8 @@ void ivas_lfe_window_init_fx(
    const Word32 sampling_rate,   /* i  : sampling rate               */
    const Word16 frame_len        /* i  : frame length in samples     */
);

Word16 param_mc_get_num_cldfb_syntheses_fx(
    Decoder_Struct *st_ivas /* i  : Parametric MC handle */
);
#endif
+2 −2
Original line number Diff line number Diff line
@@ -5051,7 +5051,7 @@ void ivas_init_dec_get_num_cldfb_instances(
            }
            ELSE
            {
                *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses( st_ivas );
                *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses_fx( st_ivas );
            }
            BREAK;
        case RENDERER_PARAM_ISM:
@@ -5118,7 +5118,7 @@ void ivas_init_dec_get_num_cldfb_instances(
        case RENDERER_SBA_LINEAR_ENC:
            IF ( st_ivas->mc_mode == MC_MODE_PARAMMC )
            {
                *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses( st_ivas );
                *numCldfbSyntheses = param_mc_get_num_cldfb_syntheses_fx( st_ivas );
            }
            ELSE IF ( st_ivas->ism_mode == ISM_MODE_PARAM )
            {
+6 −75
Original line number Diff line number Diff line
@@ -3613,35 +3613,20 @@ ivas_error ivas_jbm_dec_render(
            }
            else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
            {
#ifdef IVAS_FLOAT_FIXED_s
#ifdef IVAS_FLOAT_FIXED
                //Word32 output_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k];
                //Word32 *p_output_fx[MAX_OUTPUT_CHANNELS];
#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED
                FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++)
                {
                    floatToFixed_arrL(p_output[i], p_output_fx[i], Q7, L_FRAME48k);
                    floatToFixed_arrL(p_output[i], p_output_fx[i], Q11, L_FRAME48k);
                    p_output_fx[i] = p_output_fx[i];
                }

                Word16 subframe_length;
                Word16 num_subframes = (int16_t)((*nSamplesRendered * FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES) / output_Fs);
                subframe_length = (*nSamplesRendered) / num_subframes;
#if 1
                for (Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++)
                {
                    Word16 idx = subframe_idx;

                    IF(st_ivas->hCombinedOrientationData->Quaternions) {
                        float max_val = 0;
                        max_val = (float)max(max_val, fabs(st_ivas->hCombinedOrientationData->Quaternions[idx].w));
                        max_val = (float)max(max_val, fabs(st_ivas->hCombinedOrientationData->Quaternions[idx].x));
                        max_val = (float)max(max_val, fabs(st_ivas->hCombinedOrientationData->Quaternions[idx].y));
                        max_val = (float)max(max_val, fabs(st_ivas->hCombinedOrientationData->Quaternions[idx].z));
                        Word16 quat_q = Q_factor_L(max_val);
                        st_ivas->hCombinedOrientationData->Quaternions[idx].w_fx = float_to_fix(st_ivas->hCombinedOrientationData->Quaternions[idx].w, quat_q);
                        st_ivas->hCombinedOrientationData->Quaternions[idx].x_fx = float_to_fix(st_ivas->hCombinedOrientationData->Quaternions[idx].x, quat_q);
                        st_ivas->hCombinedOrientationData->Quaternions[idx].y_fx = float_to_fix(st_ivas->hCombinedOrientationData->Quaternions[idx].y, quat_q);
                        st_ivas->hCombinedOrientationData->Quaternions[idx].z_fx = float_to_fix(st_ivas->hCombinedOrientationData->Quaternions[idx].z, quat_q);
                    }
                    Word16 pos_q = Q25;

                    IF(st_ivas->hCombinedOrientationData->listenerPos != NULL)
@@ -3649,64 +3634,18 @@ ivas_error ivas_jbm_dec_render(
                        st_ivas->hCombinedOrientationData->listenerPos[idx].x_fx = (Word32)float_to_fix(st_ivas->hCombinedOrientationData->listenerPos[idx].x, pos_q);
                        st_ivas->hCombinedOrientationData->listenerPos[idx].y_fx = (Word32)float_to_fix(st_ivas->hCombinedOrientationData->listenerPos[idx].y, pos_q);
                        st_ivas->hCombinedOrientationData->listenerPos[idx].z_fx = (Word32)float_to_fix(st_ivas->hCombinedOrientationData->listenerPos[idx].z, pos_q);
                        st_ivas->hCombinedOrientationData->listenerPos[idx].q_fact = Q25;
                    }
                    FOR( i = 0; i < 3; i++)
                    {
                        st_ivas->hBinRendererTd->Listener_p->Front_fx[i] = float_to_fix(st_ivas->hBinRendererTd->Listener_p->Front[i], Q30);
                        st_ivas->hBinRendererTd->Listener_p->Up_fx[i] = float_to_fix(st_ivas->hBinRendererTd->Listener_p->Up[i], Q30);
                        st_ivas->hBinRendererTd->Listener_p->Right_fx[i] = float_to_fix(st_ivas->hBinRendererTd->Listener_p->Right[i], Q30);
                        st_ivas->hBinRendererTd->Listener_p->Pos_q = pos_q;
                        st_ivas->hBinRendererTd->Listener_p->Pos_fx[i] = float_to_fix(st_ivas->hBinRendererTd->Listener_p->Pos[i], st_ivas->hBinRendererTd->Listener_p->Pos_q);
                    }

                }
#endif
                if ((error = ivas_td_binaural_renderer_fx(st_ivas, p_output_fx, *nSamplesRendered)) != IVAS_ERR_OK)
                {
                    return error;
                }
#if 1
                for ( i = 0; i < 3; i++)
                {
                    st_ivas->hBinRendererTd->Listener_p->Front[i] = fix_to_float(st_ivas->hBinRendererTd->Listener_p->Front_fx[i], Q30);
                    st_ivas->hBinRendererTd->Listener_p->Up[i] = fix_to_float(st_ivas->hBinRendererTd->Listener_p->Up_fx[i], Q30);
                    st_ivas->hBinRendererTd->Listener_p->Right[i] = fix_to_float(st_ivas->hBinRendererTd->Listener_p->Right_fx[i], Q30);
                    st_ivas->hBinRendererTd->Listener_p->Pos[i] = fix_to_float(st_ivas->hBinRendererTd->Listener_p->Pos_fx[i], st_ivas->hBinRendererTd->Listener_p->Pos_q);
                }

                Word16 ism_md_subframe_update_ext = 0;
                Word16 nchan_transport_tmp = (st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_SBA_MODE_DISC) ? st_ivas->nchan_ism : st_ivas->nchan_transport;

                if (st_ivas->hDecoderConfig->Opt_delay_comp)
                {
                    ism_md_subframe_update_ext = 1;
                }
                else
                {
                    ism_md_subframe_update_ext = 2;
                }

                if (st_ivas->ivas_format == MASA_ISM_FORMAT)
                {
                    ism_md_subframe_update_ext = 2;
                }

                for (Word16 subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++)
                {
                    if (subframe_idx == ism_md_subframe_update_ext)
                    {
                        for(Word16 ns = 0; ns < nchan_transport_tmp - 1; ns++)
                        {
                            fixedToFloat_arrL(st_ivas->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p_fx, st_ivas->hBinRendererTd->Sources[ns]->SrcSpatial_p->Front_p, Q30, 3 * SPAT_BIN_MAX_INPUT_CHANNELS);
                            fixedToFloat_arrL(st_ivas->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p_fx, st_ivas->hBinRendererTd->Sources[ns]->SrcSpatial_p->Pos_p, Q25, 3 * SPAT_BIN_MAX_INPUT_CHANNELS);
                        }
                    }
                }


#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED
                FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++)
                {
                    fixedToFloat_arrL(p_output_fx[i], p_output[i], Q7, L_FRAME48k);
                    fixedToFloat_arrL(p_output_fx[i], p_output[i], Q11, L_FRAME48k);
                }
#endif

@@ -3833,14 +3772,6 @@ ivas_error ivas_jbm_dec_render(
#endif
            ivas_param_mc_dec_render_fx(st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, channel_active_fx);
#if 1//ftf changes
            if (st_ivas->hParamMC->max_band_decorr > 0)
            {
                // ftf for param_mc_protoSignalComputation_fx
                fixedToFloat_arrL(st_ivas->hParamMC->proto_frame_f_fx, st_ivas->hParamMC->proto_frame_f, Q11, 2 * st_ivas->hParamMC->diff_proto_info->num_protos_diff * st_ivas->hParamMC->num_freq_bands);

                // ftf for ivas_dirac_dec_decorr_process_fx
                fixedToFloat_arrL32(st_ivas->hParamMC->proto_frame_dec_f_fx, st_ivas->hParamMC->proto_frame_dec_f, Q11, nchan_out_cov * 2 * st_ivas->hParamMC->num_freq_bands);
            }
            for (int ch = 0; ch < nchan_out_cldfb; ch++)
            {
                if (channel_active_fx[ch]) {
+165 −353

File changed.

Preview size limit exceeded, changes collapsed.

+8 −4
Original line number Diff line number Diff line
@@ -87,12 +87,14 @@ ivas_error ivas_td_binaural_open(
}
#endif // IVAS_FLOAT_FIXED


/*---------------------------------------------------------------------*
 * ivas_td_binaural_renderer()
 *
 * Receives the current frames for the object streams, updates metadata
 * and renders the current frame.
 *---------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
ivas_error ivas_td_binaural_renderer_fx(
    Decoder_Struct *st_ivas,   /* i/o: IVAS decoder structure            */
@@ -121,8 +123,7 @@ ivas_error ivas_td_binaural_renderer_fx(

    return ivas_td_binaural_renderer_unwrap_fx(st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hCombinedOrientationData, ism_md_subframe_update, output, output_frame, MAX_PARAM_SPATIAL_SUBFRAMES);
}
#endif

#else
ivas_error ivas_td_binaural_renderer(
    Decoder_Struct *st_ivas,   /* i/o: IVAS decoder structure            */
    float *output[],           /* i/o: SCE channels / Binaural synthesis */
@@ -150,6 +151,9 @@ ivas_error ivas_td_binaural_renderer(

    return ivas_td_binaural_renderer_unwrap( st_ivas->hReverb, st_ivas->transport_config, st_ivas->hBinRendererTd, nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hCombinedOrientationData, ism_md_subframe_update, output, output_frame, MAX_PARAM_SPATIAL_SUBFRAMES );
}
#endif


/*---------------------------------------------------------------------*
 * ivas_td_binaural_renderer_sf()
 *
@@ -165,6 +169,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx(
    const int16_t n_samples_granularity /* i  : granularity of the renderer/buffer  */
)
{
    UNUSED_PARAM( q_factor );
    Word16 first_sf, last_sf, subframe_idx;
    Word32 *output_fx_local[BINAURAL_CHANNELS];
    Word32 reverb_signal_fx[BINAURAL_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -273,8 +278,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx(
        {
            IF( !( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && EQ_16( nS, LFE_CHANNEL ) ) ) /* Skip LFE for MC */
            {
                st_ivas->hBinRendererTd->Sources[c_indx]->InputFrame_p_fx = tc_local_fx[nS];
                st_ivas->hBinRendererTd->Sources[c_indx]->InputFrame_p_q = q_factor;
                st_ivas->hBinRendererTd->Sources[c_indx]->InputFrame_p_fx = tc_local_fx[nS]; /* Q11 */
                st_ivas->hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE;
                move16();
                c_indx = add( c_indx, 1 );
Loading