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

◆ calcAverageColorDifference()

float noise_test_helpers::calcAverageColorDifference ( const fl::CRGB * frame1,
const fl::CRGB * frame2,
int num_leds )
inline

Definition at line 8 of file noise_test_helpers.h.

8 {
9 float total_diff = 0.0f;
10 for (int i = 0; i < num_leds; i++) {
11 // Calculate delta for each channel
12 int r_diff = (int)frame1[i].r - (int)frame2[i].r;
13 int g_diff = (int)frame1[i].g - (int)frame2[i].g;
14 int b_diff = (int)frame1[i].b - (int)frame2[i].b;
15
16 // Use Euclidean distance for color difference
17 float pixel_diff = fl::sqrt(r_diff*r_diff + g_diff*g_diff + b_diff*b_diff);
18 total_diff += pixel_diff;
19 }
20 return total_diff / num_leds;
21 }
constexpr enable_if< is_fixed_point< T >::value, T >::type sqrt(T x) FL_NOEXCEPT

References fl::sqrt().

+ Here is the call graph for this function: