FastLED 3.9.15
Loading...
Searching...
No Matches

◆ test_f32_pipeline_mul_add_clamp()

bool autoresearch::simd_check::test_f32_pipeline_mul_add_clamp ( )
inline

Definition at line 1092 of file AutoResearchSimd.h.

1092 {
1093 // Simulate color: multiply by gain, add bias, clamp to [0, 1]
1094 float input[4] = {0.3f, 0.6f, 0.9f, 1.2f};
1095 float gain[4] = {2.0f, 2.0f, 2.0f, 2.0f};
1096 float output[4] = {0.0f};
1097 simd_f32x4 v = load_f32_4(input);
1098 v = mul_f32_4(v, load_f32_4(gain)); // 0.6, 1.2, 1.8, 2.4
1099 v = min_f32_4(v, set1_f32_4(1.0f)); // clamp to 1.0
1100 v = max_f32_4(v, set1_f32_4(0.0f)); // clamp to 0.0
1101 store_f32_4(output, v);
1102 float expected[4] = {0.6f, 1.0f, 1.0f, 1.0f};
1103 return compare_f32(expected, output, 4);
1104}
bool compare_f32(const float *a, const float *b, size_t n, float eps=0.001f)
platforms::simd_f32x4 simd_f32x4
Definition types.h:27

References compare_f32().

Referenced by getTests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: