ebml-specification
ebml-specification copied to clipboard
add handling of encodings others than binary
Add a vector in the specification, which allows to define other encodings than binary, like the Gray codes.
For the example I presented in Vienna (I guess it’s the simplest one), the conversion Gray to binary would be:
b3 = g3
b2 = b3 ⊕ g2
b1 = b2 ⊕ g1
b0 = b1 ⊕ g0
or:
unsigned int Gray_to_Bin(unsigned int g) {
num = g ^ (g >> 32);
num = g ^ (g >> 16);
num = g ^ (g >> 8);
num = g ^ (g >> 4);
num = g ^ (g >> 2);
num = g ^ (g >> 1);
return g;
}
and binary to Gray:
g3 = b3
g2 = b3 ⊕ b2
g1 = b2 ⊕ b1
g0 = b1 ⊕ b0
or:
unsigned int Bin_to_Gray(unsigned int b) {
return b ^ (b >> 1);
}
Would that be for the integers stored in EBML or the EBML ID and Length fields ? In any case must cover more than 32 bits values.
We must indeed cover more than 32-bit values. This is just the example I presented in Vienna in order to explain the idea. And yes this are integers.