EBML specification component for review - Variable size integer
Erik Piil <[email protected]>
| Newsgroups | gmane.comp.multimedia.matroska.devel |
|---|---|
| Message-ID | <CAKNa7H_8KRWhy5tZSSVVk7YhJB1tPxfjXTtV5FeZUt7xEVmMvw@mail.gmail.com> |
This discussion relates to the “Variable size integer” portion of the earlier EBML RFC Draft for revision/incorporation into the final EBML specification. From the RFC Draft: Variable size integer For both element ID and size descriptor EBML uses a variable size integer, coded according to a schema similar to that of UTF-8 [UTF-8] encoding. The variable size integer begins with zero or more zero bits to define the width of the integer. Zero zeroes means a width of one byte, one zero a width of two bytes etc. The zeroes are followed by a marker of one set bit and then follows the actual integer data. The integer data consists of alignment data and tail data. The alignment data together with the width descriptor and the marker makes up one ore more complete bytes. The tail data is as many bytes as there were zeroes in the width descriptor, i.e. width-1. VINT = VINT_WIDTH VINT_MARKER VINT_DATA VINT_WIDTH = *%b0 VINT_MARKER = %b1 VINT_DATA = VINT_ALIGNMENT VINT_TAIL VINT_ALIGNMENT = *BIT VINT_TAIL = *BYTE An alternate way of expressing this is the following definition, where the width is the number of levels of expansion. VINT = ( %b0 VINT 7BIT ) / ( %b1 7BIT ) Some examples of the encoding of integers of width 1 to 4. The x:es represent bits where the actual integer value would be stored. Width Size Representation 1 2^7 1xxx xxxx 2 2^14 01xx xxxx xxxx xxxx 3 2^21 001x xxxx xxxx xxxx xxxx xxxx 4 2^28 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx Any thoughts are most appreciated. Best, Erik _______________________________________________ Matroska-devel mailing list [email protected] http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-devel Read Matroska-Devel on GMane: http://dir.gmane.org/gmane.comp.multimedia.matroska.devel