PH Video
- Company: Total Multimedia
- Extension: ph
This is a video format used in some interactive encyclopedias.
The data is organised into chunks that are grouped together in large blocks.
Large block header:
2 bytes - "PH" 4 bytes - previous block size 4 bytes - current block size 2 bytes - next block size (low bits) 2 bytes - unknown (often 7) 2 bytes - number of chunks in the block
Chunks start with 16-bit chunk ID and 16-bit size. The following chunk IDs are known:
0x1010
- sync information (32-bit frame number, 32-bit delay in tertias, unknown 32-bit value)0xA0A8
,0xA016
,0xA024
,0xA032
,0xA044
- audio chunks with 8/15/22.05/32/44.1 kHz monaural 8-bit audio0xA1A8
,0xA116
,0xA124
,0xA132
,0xA144
- audio chunks with 8/15/22.05/32/44.1 kHz stereo 8-bit audio0xB0B2
- VGA palette update (first two bytes signal the start and length of the update, there may be junk colour data)0xB0B3
- always empty chunk0xC0C1
- unknown old frame compression0xC0C2
- intra frame0xC0C3
- inter frame
Video coding
Frame header:
2 bytes - unknown 2 bytes - frame height 2 bytes - frame width 2 bytes - unknown 2 bytes - unknown (inter only) N bytes - update map (inter only, 1 bit per 2x2 block)
Video compression employs RLE with 4-bit run lengths packed into bytes and interspersed with other data. Decoding consists of reading a pair of opcodes first and processing them, reading additional data if needed. Low seven bits of opcode are used as a colour value, top bit signals it is a run and its length (minus one) should be retrieved - either by reading a byte and using its low nibble or by using high nibble from such previously read value.
Additionally for inter frames the decoded data is used along with the update map to update previous frame (i.e. if the bit is set for a block then four bytes from the RLE-decoded data should be used to paint it, otherwise block is left unchanged). For intra data the decoded RLE data is new frame value.