aboutsummaryrefslogtreecommitdiff
path: root/evc/spec.md
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-12-08 20:13:17 +0100
committermetamuffin <metamuffin@disroot.org>2022-12-08 20:13:17 +0100
commita92c9958a539eccd545b4947202a1c9b39953851 (patch)
tree38f6c29ccf10f79ab871de3b05577eab704ef123 /evc/spec.md
parent6001cdeff335e12583a398acbb5a8a42c01bc077 (diff)
downloadvideo-codec-experiments-a92c9958a539eccd545b4947202a1c9b39953851.tar
video-codec-experiments-a92c9958a539eccd545b4947202a1c9b39953851.tar.bz2
video-codec-experiments-a92c9958a539eccd545b4947202a1c9b39953851.tar.zst
refactor spec
Diffstat (limited to 'evc/spec.md')
-rw-r--r--evc/spec.md70
1 files changed, 49 insertions, 21 deletions
diff --git a/evc/spec.md b/evc/spec.md
index 77f6b7d..f35128d 100644
--- a/evc/spec.md
+++ b/evc/spec.md
@@ -1,4 +1,32 @@
-# The Experimental Video Codec
+# Low-Efficiency Video Codec
+
+The codec compresses image sequences by avoiding redundancies by reusing parts
+of previous frames. A frame is one block that is then subdivided further as
+needed.
+
+## Literal-Block
+
+Stores the pixels' RGB values as is.
+
+## Split-Block
+
+Delegates to two sub-blocks. The block is split orthorgonally on the longest
+axis. If needed, the left/top block is rounded down and the right/bottom.
+
+## Reference-Block
+
+Indicates that parts of the last frame are reused. The data reused is at the
+position of this block in the last frame with the translation added.
+
+## Advanced-Reference-Block
+
+Like Reference-Block but instead translates by non-integer amount of pixels,
+applying a 2x2 matrix from the center of the block and multiplying the color
+value of each component, interpolating if necessary.
+
+## Compressed-Literal-Block
+
+_**JPEG? just DCT? idk**_
## File format
@@ -6,27 +34,27 @@
- resolution: _`u16, u16`_
- frame count: _`u64`_
- frames (repeated [frame count]-times)
- - block type
- - block
- - 0 **Literal-Block** (pixels saved)
- - pixels: _`[[u8; 3]]`_
- - 1 **Split-Block** (delegated to 2 sub-blocks split on the longest axis)
+ - block kind: _`u8` (see tags below)_
+ - block: _one of the following_
+ - 0 **Literal-Block**
+ - pixels: _`[[u8; 3]; (inferred)]`_
+ - 1 **Compressed-Literal-Block**
+ - length: _`u32`_
+ - data: _`[[u8; length]`_
+ - 2 **Split-Block**
- sub-blocks: _`[block; 2]` (see above)_
- - 2 **Reference-Block** (reuses previous frame in some way)
+ - 3 **Reference-Block**
- translation: _`i8, i8`_
- - 3 **Advanced-Reference-Block** (reuses previous frame in some way)
- - translation: _`s8, s8`_ (translation encoded as _floats_)
- - transform: _`s8, s8, s8, s8`_ (2x2-matrix of _floats_ applied before
- sampling)
- - value_scale: _`i8`_ (represents multiplication of each color component
- with $1.05^n$)
-
-### _`s8`_
-
-8-bit scalar. When read as _`i8`_ represents a value of $\frac{x}{|x|} *
-\sqrt{2}^{|{x}| - 4}$ for $x \neq 0$, otherwise 0.s
+ - 4 **Advanced-Reference-Block**
+ - translation: _`s8, s8`_ (translation)
+ - transform: _`s8, s8, s8, s8`_ (2x2-matrix applied before sampling
+ relative to the center)
+ - value_scale: _`i8`_ (multiplication of each color component by $1.05^n$)
-### Todo
+### Data Types
-- JPEG compress Literal-Blocks
-- general compression (gzip oder so)
+- _`u<n>`_: unsigned n-bit integer (little-endian)
+- _`i<n>`_: signed n-bit integer using twos-complement (little-endian)
+- _`s8`_: 8-bit scalar. When read as _`i8`_ represents a value of
+ $\frac{x}{|x|} * \sqrt{2}^{|{x}| - 4}$ for $x \neq 0$, otherwise 0
+- _`[<T>; <N>]`_: Array of T with length N