Before I start working on I’d like to summarise things that should be done for interframe encoding.
Here is the minimum that should be done for a proper encoding (and not just pretending that your frame composed entirely from intra blocks is interframe):
- encode various block types (this is straightforward);
- encode motion vectors (this should be easy);
- extend existing code to work with inter and not just intra data (this should not pose much problems either);
- reconstruct the encoded frame (this is rather straightforward too).
Here are the things that should be done to push it behind just a toy encoder:
- motion search (so it should code something beside intra and zero motion blocks);
- custom probabilities generation for macroblock type models (this one is tricky since it’s transmitted as an index to one of the predefined coefficient sets with possible refinement that is then used to generate probabilities for 10×10 set);
- golden frame usage (probably I’ll simply mark any sufficiently different frame as a golden one; extending motion search to it is trivial).
And finally here are the things that should make it into a decent encoder:
- fast motion search (that should be a separate post or two);
- subpixel motion search (which is just a refinement of the previous step);
- smart golden frame selection (I’m not sure if I’ll bother with it);
- deciding whether to code current macroblock as intra or inter (that one might get hairy);
- implementing advanced profile features like bicubic/bilinear filter selection (I’m not likely to ever touch that).
There is some advanced stuff applicable to the all frames, namely which quantiser to choose and how to maintain a bitrate. That deserves several posts as well.
The main problem that is hard to avoid though is the curious decision to filter reference frame depending on current frame quantiser (unlike H.26x codecs where you filter the block edges right after decoding the frame). I think at first I’ll ignore it entirely for motion search (but will take it into account during frame reconstruction) and later maybe I’ll create filtered frames specially for the current quantiser.
It is not too late to chicken out, right?
[…] Kostya's Rants around Multimedia « VP6 — interframe encoder roadmap […]