OpenPack and related functions expect a file that is a sequence of
"pack files" that have this format:

  32BIT (little-endian) uncompressed_size
  32BIT (little-endian) compressed_size
  DATA, length compressed_size

If the sizes are equal, the DATA is the packed file.
If the sizes are not equal (and the DATA has the right signature?) then
the DATA is compressed with the JCalG1 algorithm.

Format of the JCalG1 data. First a header:

  8BIT 0x4a 'J'
  8BIT 0x43 'C'
  32BIT (little-endian) uncompressed_size
  32BIT (little-endian) checksum

The rest of the data is encoded as a stream of bits, though the bits are
packed little-endian in chunks of 32. The stream contains a sequence of
data elements, each of which is headed by a series of control bits.

Note: In the definitions below, HEAD is the current edge of the decoded
stream, it points at the location where the next byte will be written.
It's always assumed that bytes from HEAD onwards are still 00 while decoding.

Initial values of the decompression parameters:
  IndexBase = 8
  LastIndex = 1
  MinimumLiteral = ?  (assume 0)
  LiteralBits = ?     (assume 8)

The type of data element depends on the control bits, one pattern of:
    1 Literal. Followed by LiteralBits bits. Add Minimum Literal to that
               number to get the next byte of decompressed data.
    01 Normal phrase. Followed by gamma-encoded integer G.
        If G = 2: Repeated phrase. Get second gamma-encoded integer L,
                     then re-use L bytes starting HEAD-LastIndex
        else: Followed by IndexBase bits, which form the lower-order
              bits of the new IndexBase, while the higher-order bits
              are set to (G-3). 
              Then get second gamma-encoded integer L.
              If IndexBase >= 0x10000, then L += 3
              Else if IndexBase >= 0x37FF, then L += 2
              Else if IndexBase >= 0x27F, then L += 1
              Else if IndexBase <= 0x7F, then L += 4
              Then re-use L bytes starting HEAD-LastIndex
    000xxxxxxxyy Short match
         Re-use (yy+2) bytes starting HEAD-xxxxxxx (7 bits x),
           LastIndex = xxxxxxx
    0000000000yy New index base. Next (yy+3) bits are new IndexBase
    000000000000 End of compressed data
    001000000xxxxxxxx LiteralBits = 7, MinimumLiteral = xxxxxxxx (8 bits x)
    001000001 LIteralBits = 8, MinimumLiteral = 0
    00100001 Block sequence: blocks of 2048 bytes (256 bytes) of literal data,
             followed by a 1 bit to mark another block coming, and a 0 bit
             to mark the end of the blocks.
    0010001 literal byte 00 (which is a special case of HEAD-0)
    001xxxx singe byte at HEAD-(xxxx-1)  (4 bits x)

Gamma-encoding of integers is as x(1x1x1x...)0, with the x bits making
up the integer. The most significant bit of the integer is not part of
the encoding, which means that only integers greater than 1 can be encoded
this way.

The checksum does not seem to be the one from JCalG1.
