MKV EBML lacing questions.
Dan Wright <[email protected]>
| Newsgroups | gmane.comp.multimedia.matroska.user |
|---|---|
| Message-ID | <[email protected]> |
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 something obvious? Thanks for any help! _______________________________________________ Matroska-users mailing list [email protected] http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-users Read Matroska-Users on GMane: http://dir.gmane.org/gmane.comp.multimedia.matroska.user