Beispiel #1
0
    public PatchHeader(BitPack bitPack)
    {
        QuantWBits = bitPack.GetUInt8();
        if (QuantWBits == END_OF_PATCHES)
        {
            // End of data, blitz the rest.
            DcOffset = 0;
            Range    = 0;
            PatchIds = 0;
            return;
        }

        DcOffset = bitPack.GetFloat_Le();
        Range    = bitPack.GetUInt16_Le();
        PatchIds = bitPack.GetUInt16_Le(10);
    }
Beispiel #2
0
        public void GetUInt16_Le()
        {
            byte[] buffer    = new byte[65536 * 2];
            int    destIndex = 0;

            for (int i = 0; i < 65536; i++)
            {
                buffer[destIndex++] = (byte)((i >> 0) & 0xff);
                buffer[destIndex++] = (byte)((i >> 8) & 0xff);
            }
            BitPack bitPack = new BitPack(buffer);

            for (int i = 0; i < 65536; i++)
            {
                UInt16 v = bitPack.GetUInt16_Le();
                Assert.AreEqual((UInt16)i, v);
            }
        }
Beispiel #3
0
 public GroupHeader(BitPack bitPack)
 {
     Stride    = bitPack.GetUInt16_Le();
     PatchSize = bitPack.GetUInt8();
     LayerType = (LayerType)bitPack.GetUInt8();
 }
Beispiel #4
0
        public void LayerData()
        {
            byte[] buffer =
            {
                0x08, 0x01, 0x10, 0x4C, 0x8A, 0x40, 0x93, 0xB5, 0x41, 0x01, 0x00, 0x08, 0x7F, 0xD6, 0x6C, 0x50,
                0xE7, 0x05, 0x8E, 0x07, 0x17, 0x07, 0x28, 0x0C, 0x4C, 0x1C, 0x38, 0x1D, 0xCC, 0x32, 0xC8, 0x70,
                0x10, 0xC3, 0x81, 0x86, 0x43, 0x82, 0x86, 0x09, 0x0C, 0x02, 0x18, 0x14, 0x30, 0xA8, 0x71, 0x40,
                0xE4, 0xA1, 0x86, 0x43, 0x09, 0x06, 0x0F, 0x0E, 0x1E, 0x18, 0x30, 0x30, 0x68, 0x30, 0x10, 0x60,
                0x70, 0xC0, 0x21, 0x81, 0x43, 0x06, 0x07, 0x03, 0x0E, 0x0C, 0x1C, 0x20, 0x30, 0x08, 0x60, 0x20,
                0xC1, 0x01, 0xC1, 0xC3, 0x03, 0x86, 0x02, 0x0E, 0x02, 0x18, 0x08, 0x30, 0x28, 0x30, 0x18, 0x60,
                0x30, 0xC0, 0x61, 0x80, 0x43, 0x80, 0x86, 0x08, 0x0C, 0x02, 0x18, 0x0C, 0x30, 0x30, 0x70, 0xD0,
                0xC0, 0x21, 0x80, 0x43, 0x82, 0x86, 0x06, 0x0C, 0x02, 0x1C, 0x08, 0x30, 0x28, 0x18, 0x08, 0x30,
                0x08, 0x60, 0x10, 0xC0, 0x41, 0xC0, 0x43, 0x80, 0x86, 0x05, 0x0E, 0x02, 0x0C, 0x06, 0x1C, 0x08,
                0x30, 0x10, 0x60, 0xF0, 0xE1, 0xC0, 0x60, 0x10, 0xC0, 0x21, 0x80, 0x41, 0x80, 0x83, 0x80, 0x86,
                0x01, 0x01, 0x80, 0x40, 0x60, 0x10, 0xC0, 0x21, 0xC0, 0x83, 0x01, 0x87, 0x01, 0x01, 0x80, 0x83,
                0x05, 0x07, 0x06, 0x03, 0x00, 0x83, 0x00, 0x87, 0x01, 0x0C, 0x02, 0x0E, 0x02, 0x06, 0x01, 0x0C,
                0x02, 0x1C, 0x04, 0x0E, 0x02, 0x00, 0x60, 0x10, 0x0C, 0x04, 0x18, 0x0C, 0x38, 0x08, 0x30, 0x10,
                0x30, 0x08, 0x60, 0x10, 0x60, 0x10, 0x0E, 0x02, 0x0C, 0x02, 0x1C, 0x04, 0x00, 0x00, 0x60, 0x10,
                0x30, 0x08, 0x00, 0x00, 0xC0, 0x20, 0x03, 0x00, 0x85, 0x17, 0x95, 0x87, 0x6E, 0x82, 0x02, 0x01,
                0xD0, 0x7F, 0x3C, 0xE2, 0xE0, 0x61, 0xC0, 0xE1, 0xC0, 0x60, 0x40, 0x60, 0x30, 0x38, 0x38, 0x38,
                0x28, 0x31, 0x58, 0x31, 0x58, 0x30, 0x48, 0x30, 0x48, 0x18, 0x10, 0x0E, 0x0A, 0x0E, 0x08, 0x0E,
                0x06, 0x0E, 0x0C, 0x0C, 0x22, 0x0C, 0x2C, 0x0C, 0x04, 0x06, 0x07, 0x06, 0x03, 0x07, 0x02, 0x03,
                0x00, 0x83, 0x80, 0x83, 0x81, 0x03, 0x81, 0x03, 0x80, 0x83, 0x01, 0x83, 0x01, 0x03, 0x09, 0x03,
                0x04, 0x80, 0x70, 0x20, 0x03, 0x00, 0x83, 0x00, 0x83, 0x00, 0x83, 0x80, 0x83, 0x00, 0x80, 0x60,
                0xB0, 0x60, 0x80, 0x70, 0x10, 0x60, 0x20, 0x38, 0x08, 0x38, 0x08, 0x38, 0x08, 0x00, 0x60, 0x10,
                0x0E, 0x04, 0x0C, 0x02, 0x0C, 0x02, 0x0C, 0x02, 0x0C, 0x06, 0x0C, 0x0A, 0x00, 0x00, 0x0C, 0x02,
                0x00, 0xE0, 0x20, 0x60, 0x10, 0x30, 0x18, 0x03, 0x80, 0x80, 0x00, 0x00, 0x01, 0x80, 0x80, 0x38,
                0x08, 0x28, 0xB8, 0xC3, 0x9B, 0x74, 0x10, 0x10, 0x00, 0x77, 0xB9, 0xDB, 0x25, 0x87, 0x2A, 0x83,
                0x94, 0x03, 0x12, 0x83, 0x4B, 0x03, 0x28, 0x03, 0x93, 0x03, 0x8C, 0x03, 0x0B, 0x03, 0x82, 0x83,
                0x06, 0x03, 0x05, 0x83, 0x88, 0x83, 0x21, 0x83, 0x1B, 0x81, 0x82, 0x01, 0xC0, 0x81, 0x80, 0x41,
                0xC0, 0xC1, 0x80, 0xC1, 0xC1, 0x40, 0xE0, 0x20, 0xC0, 0x80, 0xE0, 0x40, 0xC4, 0x80, 0xC3, 0x00,
                0xE0, 0x80, 0xC0, 0x20, 0xE0, 0x80, 0xE0, 0x40, 0xC0, 0x40, 0xC0, 0x60, 0xE0, 0x80, 0xC0, 0x20,
                0xE0, 0x60, 0xE0, 0x60, 0xC0, 0x40, 0x70, 0x30, 0x60, 0x10, 0x60, 0x10, 0x61, 0x60, 0x61, 0x20,
                0x60, 0x30, 0x60, 0x20, 0x70, 0x10, 0x1C, 0x04, 0x18, 0x04, 0x07, 0x02, 0x00, 0x38, 0x08, 0x38,
                0x18, 0x30, 0x08, 0x18, 0x30, 0x18, 0x20, 0x0E, 0x02, 0x0E, 0x04, 0x01, 0x80, 0x41, 0x80, 0x40,
                0xE0, 0x20, 0xC0, 0x20, 0x1C, 0x04, 0x00, 0x70, 0x10, 0x60, 0x30, 0x60, 0x70, 0x60, 0x60, 0x60,
                0x20, 0x30, 0x08, 0x00, 0x70, 0x10, 0x18, 0x04, 0x00, 0x0E, 0x02, 0x0E, 0x02, 0x03, 0x01, 0x80,
                0xE0, 0x40, 0x0C, 0x02, 0x00, 0x1C, 0x04, 0x00, 0x01, 0x80, 0x41, 0xC0, 0x41, 0x80, 0x80, 0x0E,
                0x02, 0x00, 0x00, 0x18, 0x04, 0x01, 0xC0, 0x40, 0x60, 0x10, 0x00, 0x00, 0x38, 0x08, 0x28, 0xA7,
                0x4A, 0x48, 0x74, 0x10, 0x70, 0x0E, 0x73, 0x4B, 0xD7, 0xB4, 0x2E, 0x82, 0xBF, 0x40, 0x3A, 0x80,
                0xE8, 0xC0, 0xE3, 0x41, 0x9A, 0x03, 0x84, 0x86, 0x42, 0x0C, 0x98, 0x18, 0xAC, 0x30, 0x98, 0x71,
                0x70, 0xC3, 0x01, 0xC3, 0xC3, 0x0C, 0x07, 0x0E, 0x0E, 0x44, 0x18, 0x20, 0x38, 0x08, 0x70, 0x80,
                0xE2, 0x21, 0xC7, 0xC3, 0x82, 0x86, 0x1A, 0x0E, 0x10, 0x18, 0x18, 0x30, 0x28, 0x60, 0x50, 0xE0,
                0x61, 0x85, 0x03, 0x00, 0x87, 0x04, 0x0E, 0x18, 0x18, 0x24, 0x30, 0x38, 0x60, 0x30, 0xC0, 0xE1,
                0x80, 0x83, 0x01, 0x87, 0x05, 0x0C, 0x02, 0x18, 0x0C, 0x38, 0x10, 0x60, 0x40, 0xE0, 0x41, 0xC0,
                0x81, 0x80, 0x83, 0x81, 0x86, 0x03, 0x0C, 0x0A, 0x0C, 0x08, 0x1C, 0x0C, 0x38, 0x18, 0x70, 0x20,
                0xE0, 0x21, 0xC1, 0x03, 0x01, 0x87, 0x02, 0x0E, 0x0C, 0x1C, 0x04, 0x30, 0x18, 0x30, 0x08, 0x1C,
                0x04, 0x38, 0x20, 0x30, 0x18, 0x70, 0x20, 0xE0, 0xA1, 0xC1, 0x03, 0x81, 0x07, 0x02, 0x07, 0x01,
                0x0C, 0x04, 0x0C, 0x02, 0x18, 0x08, 0x30, 0x08, 0x0E, 0x02, 0x18, 0x04, 0x06, 0x01, 0x0E, 0x02,
                0x0C, 0x06, 0x18, 0x0C, 0x38, 0x08, 0x60, 0x20, 0xC0, 0x21, 0x80, 0x43, 0x02, 0x01, 0x80, 0x83,
                0x80, 0x80, 0xC0, 0x21, 0xC0, 0xC3, 0x00, 0x86, 0x02, 0x03, 0x00, 0x81, 0xC0, 0x40, 0xC0, 0x21,
                0xC0, 0x40, 0x1C, 0x08, 0x1C, 0x04, 0x1C, 0x04, 0x0C, 0x02, 0x0E, 0x02, 0x00, 0x30, 0x08, 0x30,
                0x08, 0x00, 0x00, 0xC0, 0x40, 0x06, 0x01, 0x00, 0x1C, 0x04, 0x01, 0xC0, 0x40, 0x70, 0x20, 0xA2,
                0xC4, 0x3E, 0xA6, 0x90, 0x41, 0x40, 0x02, 0x5C, 0x95, 0x1C, 0xAC, 0x1C, 0xAA, 0x0F, 0x06, 0x0F,
                0x26, 0x0E, 0xC0, 0x0C, 0x08, 0x0C, 0xD8, 0x0C, 0xA0, 0x0C, 0x8E, 0x0C, 0x12, 0x0E, 0x46, 0x0E,
                0x18, 0x0C, 0x0C, 0x0C, 0x1A, 0x0C, 0x08, 0x0C, 0x0A, 0x0E, 0x16, 0x0C, 0x18, 0x0C, 0x0C, 0x0C,
                0x4A, 0x0E, 0x1A, 0x0E, 0x44, 0x0E, 0x2A, 0x0E, 0x1C, 0x07, 0x01, 0x07, 0x0E, 0x06, 0x02, 0x03,
                0x01, 0x83, 0x04, 0x03, 0x05, 0x83, 0x07, 0x03, 0x07, 0x83, 0x80, 0x83, 0x83, 0x83, 0x80, 0x83,
                0x85, 0x03, 0x82, 0x83, 0x82, 0x83, 0x81, 0x03, 0x83, 0x01, 0xC0, 0xC0, 0x70, 0x10, 0x38, 0x10,
                0x38, 0x10, 0x30, 0x20, 0x18, 0x14, 0x18, 0x10, 0x0E, 0x0A, 0x0E, 0x04, 0x0C, 0x04, 0x0C, 0x06,
                0x0C, 0x0A, 0x03, 0x00, 0x80, 0xE0, 0x40, 0x70, 0x10, 0x60, 0x20, 0x60, 0x20, 0x70, 0x20, 0x70,
                0x40, 0x30, 0x10, 0x30, 0x10, 0x18, 0x04, 0x18, 0x04, 0x0C, 0x02, 0x0C, 0x02, 0x0C, 0x02, 0x06,
                0x01, 0x07, 0x01, 0x07, 0x01, 0x06, 0x01, 0x03, 0x01, 0x03, 0x01, 0x00, 0xE0, 0x20, 0x30, 0x10,
                0x0E, 0x02, 0x0E, 0x04, 0x0E, 0x02, 0x00, 0x0C, 0x04, 0x0C, 0x02, 0x0E, 0x02, 0x00, 0xC0, 0x20,
                0x00, 0xE0, 0x20, 0x70, 0x20, 0x70, 0x10, 0x70, 0x10, 0x70, 0x10, 0x0E, 0x02, 0x00, 0xC0, 0x20,
                0xC0, 0x20, 0x18, 0x04, 0x00, 0x00, 0x38, 0x08, 0x38, 0x08, 0x01, 0x80, 0x41, 0x30, 0x80
            };
            BitPack bitPack = new BitPack(buffer);

            // GroupHeader:
            UInt16 stride = bitPack.GetUInt16_Le();

            Assert.AreEqual(0x0108, stride);

            byte patchSize = bitPack.GetUInt8();

            Assert.AreEqual(0x10, patchSize);

            byte layerType = bitPack.GetUInt8();

            Assert.AreEqual(0x4c, layerType);

            // PatchHeader:
            byte quantWBits = bitPack.GetUInt8();

            Assert.AreEqual(0x8a, quantWBits);

            float dcOffset = bitPack.GetFloat_Le();

            Assert.AreEqual(22.6969f, dcOffset);

            UInt16 range = bitPack.GetUInt16_Le();

            Assert.AreEqual(1, range);

            UInt16 patchIds = bitPack.GetUInt16_Le(10);

            Assert.AreEqual(0x0108, patchIds);
        }