← All work
Project 02 · VIDEO EDITOR

Cutline

A non-linear video editor with its own H.264 decoder, audio mixer and GPU compositing pipeline. No FFmpeg, no media frameworks.

LANGUAGEC++ · GLSL
LINES WRITTEN96,418
TIME SPENT11 months
STATUSShipped
REFERENCEITU-T H.264
The challenge

Edit and preview 4K footage in real time without relying on any existing codec or media library.

The approach

The decoder follows the H.264 standard section by section, verified frame-by-frame against reference bitstreams. Decoded frames go straight to GPU textures, where a small compositor handles cuts, blends and colour.

The layers Every subsystem, with the code it took and the time it took to write.
01
Container parsing (MP4)
6,120 lines4 weeks
02
H.264 decoder
31,840 lines4 months
03
Audio engine
9,870 lines6 weeks
04
GPU compositor
18,233 lines2 months
05
Timeline & UI toolkit
30,355 lines3 months
From the source Arithmetic decoding, straight from §9.3 of the standard
cutline/decode/cabac.cpp
// CABAC arithmetic decoding, ITU-T H.264 §9.3.3.2
int decode_bin(Cabac *c, u8 *state) {
u32 range_lps = RANGE_TAB[*state >> 1][(c->range >> 6) & 3];
c->range -= range_lps;
int bin = *state & 1;
if (c->offset >= c->range) {
c->offset -= c->range;
c->range = range_lps;
bin ^= 1;
}
return renorm(c), bin;
}
Milestones
Jan 2025 First I-frame decoded to a PNG
Apr 2025 Full baseline profile, real-time at 1080p
Aug 2025 B-frames, main profile and 4K preview
Dec 2025 Cutline 1.0 released
NEXT PROJECT Facet