TM2X: some details

Funny how I started this blog more than 10 years ago mostly to talk about TrueMotion 2 and now it’s TrueMotion 2X time.

First of all, an existing binary specification (feel free to ask Baidu for some other materials for this codec, I’m pretty sure you’ll receive a lot) is weird and half of it is not well decompilable. It looks like the compiler did something inverse to inlining and split out some parts of code into separate functions without usual prologue and simply accesses variables somewhere deep on stack:

[sourcecode language=”asm”]
sub_10037110 proc near ; DATA XREF: .data:1005ECF8o
arg_2A4 = dword ptr 2A8h
arg_2A8 = dword ptr 2ACh
arg_2B4 = dword ptr 2B8h
arg_2B8 = dword ptr 2BCh
arg_2C0 = byte ptr 2C4h
arg_11DC = dword ptr 11E0h
arg_11E0 = dword ptr 11E4h
arg_11E4 = dword ptr 11E8h
arg_11E8 = dword ptr 11ECh
arg_11FC = dword ptr 1200h
arg_1210 = dword ptr 1214h
arg_1214 = dword ptr 1218h
arg_1260 = dword ptr 1264h

test eax, 10h
jz loc_100371D2
mov edx, [ebx+4]
test eax, 80h
jz loc_100371C5
test eax, 40h
jz short loc_10037149
sar edx, 3
xor eax, eax
mov [esp+arg_11E0], eax
mov [esp+arg_11E4], eax
jmp loc_100371C9

mov ebx, [esp+arg_2A4]
mov esi, [esp+arg_2A8]
xor ecx, ecx
xor eax, eax
mov al, [ebx]
xor edx, edx
mov cl, [ebx+2]
mov ebp, [esi+eax]
mov al, [ebx+1]
jmp ebp
sub_10037110 endp

Yet some details are known:

  • TM2X (or TM2A) stores frame data in a series of chunks each prefixed with 32-bit code, e.g. 0xA0000106 — main data, 0xA0000109 — some initialisation parameters etc;
  • Some block types seem to be alternative versions of the same data (i.e. 0xA0000103 has the same data as 0xA0000010B but with some fields missing and you’re supposed to have either one or another block but not both);
  • Frame seems to be divided into 8×8 blocks that can be one of three types (I guess intra, inter or skip and inter with motion compensation);
  • Motion compensation has halfpel precision and motion vectors coding is surprisingly complicated for such class of codec (it looks like the codec codes motion vectors for large areas and has refinement for those motion vectors per block).

So it’s exactly like TM2 which had fixed structure and delta coding in 4×4 blocks. Either that or this is a missing link between Duck TrueMotion 2 and On2 TrueMotion VP3.

Comments are closed.