Commit ca4f1e55 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

lib rend changes

parent e4e3f76f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -596,6 +596,7 @@ enum

#define FRAMES_PER_SEC                      50
#define MAX_PARAM_SPATIAL_SUB_FRAMES_PER_SEC              200 //(FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES)
#define ONE_BY_SUBFRAME_LEN_MS_Q31                (429496730)
#define ONE_BY_FRAMES_PER_SEC_Q31           ( 42949673 )
#define FRAMES_PER_SEC_BY_2                 (FRAMES_PER_SEC >> 1)
#define INV_FRAME_PER_SEC_Q15               656
+8 −5
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ void Euler2Quat_fx(
    const Word32 yaw,     /* i  : yaw   (x) Q22                      */
    const Word32 pitch,   /* i  : pitch (y) Q22                      */
    const Word32 roll,    /* i  : roll  (z) Q22                      */
    IVAS_QUATERNION *quat /* o  : quaternion describing the rotation Q19 */
    IVAS_QUATERNION *quat /* o  : quaternion describing the rotation Q22*/
)
{
    Word16 cr = getCosWord16( extract_l( L_shr_r( roll, 10 ) ) ); // Q14
@@ -62,15 +62,18 @@ void Euler2Quat_fx(
    Word16 sp = getSinWord16( extract_l( L_shr_r( pitch, 10 ) ) );
    Word16 cy = getCosWord16( extract_l( L_shr_r( yaw, 10 ) ) );
    Word16 sy = getSinWord16( extract_l( L_shr_r( yaw, 10 ) ) );
    quat->w_fx = L_shr_r( L_add( Mpy_32_16_1( L_mult0( cr, cp ), cy ), Mpy_32_16_1( L_mult0( sr, sp ), sy ) ), 5 ); // Q19
    quat->w_fx = L_shr_r( L_add( Mpy_32_16_1( L_mult0( cr, cp ), cy ), Mpy_32_16_1( L_mult0( sr, sp ), sy ) ), 5 ); // Q22
    move32();
    quat->x_fx = L_shr_r( L_sub( Mpy_32_16_1( L_mult0( sr, cp ), cy ), Mpy_32_16_1( L_mult0( cr, sp ), sy ) ), 5 ); // Q19
    quat->x_fx = L_shr_r( L_sub( Mpy_32_16_1( L_mult0( sr, cp ), cy ), Mpy_32_16_1( L_mult0( cr, sp ), sy ) ), 5 ); // Q22
    move32();
    quat->y_fx = L_shr_r( L_add( Mpy_32_16_1( L_mult0( sr, cp ), sy ), Mpy_32_16_1( L_mult0( cr, sp ), cy ) ), 5 ); // Q19
    quat->y_fx = L_shr_r( L_add( Mpy_32_16_1( L_mult0( sr, cp ), sy ), Mpy_32_16_1( L_mult0( cr, sp ), cy ) ), 5 ); // Q22
    move32();
    quat->z_fx = L_shr_r( L_sub( Mpy_32_16_1( L_mult0( cr, cp ), sy ), Mpy_32_16_1( L_mult0( sr, sp ), cy ) ), 5 ); // Q19
    quat->z_fx = L_shr_r( L_sub( Mpy_32_16_1( L_mult0( cr, cp ), sy ), Mpy_32_16_1( L_mult0( sr, sp ), cy ) ), 5 ); // Q22
    move32();

    quat->q_fact = Q22;
    move16();

    return;
}
void Euler2Quat(
+13 −8
Original line number Diff line number Diff line
@@ -2108,6 +2108,8 @@ void ivas_rend_CldfbMultiBinRendProcess(
    Word32 Cldfb_ImagBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word16 Q_in_orig = *Q_in;
    move16();

    FOR( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
    {
@@ -2121,20 +2123,23 @@ void ivas_rend_CldfbMultiBinRendProcess(
            }
        }

        if ( ( *pCombinedOrientationData ) != NULL )
        IF( ( *pCombinedOrientationData ) != NULL )
        {
            if ( ( low_res_pre_rend_rot ) && ( pMultiBinPoseData->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) )
            IF( ( low_res_pre_rend_rot ) && ( EQ_32( pMultiBinPoseData->poseCorrectionMode, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB ) ) )
            {
                ( *pCombinedOrientationData )->Quaternions[sf_idx] = ( *pCombinedOrientationData )->Quaternions[0];
                for ( i = 0; i < 3; i++ )
                Copy_Quat_fx( &( *pCombinedOrientationData )->Quaternions[0], &( *pCombinedOrientationData )->Quaternions[sf_idx] );

                FOR( i = 0; i < 3; i++ )
                {
                    for ( j = 0; j < 3; j++ )
                    FOR( j = 0; j < 3; j++ )
                    {
                        ( *pCombinedOrientationData )->Rmat_fx[sf_idx][i][j] = ( *pCombinedOrientationData )->Rmat_fx[0][i][j];
                        move32();
                    }
                }
            }
            ( *pCombinedOrientationData )->shd_rot_max_order = -1;
            move16();
        }

        ivas_binRenderer_fx( hCldfbRend, pMultiBinPoseData, *pCombinedOrientationData, MAX_PARAM_SPATIAL_SUBFRAMES, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer_sfIn, Cldfb_ImagBuffer_sfIn, Q_in );
@@ -2148,12 +2153,12 @@ void ivas_rend_CldfbMultiBinRendProcess(
                {
                    Copy32( &Cldfb_RealBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Real[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band );
                    Copy32( &Cldfb_ImagBuffer_Binaural[pose_idx][ch_idx][slot_idx][0], &Cldfb_Out_Imag[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band );
                    Scale_sig32( &Cldfb_Out_Real[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band, sub( Q6, *Q_in ) ); // Q6
                    Scale_sig32( &Cldfb_Out_Imag[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band, sub( Q6, *Q_in ) ); // Q6
                    Scale_sig32( &Cldfb_Out_Real[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band, sub( Q_in_orig, *Q_in ) ); // Q_in_orig
                    Scale_sig32( &Cldfb_Out_Imag[( pose_idx * BINAURAL_CHANNELS ) + ch_idx][idx][0], hCldfbRend->max_band, sub( Q_in_orig, *Q_in ) ); // Q_in_orig
                }
            }
        }
        *Q_in = Q6;
        *Q_in = Q_in_orig;
    }

    return;
+20 −24
Original line number Diff line number Diff line
@@ -413,31 +413,27 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
        /* Update head positions */
        IF( NE_16( pos_idx, 0 ) )
        {
            COMBINED_ORIENTATION_HANDLE pCombinedOrientationData = st_ivas->hCombinedOrientationData;
            Word16 q_fact_orig;
            FOR( i = 0; i < st_ivas->hCombinedOrientationData->num_subframes; ++i )
            {
                IF( EQ_32( originalHeadRot[i].w_fx, -1610612736 /* -3.0f in Q29 */ ) )
                {
                    assert( 0 );
                }
                else
                {
                    st_ivas->hCombinedOrientationData->Quaternions[i].w = -12582912; // Q22
                    move32();
                pCombinedOrientationData->Quaternions[i].w_fx = L_negate( 12582912 ); // Q22
                q_fact_orig = originalHeadRot[i].q_fact;
                modify_Quat_q_fx( &originalHeadRot[i], &originalHeadRot[i], Q22 );
                /*euler*/
                Quat2EulerDegree_fx( originalHeadRot[i],
                                     &pCombinedOrientationData->Quaternions[i].z_fx,
                                     &pCombinedOrientationData->Quaternions[i].y_fx,
                                     &pCombinedOrientationData->Quaternions[i].x_fx );
                pCombinedOrientationData->Quaternions[i].x_fx = L_add( pCombinedOrientationData->Quaternions[i].x_fx, pMultiBinPoseData->relative_head_poses_fx[pos_idx][0] );
                pCombinedOrientationData->Quaternions[i].y_fx = L_add( pCombinedOrientationData->Quaternions[i].y_fx, pMultiBinPoseData->relative_head_poses_fx[pos_idx][1] );
                pCombinedOrientationData->Quaternions[i].z_fx = L_add( pCombinedOrientationData->Quaternions[i].z_fx, pMultiBinPoseData->relative_head_poses_fx[pos_idx][2] );

                    Quat2EulerDegree( originalHeadRot[i], /* TODO tmu : fix bug with ordering*/
                                      &st_ivas->hCombinedOrientationData->Quaternions[i].z_fx,
                                      &st_ivas->hCombinedOrientationData->Quaternions[i].y_fx,
                                      &st_ivas->hCombinedOrientationData->Quaternions[i].x_fx );
                Euler2Quat_fx( deg2rad_fx( pCombinedOrientationData->Quaternions[i].x_fx ),
                               deg2rad_fx( pCombinedOrientationData->Quaternions[i].y_fx ),
                               deg2rad_fx( pCombinedOrientationData->Quaternions[i].z_fx ), &pCombinedOrientationData->Quaternions[i] );

                    st_ivas->hCombinedOrientationData->Quaternions[i].x_fx = L_add( st_ivas->hCombinedOrientationData->Quaternions[i].x_fx, pMultiBinPoseData->relative_head_poses[pos_idx][0] );
                    st_ivas->hCombinedOrientationData->Quaternions[i].y_fx = L_add( st_ivas->hCombinedOrientationData->Quaternions[i].y_fx, pMultiBinPoseData->relative_head_poses[pos_idx][1] );
                    st_ivas->hCombinedOrientationData->Quaternions[i].z_fx = L_add( st_ivas->hCombinedOrientationData->Quaternions[i].z_fx, pMultiBinPoseData->relative_head_poses[pos_idx][2] );
                    move32();
                    move32();
                    move32();

                    Euler2Quat_fx( deg2rad_fx( st_ivas->hCombinedOrientationData->Quaternions[i].x_fx ), deg2rad_fx( st_ivas->hCombinedOrientationData->Quaternions[i].y_fx ), deg2rad_fx( st_ivas->hCombinedOrientationData->Quaternions[i].z_fx ), &st_ivas->hCombinedOrientationData->Quaternions[i] );
                }
                modify_Quat_q_fx( &pCombinedOrientationData->Quaternions[i], &pCombinedOrientationData->Quaternions[i], q_fact_orig );
            }
        }

@@ -472,7 +468,7 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
            Word32 *p_tc[MAX_TRANSPORT_CHANNELS];
            FOR( i = 0; i < st_ivas->nchan_transport; i++ )
            {
                p_tc[i] = st_ivas->hTcBuffer->tc[i] + st_ivas->hTcBuffer->n_samples_rendered;
                p_tc[i] = st_ivas->hTcBuffer->tc_fx[i] + st_ivas->hTcBuffer->n_samples_rendered;
            }
            ivas_binaural_add_LFE_fx( st_ivas, nSamplesRendered, p_tc, p_bin_output );
        }
+2 −1
Original line number Diff line number Diff line
@@ -2048,7 +2048,8 @@ void ivas_rend_CldfbMultiBinRendProcess(
    Word32 Cldfb_Out_Real[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o  : Binaural signals */
    Word32 Cldfb_Out_Imag[MAX_HEAD_ROT_POSES*BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
    const Word16 low_res_pre_rend_rot, 
    const Word16 num_subframes
    const Word16 num_subframes,
	Word16 *Q_in
);

ivas_error ivas_rend_openCldfb(
Loading