ClearVideo briefly revisited

Since I had nothing better to do for the rest of this year (I expect the next year to begin in the same fashion) I decided to take a look at the problem when some files were decoded with inter-frames becoming distorted like there’s some sharpening filter constantly applied. And what do you know, there’s some smoothing involved in certain cases.

It turns out that if there’s a special frame header bit set, ClearVideo employs overlapping in inter-frames so it’s not just a block copied as as but one-pixel edge around it is blended as well. So on edges you need to weighted-sum several pixel values which creates a nice deblocking effect without actually using one.

Here are weight matrices for 1×1, 2×2, 4×4 and 8×8 blocks if you’re curious:


1 2 1
2 4 2
1 2 1

1 3 3 1
3 9 9 3
3 9 9 3
1 3 3 1

1  3  4  4  3  1
3  9 12 12  9  3
4 12 16 16 12  4
4 12 16 16 12  4
3  9 12 12  9  3
1  3  4  4  3  1

1  3  4  4  4  4  4  4  3  1
3  9 12 12 12 12 12 12  9  3
4 12 16 16 16 16 16 16 12  4
4 12 16 16 16 16 16 16 12  4
4 12 16 16 16 16 16 16 12  4
4 12 16 16 16 16 16 16 12  4
4 12 16 16 16 16 16 16 12  4
4 12 16 16 16 16 16 16 12  4
3  9 12 12 12 12 12 12  9  3
1  3  4  4  4  4  4  4  3  1

For the record here’s how the old decoder treated the fiftieth frame of Nick Pope.avi (all previous frames but the first one were inter-frames as well so the error has accumulated):

(the frame has been scaled 4x for convenience and squeezed to fit the column by WordPress for inconvenience).

And here’s a new one:

P.S. I don’t think I’ll encounter any other file that uses yet another feature of ClearVideo (like really old version for example) so I consider this format done and hopefully I’ll never have to return to it. As for other codecs in NihAV with known decoding issues, there are two: Bink2 and H.264. And I’m not going to do anything about either of them because I don’t really need playing either of them (well, it may get different with H.264) and it would take too much time to debug either of them so I’d rather do something else.

Comments are closed.