Loading lib_com/basop_util.c +4 −11 Original line number Diff line number Diff line Loading @@ -1256,22 +1256,15 @@ Word16 getCosWord16R2( Word16 getSineWord16R2( Word16 theta ) { IF ( theta == 0 ) IF ( EQ_16( theta, (Word16) 0 ) ) { return 0; } Word16 cosine = getCosWord16R2( theta ); Word16 result = 32767 - ( mult_r( cosine, cosine ) ); Word16 exp = 0; Word16 sine = Sqrt16( result, &exp ); sine = shl( sine, exp ); IF ( ( ( theta >= 16384 ) && ( theta <= 32767 ) ) || ( ( theta < 0 ) && ( theta >= -16384 ) ) ) ELSE IF ( LT_16( theta, (Word16) -24576 ) ) { sine = negate( sine ); theta = add( add( theta, (Word16) 32767 ), (Word16) 1 ); } return sine; return getCosWord16R2( sub( 8192, theta ) ); } /* Loading lib_rend/ivas_efap.c +6 −5 Original line number Diff line number Diff line Loading @@ -2783,8 +2783,8 @@ static Word16 in_tri_fixed( Word32 tmpDot1[2], tmpDot2[2]; Word32 matInv[2][2]; Word32 invFactor; Word32 S[2]; Word32 thresh_int = 34; // 1e-6f in Q25 Word64 S[2]; Word64 thresh_int = 4295; // 1e-6f in Q32 /* Not a Valid Triangle : Colinear edges Loading @@ -2797,14 +2797,14 @@ static Word16 in_tri_fixed( v_sub_fixed( C, A, tmpDot2, 2, 0 ); /* Verification of the non-colinearity : Q22 * Q22 = Q13 */ invFactor = L_sub( Mpy_32_32( tmpDot1[0], tmpDot2[1] ), Mpy_32_32( tmpDot1[1], tmpDot2[0] ) ); invFactor = L_shr( L_sub( Mpy_32_32( tmpDot1[0], tmpDot2[1] ), Mpy_32_32( tmpDot1[1], tmpDot2[0] ) ), Q5 ); IF( invFactor == 0 ) { return 0; } invFactor = ( 0x7FFFFFFF / invFactor ) << Q13; invFactor = L_shl( ( 0x7FFFFFFF / invFactor ), Q8 ); // Q22 = Q22 * Q31 matInv[0][0] = Mpy_32_32( tmpDot2[1], invFactor ); Loading @@ -2817,7 +2817,8 @@ static Word16 in_tri_fixed( S[1] = L_add( Mpy_32_32( matInv[1][0], P_minus_A[0] ), Mpy_32_32( matInv[1][1], P_minus_A[1] ) ); /* Checking if we are in the triangle; For the theory, check Christian Borss article, section 3.2 */ IF( ( S[0] << Q12 ) < -thresh_int || ( S[1] << Q12 ) < -thresh_int || ( ( S[0] + S[1] ) << Q12 ) > ( ( 1 << Q25 ) + thresh_int ) ) IF( ( S[0] << Q19 ) < -thresh_int || ( S[1] << Q19 ) < -thresh_int || ( ( S[0] + S[1] ) << Q19 ) > ( ( ( (Word64) 1 ) << 32 ) + thresh_int ) ) { return 0; } Loading Loading
lib_com/basop_util.c +4 −11 Original line number Diff line number Diff line Loading @@ -1256,22 +1256,15 @@ Word16 getCosWord16R2( Word16 getSineWord16R2( Word16 theta ) { IF ( theta == 0 ) IF ( EQ_16( theta, (Word16) 0 ) ) { return 0; } Word16 cosine = getCosWord16R2( theta ); Word16 result = 32767 - ( mult_r( cosine, cosine ) ); Word16 exp = 0; Word16 sine = Sqrt16( result, &exp ); sine = shl( sine, exp ); IF ( ( ( theta >= 16384 ) && ( theta <= 32767 ) ) || ( ( theta < 0 ) && ( theta >= -16384 ) ) ) ELSE IF ( LT_16( theta, (Word16) -24576 ) ) { sine = negate( sine ); theta = add( add( theta, (Word16) 32767 ), (Word16) 1 ); } return sine; return getCosWord16R2( sub( 8192, theta ) ); } /* Loading
lib_rend/ivas_efap.c +6 −5 Original line number Diff line number Diff line Loading @@ -2783,8 +2783,8 @@ static Word16 in_tri_fixed( Word32 tmpDot1[2], tmpDot2[2]; Word32 matInv[2][2]; Word32 invFactor; Word32 S[2]; Word32 thresh_int = 34; // 1e-6f in Q25 Word64 S[2]; Word64 thresh_int = 4295; // 1e-6f in Q32 /* Not a Valid Triangle : Colinear edges Loading @@ -2797,14 +2797,14 @@ static Word16 in_tri_fixed( v_sub_fixed( C, A, tmpDot2, 2, 0 ); /* Verification of the non-colinearity : Q22 * Q22 = Q13 */ invFactor = L_sub( Mpy_32_32( tmpDot1[0], tmpDot2[1] ), Mpy_32_32( tmpDot1[1], tmpDot2[0] ) ); invFactor = L_shr( L_sub( Mpy_32_32( tmpDot1[0], tmpDot2[1] ), Mpy_32_32( tmpDot1[1], tmpDot2[0] ) ), Q5 ); IF( invFactor == 0 ) { return 0; } invFactor = ( 0x7FFFFFFF / invFactor ) << Q13; invFactor = L_shl( ( 0x7FFFFFFF / invFactor ), Q8 ); // Q22 = Q22 * Q31 matInv[0][0] = Mpy_32_32( tmpDot2[1], invFactor ); Loading @@ -2817,7 +2817,8 @@ static Word16 in_tri_fixed( S[1] = L_add( Mpy_32_32( matInv[1][0], P_minus_A[0] ), Mpy_32_32( matInv[1][1], P_minus_A[1] ) ); /* Checking if we are in the triangle; For the theory, check Christian Borss article, section 3.2 */ IF( ( S[0] << Q12 ) < -thresh_int || ( S[1] << Q12 ) < -thresh_int || ( ( S[0] + S[1] ) << Q12 ) > ( ( 1 << Q25 ) + thresh_int ) ) IF( ( S[0] << Q19 ) < -thresh_int || ( S[1] << Q19 ) < -thresh_int || ( ( S[0] + S[1] ) << Q19 ) > ( ( ( (Word64) 1 ) << 32 ) + thresh_int ) ) { return 0; } Loading