-|-------------+--+--+--+--|
-| 1 1 1 1 |hr|hg|hb|ha|
-
-4-bit tag b1111
-1-bit red byte follows
-1-bit green byte follows
-1-bit blue byte follows
-1-bit alpha byte follows
-
-For each set bit hr, hg, hb and ha another byte follows in this order. If such a
-byte follows, it will replace the current color channel value with the value of
-this byte.
-
-
-The byte stream is padded at the end with 4 zero bytes. Size the longest chunk
-we can encounter is 5 bytes (QOI_COLOR with RGBA set), with this padding we just
-have to check for an overrun once per decode loop iteration.
+|-------+-----------------|
+| 1 1 | run |
+`-------------------------`
+2-bit tag b11
+6-bit run-length repeating the previous pixel: 1..62
+
+The run-length is stored with a bias of -1. Note that the run-lengths 63 and 64
+(b111110 and b111111) are illegal as they are occupied by the QOI_OP_RGB and
+QOI_OP_RGBA tags.
+
+
+.- QOI_OP_RGB ------------------------------------------.
+| Byte[0] | Byte[1] | Byte[2] | Byte[3] |
+| 7 6 5 4 3 2 1 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 |
+|-------------------------+---------+---------+---------|
+| 1 1 1 1 1 1 1 0 | red | green | blue |
+`-------------------------------------------------------`
+8-bit tag b11111110
+8-bit red channel value
+8-bit green channel value
+8-bit blue channel value
+
+The alpha value remains unchanged from the previous pixel.
+
+
+.- QOI_OP_RGBA ---------------------------------------------------.
+| Byte[0] | Byte[1] | Byte[2] | Byte[3] | Byte[4] |
+| 7 6 5 4 3 2 1 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 | 7 .. 0 |
+|-------------------------+---------+---------+---------+---------|
+| 1 1 1 1 1 1 1 1 | red | green | blue | alpha |
+`-----------------------------------------------------------------`
+8-bit tag b11111111
+8-bit red channel value
+8-bit green channel value
+8-bit blue channel value
+8-bit alpha channel value