Loading lib_com/ivas_rotation_com_fx.c +15 −0 Original line number Diff line number Diff line Loading @@ -124,10 +124,18 @@ void modify_Quat_q_fx( Word16 q_new /* i : quaternion describing the rotation */ ) { #ifdef FIX_BASOP_2361_OTR Word16 shift = sub( q_new, in_quat->q_fact ); out_quat->w_fx = L_shl_sat( in_quat->w_fx, shift ); // q_new out_quat->x_fx = L_shl_sat( in_quat->x_fx, shift ); // q_new out_quat->y_fx = L_shl_sat( in_quat->y_fx, shift ); // q_new out_quat->z_fx = L_shl_sat( in_quat->z_fx, shift ); // q_new #else out_quat->w_fx = L_shl_sat( in_quat->w_fx, sub( q_new, in_quat->q_fact ) ); // q_new out_quat->x_fx = L_shl_sat( in_quat->x_fx, sub( q_new, in_quat->q_fact ) ); // q_new out_quat->y_fx = L_shl_sat( in_quat->y_fx, sub( q_new, in_quat->q_fact ) ); // q_new out_quat->z_fx = L_shl_sat( in_quat->z_fx, sub( q_new, in_quat->q_fact ) ); // q_new #endif out_quat->q_fact = q_new; return; } Loading @@ -147,12 +155,19 @@ void modify_Rmat_q_fx( ) { Word16 j, k; #ifdef FIX_BASOP_2361_OTR Word16 shift = sub( q_new, q_cur ); #endif FOR( j = 0; j < 3; j++ ) { FOR( k = 0; k < 3; k++ ) { #ifdef FIX_BASOP_2361_OTR Rmat_out[j][k] = L_shl( Rmat_in[j][k], shift ); #else Rmat_out[j][k] = L_shl( Rmat_in[j][k], sub( q_new, q_cur ) ); #endif move32(); } } Loading lib_rend/ivas_orient_trk_fx.c +8 −8 Original line number Diff line number Diff line Loading @@ -484,20 +484,20 @@ static Word32 VectorLength_fx( { #ifdef FIX_BASOP_2361_OTR Word16 sqrt_e; #endif Word32 result_fx = 0; move32(); result_fx = L_add( L_add( Mpy_32_32( p.x_fx, p.x_fx ), Mpy_32_32( p.y_fx, p.y_fx ) ), Mpy_32_32( p.z_fx, p.z_fx ) ); // // Q: ( p1.q_fact + p2.q_fact ) - 31 #ifdef FIX_BASOP_2361_OTR sqrt_e = sub( 31, sub( add( p.q_fact, p.q_fact ), 31 ) ); /* convert Q to E */ Word32 result_fx; result_fx = Madd_32_32( Madd_32_32( Mpy_32_32( p.x_fx, p.x_fx ), p.y_fx, p.y_fx ), p.z_fx, p.z_fx ); sqrt_e = shl( sub( 31, p.q_fact ), 1 ); /* convert Q to E */ result_fx = Sqrt32( result_fx, &sqrt_e ); *q_fact = sub( 31, sqrt_e ); /* back to Q again */ #else Word32 result_fx = 0; move32(); result_fx = L_add( L_add( Mpy_32_32( p.x_fx, p.x_fx ), Mpy_32_32( p.y_fx, p.y_fx ) ), Mpy_32_32( p.z_fx, p.z_fx ) ); // // Q: ( p1.q_fact + p2.q_fact ) - 31 *q_fact = sub( add( p.q_fact, p.q_fact ), 31 ); #endif move16(); return result_fx; } Loading Loading @@ -915,7 +915,7 @@ ivas_error ivas_orient_trk_Process_fx( Word16 scale_e; Word16 tmp; tmp = BASOP_Util_Divide3232_Scale( PI2_C_ADP_RATE_Q31, updateRate_fx, &scale_e ); scale_e = add( scale_e, sub( 23, 31 ) ); /* updateRate_fx is hardcoded in caller to Q23 */ scale_e = add( scale_e, 23 - 31 ); /* updateRate_fx is hardcoded in caller to Q23 */ /* sin(x) is approx x for small x */ pOTR->alpha_fx = L_deposit_h( tmp ); Loading Loading
lib_com/ivas_rotation_com_fx.c +15 −0 Original line number Diff line number Diff line Loading @@ -124,10 +124,18 @@ void modify_Quat_q_fx( Word16 q_new /* i : quaternion describing the rotation */ ) { #ifdef FIX_BASOP_2361_OTR Word16 shift = sub( q_new, in_quat->q_fact ); out_quat->w_fx = L_shl_sat( in_quat->w_fx, shift ); // q_new out_quat->x_fx = L_shl_sat( in_quat->x_fx, shift ); // q_new out_quat->y_fx = L_shl_sat( in_quat->y_fx, shift ); // q_new out_quat->z_fx = L_shl_sat( in_quat->z_fx, shift ); // q_new #else out_quat->w_fx = L_shl_sat( in_quat->w_fx, sub( q_new, in_quat->q_fact ) ); // q_new out_quat->x_fx = L_shl_sat( in_quat->x_fx, sub( q_new, in_quat->q_fact ) ); // q_new out_quat->y_fx = L_shl_sat( in_quat->y_fx, sub( q_new, in_quat->q_fact ) ); // q_new out_quat->z_fx = L_shl_sat( in_quat->z_fx, sub( q_new, in_quat->q_fact ) ); // q_new #endif out_quat->q_fact = q_new; return; } Loading @@ -147,12 +155,19 @@ void modify_Rmat_q_fx( ) { Word16 j, k; #ifdef FIX_BASOP_2361_OTR Word16 shift = sub( q_new, q_cur ); #endif FOR( j = 0; j < 3; j++ ) { FOR( k = 0; k < 3; k++ ) { #ifdef FIX_BASOP_2361_OTR Rmat_out[j][k] = L_shl( Rmat_in[j][k], shift ); #else Rmat_out[j][k] = L_shl( Rmat_in[j][k], sub( q_new, q_cur ) ); #endif move32(); } } Loading
lib_rend/ivas_orient_trk_fx.c +8 −8 Original line number Diff line number Diff line Loading @@ -484,20 +484,20 @@ static Word32 VectorLength_fx( { #ifdef FIX_BASOP_2361_OTR Word16 sqrt_e; #endif Word32 result_fx = 0; move32(); result_fx = L_add( L_add( Mpy_32_32( p.x_fx, p.x_fx ), Mpy_32_32( p.y_fx, p.y_fx ) ), Mpy_32_32( p.z_fx, p.z_fx ) ); // // Q: ( p1.q_fact + p2.q_fact ) - 31 #ifdef FIX_BASOP_2361_OTR sqrt_e = sub( 31, sub( add( p.q_fact, p.q_fact ), 31 ) ); /* convert Q to E */ Word32 result_fx; result_fx = Madd_32_32( Madd_32_32( Mpy_32_32( p.x_fx, p.x_fx ), p.y_fx, p.y_fx ), p.z_fx, p.z_fx ); sqrt_e = shl( sub( 31, p.q_fact ), 1 ); /* convert Q to E */ result_fx = Sqrt32( result_fx, &sqrt_e ); *q_fact = sub( 31, sqrt_e ); /* back to Q again */ #else Word32 result_fx = 0; move32(); result_fx = L_add( L_add( Mpy_32_32( p.x_fx, p.x_fx ), Mpy_32_32( p.y_fx, p.y_fx ) ), Mpy_32_32( p.z_fx, p.z_fx ) ); // // Q: ( p1.q_fact + p2.q_fact ) - 31 *q_fact = sub( add( p.q_fact, p.q_fact ), 31 ); #endif move16(); return result_fx; } Loading Loading @@ -915,7 +915,7 @@ ivas_error ivas_orient_trk_Process_fx( Word16 scale_e; Word16 tmp; tmp = BASOP_Util_Divide3232_Scale( PI2_C_ADP_RATE_Q31, updateRate_fx, &scale_e ); scale_e = add( scale_e, sub( 23, 31 ) ); /* updateRate_fx is hardcoded in caller to Q23 */ scale_e = add( scale_e, 23 - 31 ); /* updateRate_fx is hardcoded in caller to Q23 */ /* sin(x) is approx x for small x */ pOTR->alpha_fx = L_deposit_h( tmp ); Loading