3

I need a simple and fast video codec with alpha support as an alternative to Quicktime Animation which has horrible compression rates for regular video.

Since I haven't found any good open-source encoder/decoder with alpha support, I have been trying to write my own (with inspiration from huff-yuv).

My strategy is the following:

  1. Convert to YUVA420
  2. Subtract current frame from previous (no need for key-frames).
  3. Huffman encode the result from the previous step. Split each frame into 64x64 blocks and create a new huffman table for each block and encode it.

With this strategy I achieve decent compression rate 60-80%. I could probably improve the compression rate by splitting each frame into block after step 1 and add motion vectors to the reduce the data output from step 2. However, better compression-rate than 60% is lower prio than performance.

Acceptable compression-speed on a quad-core cpu 60ms/frame.

However the decoding speed suffers, 40ms/frame (barely real-time with full cpu usage).

My question is whether there is a way to compress video with much faster decoding, while still achieving decent compression rate?

Decoding huffman-coded symbols seems rather slow. I have not tried to use table-lookups yet, not sure if table lookups is a good idea since I have a new huffman table for each block, and building the lookup-table is quite expensive. As far as I have been able to figure out its not possible to make use of any SIMD or GPU features. Is there any alternative? Note that it doesn't have to be lossless.

1 Answer 1

1

You want to try a Golomb Code instead of a Huffman Code. A golomb code is IMO faster to decode then a huffman code. If it doesn't have to be loseless you want to use a hilbert curve and a DCT and then a Golomb Code. You want to subdivide the frames with a space-filling curve. IMO a continous subdivision of a frame with a sfc and also a decode is very fast.

Sign up to request clarification or add additional context in comments.

1 Comment

You want to use a hilbert curve instead of a morton curve.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.