Shape coding for MPEG-4







To encode a video object plan (for example talking head) efficiently and with a maximum of flexibility, MPEG-4 treats the shape and the texture of a video sequence separately. The shape encoder, which is our concern for this project, compresses a bitmap shape sequence, which can be extracted from the original video by chroma keying.






For Intra-coding of the first shape, we used 2 methods:

Compression ratio:
Lossless
Lossy
Circle
75
87
Freehand shape
41
45
Akiyo
65
77
  The lossless algorithm provides a good performance with simple natural shapes, and remains acceptable for more complicated forms. While the result of the lossy algorithm still looks very close to the lossles one , its performance improvement only matters for rather complicated shapes, where lots of edges exist. However, this is the case for natural video sequences.
It is also useful to notice that the usage of differential code dramatically increases the compression ratio of the Huffman algorithm!

Source code: chain_encode.c, huffmanencode.c, makefile_encode
                     chain_decode.c, huffmandecode.c, makefile_decode

Limitations: The chain coder is implemented for one contour. Nevertheless, it can easily be extended to a general coder by adding new start points.
                       The arithmetic encoder doesn't flush correctly, and other thresholds than 256 and 0 behave incorrectly. These problems should be corrected very soon.