[Matroska-devel] Fwd: [Matroska-users] MKV EBML lacing questions.
cwiesner at matroska.org
Wed Jan 5 20:18:47 CET 2011
Forwarding this question to matroska-devel , where it belongs.
CW, matroska admin
---------- Forwarded message ----------
From: Dan Wright <oodsphere at gmail.com>
Subject: [Matroska-users] MKV EBML lacing questions.
To: matroska-users at lists.matroska.org
I'm working on an MKV writer and an MKV parser, and I'm trying to add lacing
support. I'm using the MKV specs at
http://matroska.org/technical/specs/index.html. As such, I've got a couple
of questions about the EBML lacing method. Having run fruitless searches on
Google and on these mailing lists, here are my questions:
1. It looks like EBML lacing use "one's complement" for its lacing sizes.
Is this correct? It seems a little non-standard, especially since, earlier
in the spec, it is evident that the signed integer data element type uses
the much more common "two's complement" (e.g. -2 = 0xFE).
2. The example for EBML lacing uses an example where the first frame is 800
bytes, the second 500, and the third 1000. The spec example claims:
"Lacing sizes: only the 2 first ones will be coded, 800 gives 0x320 + 0x4000
= 0x4320, 500 is coded as -300 : - 0x12C + 0x1FFF + 0x4000 = 0x5ED3. The
size of the last frame is deduced from the total size of the Block."
Now, I'm fine with encoding 800 as 0x4320, but encoding -300 as 0x5ED3
leaves me with a problem. If I were decoding 0x5ED3, the first bit
encountered after the EBML size-bits is a 0, leading me to interpret the
value as positive, getting 7891 instead of -300. Assuming a one's
complement system, shouldn't this value actually be 0x7ED3 so that the most
significant digit after the EBML size-bits is a 1? Or am I missing
Thanks for any help!
Matroska-users mailing list
Matroska-users at lists.matroska.org
Read Matroska-Users on GMane:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Matroska-devel