a decade or so ago, I was writing a H.264 decoder (needed a custom one for stupid reasons which of course had to do with hardware reverse engineering).

the first order of business was to implement CABAC: the final entropy coding stage of H.264 (ie. the first layer I had to peel starting from the bitstream), a funny variant of arithmetic coding. the whole thing is quite carefully optimize to squeeze out bits from video frames by exploiting statistics. in addition to carefully implementing the delicate core logic, I also had to copy-paste a few huge probability tables from the PDF, which of course resisted copy-paste as PDFs like to do and I had to apply some violence until it became proper static initializers in C source code.

furthermore, testing such code is non-trivial: the input is, of course, completely random-looking bits. and the way bitstreams work, I’d have to implement pretty much the whole thing before I got to the interesting part.

so, a few hours later, I figured I’m done with CABAC and reconstructing H.264 data structures, and pointed my new tool at some random test videos. and it worked first try! the structures my program spit out looked pretty much as expected, the transform coefficient matrices had pretty shapes and looked just as you’d expect them to, and I was quite happy with that.

and then I moved on to actually decoding the picture from the coefficients, and this time absolutely nothing worked. random garbage on screen. I spent a long time looking at my 2D transform code searching for bugs, but couldn’t find anything.

and then it hit me exactly what “entropy coding” means. I implemented something that intimately knows and exploits the statistical properties of what video transform coefficients and other structures look like, their probabilities and internal correlations, and uses that to squeeze out entropy and reconstruct it on the other end. my “looks good” testing meant absolute jack shit: I could’ve thrown /dev/urandom into the CABAC decoder instead of actual H.264 video, and it would still look like good video data at this stage until you actually tried to reconstruct the picture.

and sure enough, it turned out I fucked up transcribing some rows from the PDF around a page break or something.

10 years later, I think of this experience every time I see a vibecoded pull request, or other manifestation of AI bullshit. all the right shape, and no substance behind it.

and people really should learn to tell the fucking difference.

@[email protected] Michael Crichton took great pains to make a similar point. In Jurassic Park, there's a lot of talk between Ian Malcolm (the mathematician) and some of the scientists at the park while they try and figure out what happened.

They took surveys of the dinosaur's sizes and had a nice Gaussian/normal distribution and went okay, great, looks fantastic, and never looked at them again. Ian interrogates them on this: supposedly, they only hatched 'female' dinosaurs and released them into the park. But hatching occurred in stages! They'd done three staged hatches, so far. And if there was no breeding in the wild, then they should have seen not one well formed Gaussian distribution of size, but instead a size graph with three peaks, each peak corresponding to one of the hatchings/release.

The scientists saw the 'expected' graph and thought great, it looks fine, everything is good. Even though their expectation was not only wrong, but in actuality, a well formed normal distribution meant breeding was happening in the wild (because now eggs were hatching regularly instead of just when they did it, so dinosaurs of all sizes were appearing). They ignored evidence because it fit with their expectation and a lot of people died because of it.

man oh man, it's almost like there's so many examples of this particular problem...