ViewQuest VQC

From MultimediaWiki
Jump to navigation Jump to search

There seem to be four different codec IDs that somewhat differ in frame header format but they all employ the same compression which is splitting frame into stripes, applying 1-D transform which looks like LGT 5/3 wavelet transform, and coding result in 32-bit chunks using fixed quantisation and variable-length codes.

Data Format

After the frame header the actual data follows. Bitstream is coded MSB.

Data is coded as 32-byte chunks with the following scheme: first two bytes are transmitted as is and the rest is coded with the following codes.

 10 - end of chunk
 00 - output 0
 0100 - skip 3 entries
 0101 - skip 4 entries
 0110 - skip 5 entries
 0111 - skip 6 entries
 1100 - output 1
 1101 - output -1
 111000 - output 2
 111001 - output 3
 111010 - output 4
 111011 - signed 8-bit value follows, 0=end of data
 111100 - output -2
 111101 - output -3
 111110 - output -4
 111111 - signed 6-bit value follows

After that values are expanded using fixed quantisation tables and three-pass wavelet transform is applied.

Transform:

 s0 = y0[0] + (y1[0] >> 1);
 for (i = 0; i < size / 2 - 1; i++) {
   dst[i*2]     = s0;
   s0 = y0[i + 1] + ((y1[i] + y1[i + 1]) >> 1);
   dst[i*2 + 1] = ((dst[i*2] + s0) >> 1) - 2 * y1[i];
 }
 dst[width - 2] = s0;
 dst[width - 1] = y0[size / 2 - 1] + ((y1[width / 2 - 1] - 2 * y1[size / 2 - 2]) >> 2) - y1[size / 2 - 2];