ferris blogs stuff

Technical ramblings and other stuff

Twitter Twitter
RSS RSS

23 Mar 2019

Stochastic rounding

So here’s a little quickie based on something I encountered in my new job :) .

The main motivation is that you’d like to work with lower precision numbers than you typically work with for some reason (typically to reduce storage for some model and ideally do faster calculations). But ofc to do that you need to drop some precision, which involves rounding.

Often times this rounding ends up being a floor or towards-zero round, sometimes a nearest round, but whichever you choose you’re still losing fractional information.

So the idea behind a stochastic round is that you use some random number that decides whether you round up or down, instead of always doing one or the other or taking the closest integer. The critical detail here is that the distribution of that number matches that of the fractional part of the number you’re rounding.

read more


11 Feb 2019

rANS on 6502

I’m in the middle of writing several compression-related posts that are all in various stages of completion, and I seem to have already developed a habit of writing waaay too much stuff. So I thought I’d try to write something a bit more short-form (yeah, it’s not really short at all, but whatever) about an experiment I did that actually went pretty well: I implemented an rANS-based packer on C64 for 4k intros, and I’m quite pleased with the results.

OK, so technically it’s an rABS-based packer, the difference here being that it only entropy codes binary symbols. The reason for this is that we typically observe better compression with adaptive modeling, and updating symbol predictions is much, much simpler with a binary alphabet (look ma, no divides!).

read more


10 Feb 2019

Hello world

Hello world!! Time to start another blog. But yeah uhm why?

I’ve been working on a few (particularly compression-related) projects that are difficult to cover nicely in stream format, as I’d like to 1. have the information in writing, which should be easier to digest; and 2. not spend a lot of time preparing for such a stream/series that would be organized enough to be useful. I’d of course still like to do streams on these projects, and plan to do so, but they’d probably be more like high-level overviews with Q&A and would use the relevant blog post(s) as a rough outline and place to point to for learning more.

read more