BMV: Difference between revisions
(→Audio) |
No edit summary |
||
Line 61: | Line 61: | ||
blobsize--; | blobsize--; | ||
} | } | ||
== Discworld 3 BMV == | |||
=== Container === | |||
Container consists of two chunks - header and data. Each chunk starts with magic ('BMVi' or 'DATA') and payload size. | |||
Header data (little-endian): | |||
bytes 0- 3 'BMVi' | |||
bytes 4- 7 payload size | |||
bytes 8-11 slot size | |||
bytes 12-15 number of frames | |||
bytes 16-17 prefetch slots | |||
bytes 18-19 some cache size | |||
bytes 20-21 frames per 256 seconds | |||
bytes 22-23 audio max size | |||
bytes 24-25 audio blob size | |||
byte 26 audio ID | |||
byte 27 video ID | |||
bytes 28-29 frame width | |||
bytes 30-31 frame height | |||
[[Category:Audio Codecs]] | [[Category:Audio Codecs]] |
Revision as of 05:37, 1 March 2009
- Extensions: bmv
- Company: Teeny Weeny Games
BMV is the file extension for FMV used in Discworld 2 and Discworld 3 games, actual format differs for them.
Discworld 2 BMV
Container format
File has no header and consists of series of packets. Each packet starts with the byte showing its type and except NOP and END packets all other packets have 24-bit little-endian length field.
Packet type meaning:
0x00 NOP 0x01 END 0x02 Inter frame 0x03 Intra frame Frame types can additionally have a set of flags:
0x04 packet contains scroll offset 0x08 palette is included 0x10 commands (e.g. for subtitles) 0x20 audio is present 0x40 extended mode 0x80 text is present (for command)
Data is stored in this order:
audio (3675 bytes for old audio block, 1 + blobs*65 for newer one) commands palette (768 bytes) screen offset (2 bytes) picture data
Since text string are loaded from game resources, it is not described here.
Video
Video is packed like RLE.
Audio
Audio is decoded per blobs. Each blob contains a byte with multipliers and actual data. Two multipliers are stored in a single byte which is cyclically rotated left by one
mult_table[16] = { 16512, 8256, 4128, 2064, 1032, 516, 258, 192, 129, 88, 64, 56, 48, 40, 36, 32 }
t = get_byte(); t = (t >> 1) | ((t & 0x1) << 7); mul1 = mult_table[t & 0xF]; mul2 = mult_table[t >> 4];
Audio is decoded by fetching byte, multiplying it by mul1 or mul2 (even samples - by mul1, odd samples - by mul2) and dividing by 32:
int8_t *src; for(i = 0; i < 64; i += 2){ outsamples[i ] = (*src++ * mul1) >> 5; outsamples[i+1] = (*src++ * mul2) >> 5; blobsize--; }
Discworld 3 BMV
Container
Container consists of two chunks - header and data. Each chunk starts with magic ('BMVi' or 'DATA') and payload size.
Header data (little-endian):
bytes 0- 3 'BMVi' bytes 4- 7 payload size bytes 8-11 slot size bytes 12-15 number of frames bytes 16-17 prefetch slots bytes 18-19 some cache size bytes 20-21 frames per 256 seconds bytes 22-23 audio max size bytes 24-25 audio blob size byte 26 audio ID byte 27 video ID bytes 28-29 frame width bytes 30-31 frame height