DXA: New compression scheme for encode_dxa
|Reported by:||johndoe123||Owned by:||Kirben|
Included is a patch that adds a new experimental
compression scheme to the Dxa encoder.
I tested it with the Dxa videos from the German 4CD
version of Feeble Files. Compared to the current
encode_dxa the total Dxa size (without audio) was about
350 MB smaller with the new scheme.
See the other item for a player.
Now a rough description how it works:
Each frame is divided into 4x4 blocks. For each block
there's a block type and some data.
The frame data is additionally compressed with zlib.
0: skip block
1: diff block (full)
2: solid color block
3: full block
4: motion vector block
10-15: diff block (one byte)
simply skips the current block (i.e. it's unchanged
from the previous frame).
solid color block:
fill the current block with the next byte.
fill the current block with the next 16 bytes.
motion vector block:
read the next byte.
the byte has the bitformat "axxxbyyy", where xxx and
yyy are the relative offsets from
the current block position from where the block should
be copied from.
bits a and b are the sign bits for the x and y offsets.
diff block (full):
read the next unsigned short (little endian).
for each bit in the value (from most to least
significant bit), if the bit is set,
read one pixel, otherwise go to the next pixel.
diff block (one byte):
"one byte" is basically the same as "full" with one
max. 8 pixels are changed (see source for how it works :)
Ticket imported from: #1504492. Ticket imported from: patches/650.