View Full Version : Has anyone tried using these algorithms in a codec?


Dreddlox
5th May 2005, 07:24
For a while I have been meaning to start a codec to test my frequent ideas for compression algorithms, but have always encountered obstacles. So instead, to get these ideas off my mind, I'll ask: Has anyone experimented with these techniques in video encoding?

Macro-DCT: After an image has been DCT'd, MPEG style, grouping all of frequencies and performing a second DCT on them(ie. The first macro-DCT block would be the DCT of the first elements of each of the DCT'd blocks)

Per-pixel motion: I noticed in XviD, motion is only expressed in warp-points, which dont get quantized and have a resolution of an eighth of the image. I think instead of having macroblock warppoints, it would be better to have quantized, DCT'd, per-pixel motion. This would greatly decrease the overhead of large resolutions, make larger macroblocks viable and create less of a problem when multiple moving objects inhabit the same macroblock.

Quantized RLE: Anime isn't compressed very well with DCT, RLE would be far more suitable, and 1st or 2nd derivative images quantize without requiring dithering :-D

Anyone who can say they've tried one of these, how did it turn out? did you test it on both cartoons and real video? are there any lessons I should learn if I ever manage to implement these?

Regarding quantized RLE, I did a test to see just how bad DCT was with anything with edges, I got a BMP full of text and saved it as a PNG, and a JPG. Im sure you know paint is terrible at saving both, however, the PNG, which is lossless, took up half as much space as the JPG.

Im considering just shelling out the Xvid codec to try some of these in, but time is always against me.

akupenguin
5th May 2005, 10:29
Macro-DCT: After an image has been DCT'd, MPEG style, grouping all of frequencies and performing a second DCT on them(ie. The first macro-DCT block would be the DCT of the first elements of each of the DCT'd blocks)
H.264's Intra 16x16, for one. But in general, if you want such a multiresolution transform, wavelets work better.

Per-pixel motion: I noticed in XviD, motion is only expressed in warp-points, which dont get quantized and have a resolution of an eighth of the image. I think instead of having macroblock warppoints, it would be better to have quantized, DCT'd, per-pixel motion. This would greatly decrease the overhead of large resolutions, make larger macroblocks viable and create less of a problem when multiple moving objects inhabit the same macroblock.
The common version of this is called 'mesh-based MC'. Yes, it is better than simple block MC, but not as good as overlapped block MC. And mesh is slow to encode (more complicated RD decisions) and slow to decode (hard to SIMD). The normal implementation of mesh just downsamples the motion field and interpolates; if you use DCT you'll also run into weird artifacts with MVs ringing near object edges.

Quantized RLE: Anime isn't compressed very well with DCT, RLE would be far more suitable, and 1st or 2nd derivative images quantize without requiring dithering
Pixel-space quantization? Not gonna work for anything other than lossless encoding. There are a variety of edge/gradient-based transforms out there, but I don't know of any that have been incorperated into a video codec.

Dreddlox
5th May 2005, 10:57
Although I dont think you understood what I meant by macro-DCT, I now see that macro-DCT looks fairly useless in the eyes of just using a bigger DCT...have any codecs taken DCT size to an extreme yet?

With the RLE idea, the lossless style that PNG used was inspiration, but being able to quantize it would help significantly...for instance, in a scan line from a cartoon, if you took the 2nd derivative, you would get edges and noise. A bit of quantization and you're left with just edges.
Comparing the lossless forms of the algorithms, edges and gradients compress alot better with pixel based encoding than DCT. So in theory it should work...

Thanks for the reply, I now know to just focus my energies into lossy pixel-based encoding

Kurosu
5th May 2005, 19:12
Originally posted by Dreddlox
Macro-DCT: After an image has been DCT'd, MPEG style, grouping all of frequencies and performing a second DCT on them(ie. The first macro-DCT block would be the DCT of the first elements of each of the DCT'd blocks)
Henrique Malvar has done some work on various lapped transforms. Some of them have DCT-like transforms plus additional stages that could match what you describe. Microsoft's research website (research.microsoft.com) is a common place to find his publications.

If you are into patent reading, you could check the corresponding lists of patents granted (http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2Fsearch-adv.htm&r=0&p=1&f=S&l=50&Query=abst%2Flapped+and+abst%2Ftransform+and+an%2Fmicrosoft&d=ptxt) and filed (http://appft1.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2FPTO%2Fsearch-adv.html&r=0&p=1&f=S&l=50&Query=abst%2Flapped+and+abst%2Ftransform+and+an%2Fmicrosoft&d=PG01)

[edit]
Btw, as you are also talking of lossless encoding and anime-oriented content compression, there are interesting readings to do on JPEG-LS for one topic and {curve/band/ridge}lets for the other.

Richard Berg
5th May 2005, 20:08
I think adaptive (2-pass) huffman coding would be superior to RLE for storing the raster part of a "vector" (ridgelet) codec. Has anyone compared them?

morsa
6th May 2005, 05:05
well, if that were the case, then ranged encoding would be far better at compression than any possible huffman.