Skip to main content

I’m Alex a software engineer.

Getting rustc to use AVX2 SIMD

SIMD roughly means CPU instructions that do multiple things at once. Making use of them can make algorithms faster. The rust compiler actually uses them automatically, but it doesn’t for newer SIMD instructions like SSE4.2 & AVX2. SIMD Feature Coverage SSE2 100% SSE4.2 99.1% AVX2 89.2% AVX512F 8.73% Steam survey October 2022 Rustc can’t use them by default because not every CPU will work with them. But these days most CPUs do support these newer instructions and so certain tasks can be a lot faster for a lot of people.

ab-av1: Letting other encoders in to the party

Since posting about ab-av1 I’ve been improving the tool. v0.2.0 brought support for automatic key interval setting, arbitrary svt-av1 arguments, configurable vfilters & pixel format. Later in v0.3.0 I improved VMAF with automatic model selection & automatic upscaling to the selected model. When I found myself wanting to encode in an older format (e.g. x264/x265) to target somewhere without as good av1 support, I really missed not being able to use ab-av1’s auto-encode / crf-search.

Rust async batching with benjamin-batchly

Sometimes instead of doing lots of little things concurrently, it is better to bundle them together and do them all at once, as a batch. So on a bank holiday Thursday morning I awoke early (mostly due to the screams of my 1 year old boys) and (after the screaming stopped) wrote a crate to help do that: benjamin_batchly. Example: Inserting into a database A recurring theme of database optimisation is reducing “trips” to the database.

AV1 encoding: ab-av1

In my previous post I looked at video encoding using svt-av1 with crf & preset settings and using VMAF to rate the resultant quality. Av1 encoding is reasonably fast now, but encoding a full video then checking the VMAF potentially multiple times to find a good crf & preset… that is going to be not so fast. Sample encoding My answer was to cut a small section of the vid.mp4 original video, say 20s long, and encode that.

AV1 encoding: SVT-AV1 & VMAF

I’ve been experimenting with av1 video encoding for a while now. Av1 is a royalty free video codec set to replace existing codecs with better quality and/or lower bitrates. Support for it is somewhat decent now. Back when I first tried it I found the encoding speed (using the reference encoder libaom) to be just too slow. However, I later read about the svt-av1 encoder over at phoronix which offers much faster encoding.

Game years

In 2017 I quit my job to make a PC programming puzzle game Robo Instructus. One aspect in particular I worked on in some depth was text rendering. Robo Instructus has a lot of text & there just wasn’t the libraries in the Rust ecosystem that could perform as I needed, particularly compiled in debug mode (and I’m not waiting for rust –release compiles after each code change!). So I took over maintenance of rusttype and fixed my issues with it & its “gpu cache” module.