Brainstorming: Noise optimization
#9
This function
	float cNoise::IntNoise( int a_X )
	{
		int x = ((a_X*m_Seed)<<13) ^ a_X;
		return ( 1.0f - ( (x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f); 
	}

turned into this monster
__m128 SSE_IntNoise( const __m128i & a_X4 )
{
	__m128i X4 = _mm_xor_si128( _mm_slli_epi32( a_X4, 13 ), a_X4 );

	//_mm_sub_ps( _mm_set_ps1( 1.0f ) // 1.f -
	
	__m128 result = _mm_sub_ps( 
		  _mm_set_ps1( 1.0f )
		, _mm_div_ps( // ( ( (x * ((x*x)*15731 + 789221)) + 1376312589 ) & 0x7fffffff ) / 1073741824.0f
			_mm_cvtepi32_ps( // (float) -> converts to float
				_mm_and_si128( // ( (x * ((x*x)*15731 + 789221)) + 1376312589 ) & 0x7fffffff
					  _mm_set1_epi32( 0x7fffffff ) // 0x7fffffff
					, _mm_add_epi32( // (x * ((x*x)*15731 + 789221)) + 1376312589
						  _mm_set1_epi32( 1376312589 ) // 1376312589
						, _mm_mul_epu32( // x * ((x*x)*15731 + 789221)
							 X4
						   , _mm_add_epi32( // ((x*x)*15731 + 789221)
							   _mm_set1_epi32( 789221 ) // 789221
							 , _mm_mul_epu32( // ((x*x)*15731)
								  _mm_mul_epu32( X4, X4 ) // x*x
								, _mm_set1_epi32( 15731 ) // 15731
								)
							)
						)
					)
				)
			)
			, _mm_set_ps1( 1073741824.0f ) // 1073741824.0f
		)
	);

	return result;
}
Reply
Thanks given by:


Messages In This Thread
Brainstorming: Noise optimization - by xoft - 03-28-2013, 05:54 AM
RE: Brainstorming: Noise optimization - by xoft - 03-28-2013, 07:29 AM
RE: Brainstorming: Noise optimization - by ThuGie - 01-15-2014, 10:29 AM
RE: Brainstorming: Noise optimization - by xoft - 01-15-2014, 10:56 PM
RE: Brainstorming: Noise optimization - by FakeTruth - 01-16-2014, 05:53 AM
RE: Brainstorming: Noise optimization - by xoft - 01-16-2014, 06:18 AM
RE: Brainstorming: Noise optimization - by xoft - 01-17-2014, 05:06 AM
RE: Brainstorming: Noise optimization - by ThuGie - 01-17-2014, 07:17 AM
RE: Brainstorming: Noise optimization - by xoft - 01-18-2014, 08:13 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 01:02 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 01:20 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 01:45 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 02:05 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 07:29 AM
RE: Brainstorming: Noise optimization - by xoft - 01-19-2014, 05:14 PM
RE: Brainstorming: Noise optimization - by xoft - 01-24-2014, 06:37 PM



Users browsing this thread: 4 Guest(s)