svn commit: r245197 - user/adrian/ath_radar_stuff/src/spectral_fft

Adrian Chadd adrian at FreeBSD.org
Wed Jan 9 00:01:27 UTC 2013


Author: adrian
Date: Wed Jan  9 00:01:26 2013
New Revision: 245197
URL: http://svnweb.freebsd.org/changeset/base/245197

Log:
  Implement a separate pixel set function for the average points, to implement
  a really stupidly simple heatmap (blue -> blue+green) for points that
  saturate the blue opacity.
  
  This makes the "very frequent" points very obvious.

Modified:
  user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c

Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c
==============================================================================
--- user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c	Wed Jan  9 00:00:34 2013	(r245196)
+++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_eval.c	Wed Jan  9 00:01:26 2013	(r245197)
@@ -156,14 +156,58 @@ int bigpixel(Uint32 *pixels, int x, int 
 	for (y1 = y - SIZE; y1 < y + SIZE; y1++) {
 		Uint32 r, g, b;
 
-		r = ((pixels[x1 + y1 * WIDTH] & RMASK) >> RBITS) + ((((color & RMASK) >> RBITS) * opacity) / 255);
+		r = ((pixels[x1 + y1 * WIDTH] & RMASK) >> RBITS) +
+		    ((((color & RMASK) >> RBITS) * opacity) / 255);
 		if (r > 255) r = 255;
-		g = ((pixels[x1 + y1 * WIDTH] & GMASK) >> GBITS) + ((((color & GMASK) >> GBITS) * opacity) / 255);
+
+		g = ((pixels[x1 + y1 * WIDTH] & GMASK) >> GBITS) +
+		    ((((color & GMASK) >> GBITS) * opacity) / 255);
 		if (g > 255) g = 255;
-		b = ((pixels[x1 + y1 * WIDTH] & BMASK) >> BBITS) + ((((color & BMASK) >> BBITS) * opacity) / 255);
+
+		b = ((pixels[x1 + y1 * WIDTH] & BMASK) >> BBITS) +
+		    ((((color & BMASK) >> BBITS) * opacity) / 255);
 		if (b > 255) b = 255;
 
-		pixels[x1 + y1 * WIDTH] = r << RBITS | g << GBITS | b << BBITS | (color & AMASK);
+		pixels[x1 + y1 * WIDTH] = r << RBITS |
+		    g << GBITS | b << BBITS | (color & AMASK);
+	}
+	return 0;
+}
+
+int bighotpixel(Uint32 *pixels, int x, int y, Uint32 color, uint8_t opacity)
+{
+	int x1, y1;
+
+	if (! is_in_viewport(x, y))
+		return -1;
+
+	for (x1 = x - SIZE; x1 < x + SIZE; x1++)
+	for (y1 = y - SIZE; y1 < y + SIZE; y1++) {
+		Uint32 r, g, b;
+
+		r = ((pixels[x1 + y1 * WIDTH] & RMASK) >> RBITS) +
+		    ((((color & RMASK) >> RBITS) * opacity) / 255);
+		if (r > 255) r = 255;
+
+		g = ((pixels[x1 + y1 * WIDTH] & GMASK) >> GBITS) +
+		    ((((color & GMASK) >> GBITS) * opacity) / 255);
+		if (g > 255) g = 255;
+
+		/* If we've capped out blue, increment red */
+		b = ((pixels[x1 + y1 * WIDTH] & BMASK) >> BBITS);
+		if (b > 248) {
+			/* green bumped by bluemask */
+			g = ((pixels[x1 + y1 * WIDTH] & GMASK) >> GBITS) +
+			    ((((color & BMASK) >> BBITS) * (opacity/2)) / 255);
+			if (g > 255) g = 255;
+		} else {
+			b = ((pixels[x1 + y1 * WIDTH] & BMASK) >> BBITS) +
+			    ((((color & BMASK) >> BBITS) * opacity) / 255);
+			if (b > 255) b = 255;
+		}
+
+		pixels[x1 + y1 * WIDTH] = r << RBITS |
+		    g << GBITS | b << BBITS | (color & AMASK);
 	}
 	return 0;
 }
@@ -259,7 +303,7 @@ int draw_picture(int highlight, int star
 			color = BMASK | AMASK;
 			opacity = 64;
 			y = 400 - (400.0 + Y_SCALE * signal);
-			if (bigpixel(pixels, x, y, color, opacity) < 0)
+			if (bighotpixel(pixels, x, y, color, opacity) < 0)
 				continue;
 		}
 


More information about the svn-src-user mailing list