Parametric Press Unravels The JPEG Format

This is the first we’ve heard of Parametric Press — a digital magazine with some deep dives into a variety of subjects (such as particle physics, “big data” and such) that have interactive elements or simulations of various types embedded within each story.

The first one that sprung up in our news feed is a piece by [Omar Shehata] on the humble JPEG image format. In it, he explains the how and why of the JPEG encoding process, allowing the reader to play with the various concepts along the way, in real time, within the browser.

RGB colour-space subsampling doesn’t affect each component to the same degree due to the human eye cone cell response. Also, the chroma components are much less affected than the luminance.

For those not familiar with the format, the first step (which is actually optional) to JPEG encoding is to transform the image from the RGB color space, into a YCbCr (luminance, chrominance) color space. Since the human eye is far more sensitive to luminance (brightness) differences than it is to Cb (chroma relative blueness) and Cr (chroma relative redness) differences, these latter two components can be subsampled by only storing a single value for each, in every 2×2 pixel matrix. JPEG allows other matrix sizes, but 2×2 is the most common.

This sets the scene for the clever bit, that comes next and allows more of that harder-to-perceive chroma information to be discarded. It’s fun to play with the chroma sub-sampling slider and see how the different colours are not equally affected, due to the relative sensitivities of the human eye cone cells.

Next, the three YCbCr components are treated independently to a discrete cosine transform and quantization. This transforms each 8×8 pixel block into 64 discrete spatial frequencies. The JPEG compression level (which you can change) affects how many of the upper-frequency components get discarded, and thus how much of the fine spatial detail gets discarded. This is the main source of JPEG image quality loss. Finally, the compressed blocks are delta encoded, where each subsequent block is coded as the difference from the previous one. Like chroma subsampling, this doesn’t offer any compression on its own but allows the subsequent run-length encoding to be more effective, giving more (lossless) compression. Finally, the whole lot is then Huffman compressed with a unique table stored in the JPEG header. So want to play with JPEGs some more? here’s the GitHub source.

If all of this theoretical stuff is a bit useless to you, perhaps you just want to decode some JPEGs, then here is a speedy library for just that.

All About USB-C: Talking Low-Level PD

In this USB-C series, we’ve covered quite a bit of USB-C – things that are well known, things that should beĀ  better known, and a couple things that just appeared online for the first time. We’ve covered almost everything in some depth except USB Power Delivery. I’ve described the process a bit in the “Power” article, but that was mostly about how to use PD by simply buying the right solution. However, that’s not enough for a hacker. Let’s see if we can make our own PD trigger board. Continue reading “All About USB-C: Talking Low-Level PD”

Citizen Science Finds Prehistoric Burial Mounds

What do you do when you have a lot of LiDAR data and not enough budget to slog through it? That’s the problem the Heritage Quest project was faced with — they had 600,000 LiDAR maps in the Netherlands and wanted to find burial mounds using the data. By harnessing 6,500 citizen scientists, they were able to analyze the data and locate over 1,000 prehistoric burial mounds, including many that were previously unknown, along with cart tracks, kilns, and other items of archaeological interest.

The project used Zooniverse, a site we’ve mentioned before, to help train volunteers to analyze data. The project had at least 15 volunteers examining each map. The sites date between 2,800 and 500 BC. Archaeologists spent the summer of 2021 verifying many of these digital finds. They took samples from 300 sites and determined that 80 of them were previously unknown. They estimate that the total number of sites found by the volunteers could be as high as 1,250.

This is a great example of how modern technology is changing many fields and the power of citizen science, both topics we always want to hear more about. We’ve seen NASA tapping citizen scientists, and we’ve even seen high school students building research buoys. So if you’ve ever wanted to participate in advancing the world’s scientific knowledge, there’s never been a better time to do it.

1950s Fighter Jet Air Computer Shows What Analog Could Do

Imagine you’re a young engineer whose boss drops by one morning with a sheaf of complicated fluid dynamics equations. “We need you to design a system to solve these equations for the latest fighter jet,” bossman intones, and although you groan as you recall the hell of your fluid dynamics courses, you realize that it should be easy enough to whip up a program to do the job. But then you remember that it’s like 1950, and that digital computers — at least ones that can fit in an airplane — haven’t been invented yet, and that you’re going to have to do this the hard way.

The scenario is obviously contrived, but this peek inside the Bendix MG-1 Central Air Data Computer reveals the engineer’s nightmare fuel that was needed to accomplish some pretty complex computations in a severely resource-constrained environment. As [Ken Shirriff] explains, this particular device was used aboard USAF fighter aircraft in the mid-50s, when the complexities of supersonic flight were beginning to outpace the instrumentation needed to safely fly in that regime. Thanks to the way air behaves near the speed of sound, a simple pitot tube system for measuring airspeed was no longer enough; analog computers like the MG-1 were designed to deal with these changes and integrate them into a host of other measurements critical to the pilot.

To be fair, [Ken] doesn’t do a teardown here, at least in the traditional sense. We completely understand that — this machine is literally stuffed full of a mind-boggling number of gears, cams, levers, differentials, shafts, and pneumatics. Taking it apart with the intention of getting it back together again would be a nightmare. But we do get some really beautiful shots of the innards, which reveal a lot about how it worked. Of particular interest are the torque-amplifying servo mechanism used in the pressure transducers, and the warped-plate cams used to finely adjust some of the functions the machine computes.

If it all sounds a bit hard to understand, you’re right — it’s a complex device. But [Ken] does his usual great job of breaking it down into digestible pieces. And luckily, partner-in-crime [CuriousMarc] has a companion video if you need some visual help. You might also want to read up on synchros, since this device uses a ton of them too.

Continue reading “1950s Fighter Jet Air Computer Shows What Analog Could Do”

An Open Hardware Eurorack Compatible Audio FPGA Front End

[Sebastian Holzapfel] has designed an audio frontend (eurorack-pmod) for FPGA-based audio applications, which is designed to fit into a standard Eurorack enclosure. The project, released under CERN Open-Hardware License V2, is designed in KiCAD using the AK4619VN four-channel audio codec by Asahi Kasei microdevices. (And guess what folks, there’s plenty of those in stock!) Continue reading “An Open Hardware Eurorack Compatible Audio FPGA Front End”

Screenshot of KiCad 7 feature that lets you overlay a PCB bitmap image and draw traces over it, being used for board reverse-engineering purposes

KiCad 7.0.0 Is Here, Brings Trove Of Improvements

Yesterday, the KiCad team has released KiCad 7.0.0 – a surprise for those of us who have only gotten used to the wonders of KiCad 6, and it’s undoubtedly a welcome one! Some of these features, you might’ve seen mentioned in the KiCad 2022 end-of-year recap, and now, we get to play with them in a more stable configuration. There’s a trove of features and fixes for all levels of KiCad users, beginners, hobbyists and professionals alike – let’s start with some that everyone can appreciate! Continue reading “KiCad 7.0.0 Is Here, Brings Trove Of Improvements”

How To Roll Your Own Custom Object Detection Neural Network

Real-time object detection, which uses neural networks and deep learning to rapidly identify and tag objects of interest in a video feed, is a handy feature with great hacker potential. Happily, it’s also possible to make customized CNNs (convolutional neural networks) tailored for one’s own needs, and that process just got easier thanks to some new documentation for the Vizy “AI camera” by Charmed Labs.

Raspberry Pi-based Vizy camera

Charmed Labs has been making hacker-friendly machine vision devices for a long time, and the Vizy camera impressed us mightily when we checked it out last year. Out of the box, Vizy has a perfectly functional object detector application that runs locally on the device, and can detect and tag many common everyday objects in real time. But what if that default application doesn’t quite meet one’s project needs? Good news, because it’s possible to create a custom-trained CNN, and that process got a lot more accessible thanks to step-by-step examples of training a model to recognize hands doing rock-paper-scissors.

Person and cat with machine-generated tags identifying them
Default object detection works well, but sometimes one needs custom results.

The basic process is this: Start with a variety of images that show the item of interest. Then identify and label the item of interest in each photo. These photos (a “training set”) are then sent to Google Colab, which will be used to generate a neural network. The resulting CNN model can then be downloaded and used, to see how well it performs.

Of course things rarely work perfectly the first time around, so at this point it’s pretty common for some refinement to be needed to increase accuracy. Luckily there are a number of tools to help do this without creating a new model from scratch, so it’s just a matter of tweaking until things perform acceptably.

Google Colab is free and the resulting CNNs are implemented in the TensorFlow Lite framework, meaning it’s possible to use them elsewhere. So if custom object detection has been holding up a project idea of yours, this might be what gets you over that hump.