ClearVideo

From MultimediaWiki
Revision as of 11:07, 30 January 2018 by Kostya (talk | contribs) (Update some information)
Jump to navigation Jump to search

ClearVideo is a video encoder ostensibly based on fractals. Alleged to be the basis of certain RealVideo codecs. Also alleged to be patented. A patent search with "iterated" as the assignee name indeed turns up over 20 patents, many of which mention "fractals" and "image compression" in the title. The same decoder core is used for VfW, QT and Real decoders.

One of the peculiarities of the codec is that the codebooks are provided to it externally and usually they are stored as the resources in decoder (or encoder) wrapper. Those tables include:

  • CVLHUFF — single large codebook for 64x64 tile mode interframes (first 1/5th of it is 8-bit code lengths, next 2/5 is 16-bit code values, the rest is 16-bit code symbols)
  • HUFF — codebooks for interframe tree information coding.
  • DCT — intraframe coefficients codebooks
  • VQ — probably suggested block configurations for the encoder, not used by decoder

Extradata

Intraframe decoding

Codebooks

Codebooks are stored in DCT table as the arrays of (32-bit word for code value, 32-bit word for code length) pairs with zero codes for unused entries. There are following tables stored one after another:

  • AC table 1, 24 entries
  • AC table 2, 100 entries
  • AC table 3, 6 entries
  • AC table 4, 40 entries
  • 112*8 bytes - some lookup table
  • 96*8 bytes - some lookup table
  • 120*8 bytes - some lookup table
  • DC table, 127 entries

Bitstream

Bitreader uses 32-bit little-endian words and reads data from MSB.

At least one of the coding methods is based on DCT and works in YUV420 colourspace:

 ac_quant = get_bits(8); // DC quantisers are always 32
 for (all macroblocks) {
    for (i = 0; i < 6; i++)
      block_coded[i] = get_bit();
    for (i = 0; i < 6; i++) {
      if (!block_coded[i]) continue;
      idx = 0;
      while (idx < 64) {
        val = get_code();
        if (val != ESCAPE) {
          unpack val into last, value and skip
          if (get_bit())
            value = -value;
        } else {
          last = get_bit();
          skip = get_bits(6);
          value = get_bits(8); // signed value
        }
        blk[idx] = value;
        idx += skip;
        if (last)
          break;
      }
      unquantise block (with separate quantiser for DC)
      IDCT();
      put_block_clamped();
    }
 }

Interframe decoding

Codebook description

      • TODO***

Bitstream decoding

      • TODO***