示例#1
0
        public void uncompress(int[] inBuf, IntWrapper inPos, int inLen, int[] outBuf, IntWrapper outPos)
        {
            if (inLen == 0)
            {
                return;
            }

            int outLen = inBuf[inPos.get()];

            inPos.increment();

            DeltaZigzagEncoding.Decoder ctx = new DeltaZigzagEncoding.Decoder(0);
            int[] work = new int[BLOCK_LENGTH];

            int ip         = inPos.get();
            int op         = outPos.get();
            int outPosLast = op + outLen;

            for (; op < outPosLast; op += BLOCK_LENGTH)
            {
                int n = inBuf[ip++];
                ip += unpack(inBuf, ip, work, 0, (n >> 24) & 0x3F);
                ip += unpack(inBuf, ip, work, 32, (n >> 16) & 0x3F);
                ip += unpack(inBuf, ip, work, 64, (n >> 8) & 0x3F);
                ip += unpack(inBuf, ip, work, 96, (n >> 0) & 0x3F);
                ctx.decodeArray(work, 0, BLOCK_LENGTH, outBuf, op);
            }

            outPos.add(outLen);
            inPos.set(ip);
        }
示例#2
0
        public void uncompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
        {
            if (inlength == 0)
            {
                return;
            }
            int outlength = @in[inpos.get()];

            inpos.increment();
            headlessUncompress(@in, inpos, inlength, @out, outpos, outlength);
        }
示例#3
0
 public void compress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
 {
     inlength = inlength / BLOCK_SIZE * BLOCK_SIZE;
     if (inlength == 0)
     {
         return;
     }
     @out[outpos.get()] = inlength;
     outpos.increment();
     headlessCompress(@in, inpos, inlength, @out, outpos);
 }
示例#4
0
 public void compress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
 {
     inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
     if (inlength == 0)
     {
         return;
     }
     @out[outpos.get()] = inlength;
     outpos.increment();
     headlessCompress(@in, inpos, inlength, @out, outpos);
 }
示例#5
0
        public void headlessUncompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos, int num)
        {
            int init = inpos.get();

            F1.headlessUncompress(@in, inpos, inlength, @out, outpos, num);
            if (inpos.get() == init)
            {
                inpos.increment();
            }
            inlength -= inpos.get() - init;
            num      -= outpos.get();
            F2.headlessUncompress(@in, inpos, inlength, @out, outpos, num);
        }
示例#6
0
        public void headlessCompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
        {
            int init       = inpos.get();
            int outposInit = outpos.get();

            F1.headlessCompress(@in, inpos, inlength, @out, outpos);
            if (outpos.get() == outposInit)
            {
                @out[outposInit] = 0;
                outpos.increment();
            }
            inlength -= inpos.get() - init;
            F2.headlessCompress(@in, inpos, inlength, @out, outpos);
        }
示例#7
0
        public void headlessCompress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos, IntWrapper initvalue)
        {
            if (inlength == 0)
            {
                return;
            }
            int init = inpos.get();

            F1.headlessCompress(@in, inpos, inlength, @out, outpos, initvalue);
            if (outpos.get() == 0)
            {
                @out[0] = 0;
                outpos.increment();
            }
            inlength -= inpos.get() - init;
            F2.headlessCompress(@in, inpos, inlength, @out, outpos, initvalue);
        }
示例#8
0
        public void compress(int[] @in, IntWrapper inpos, int inlength, int[] @out, IntWrapper outpos)
        {
            if (inlength == 0)
            {
                return;
            }
            int inposInit  = inpos.get();
            int outposInit = outpos.get();

            F1.compress(@in, inpos, inlength, @out, outpos);
            if (outpos.get() == outposInit)
            {
                @out[outposInit] = 0;
                outpos.increment();
            }
            inlength -= inpos.get() - inposInit;
            F2.compress(@in, inpos, inlength, @out, outpos);
        }
示例#9
0
        public void compress(int[] inBuf, IntWrapper inPos, int inLen, int[] outBuf, IntWrapper outPos)
        {
            inLen = inLen - inLen % BLOCK_LENGTH;
            if (inLen == 0)
            {
                return;
            }

            outBuf[outPos.get()] = inLen;
            outPos.increment();

            int context = 0;

            int[] work = new int[32];

            int op        = outPos.get();
            int ip        = inPos.get();
            int inPosLast = ip + inLen;

            for (; ip < inPosLast; ip += BLOCK_LENGTH)
            {
                int bits1 = xorMaxBits(inBuf, ip + 0, 32, context);
                int bits2 = xorMaxBits(inBuf, ip + 32, 32,
                                       inBuf[ip + 31]);
                int bits3 = xorMaxBits(inBuf, ip + 64, 32,
                                       inBuf[ip + 63]);
                int bits4 = xorMaxBits(inBuf, ip + 96, 32,
                                       inBuf[ip + 95]);
                outBuf[op++] = (bits1 << 24) | (bits2 << 16)
                               | (bits3 << 8) | (bits4 << 0);
                op += xorPack(inBuf, ip + 0, outBuf, op, bits1,
                              context, work);
                op += xorPack(inBuf, ip + 32, outBuf, op, bits2,
                              inBuf[ip + 31], work);
                op += xorPack(inBuf, ip + 64, outBuf, op, bits3,
                              inBuf[ip + 63], work);
                op += xorPack(inBuf, ip + 96, outBuf, op, bits4,
                              inBuf[ip + 95], work);
                context = inBuf[ip + 127];
            }

            inPos.add(inLen);
            outPos.set(op);
        }
示例#10
0
        public void uncompress(int[] inBuf, IntWrapper inPos, int inLen, int[] outBuf, IntWrapper outPos)
        {
            if (inLen == 0)
            {
                return;
            }

            int outLen = inBuf[inPos.get()];

            inPos.increment();

            int context = 0;

            int[] work = new int[32];

            int ip         = inPos.get();
            int op         = outPos.get();
            int outPosLast = op + outLen;

            for (; op < outPosLast; op += BLOCK_LENGTH)
            {
                int bits1 = (int)((uint)inBuf[ip] >> 24);
                int bits2 = (int)((uint)inBuf[ip] >> 16) & 0xFF;
                int bits3 = (int)((uint)inBuf[ip] >> 8) & 0xFF;
                int bits4 = (int)((uint)inBuf[ip] >> 0) & 0xFF;
                ++ip;
                ip += xorUnpack(inBuf, ip, outBuf, op + 0, bits1,
                                context, work);
                ip += xorUnpack(inBuf, ip, outBuf, op + 32, bits2,
                                outBuf[op + 31], work);
                ip += xorUnpack(inBuf, ip, outBuf, op + 64, bits3,
                                outBuf[op + 63], work);
                ip += xorUnpack(inBuf, ip, outBuf, op + 96, bits4,
                                outBuf[op + 95], work);
                context = outBuf[op + 127];
            }

            outPos.add(outLen);
            inPos.set(ip);
        }
示例#11
0
        public void compress(int[] inBuf, IntWrapper inPos, int inLen, int[] outBuf, IntWrapper outPos)
        {
            inLen = inLen - inLen % BLOCK_LENGTH;
            if (inLen == 0)
            {
                return;
            }

            outBuf[outPos.get()] = inLen;
            outPos.increment();

            DeltaZigzagEncoding.Encoder ctx = new DeltaZigzagEncoding.Encoder(0);
            int[] work = new int[BLOCK_LENGTH];

            int op        = outPos.get();
            int ip        = inPos.get();
            int inPosLast = ip + inLen;

            for (; ip < inPosLast; ip += BLOCK_LENGTH)
            {
                ctx.encodeArray(inBuf, ip, BLOCK_LENGTH, work);
                int bits1 = Util.maxbits32(work, 0);
                int bits2 = Util.maxbits32(work, 32);
                int bits3 = Util.maxbits32(work, 64);
                int bits4 = Util.maxbits32(work, 96);
                outBuf[op++] = (bits1 << 24) | (bits2 << 16)
                               | (bits3 << 8) | (bits4 << 0);
                op += pack(work, 0, outBuf, op, bits1);
                op += pack(work, 32, outBuf, op, bits2);
                op += pack(work, 64, outBuf, op, bits3);
                op += pack(work, 96, outBuf, op, bits4);
            }

            inPos.add(inLen);
            outPos.set(op);
        }