Beispiel #1
0
        protected override void CodeBitmapDirectly(Bitmap bm, int dw, int dy, int up2, int up1, int up0)
        {
            while (dy >= 0)
            {
                int context = GetDirectContext(bm, up2, up1, up0, 0);

                for (int dx = 0; dx < dw; )
                {
                    int n = CodeBit(false, Bitdist, context);

                    bm.SetByteAt(up0 + dx++, n);
                    context = ShiftDirectContext(bm, context, n, up2, up1, up0, dx);
                }

                up2 = up1;
                up1 = up0;
                up0 = bm.RowOffset(--dy);
            }
        }
Beispiel #2
0
        protected override void CodeBitmapByCrossCoding(Bitmap bm, Bitmap cbm, int xd2c, int dw, int dy,
            int cy, int up1, int up0, int xup1, int xup0,
            int xdn1)
        {
            while (dy >= 0)
            {
                int context = GetCrossContext(bm, cbm, up1, up0, xup1, xup0, xdn1, 0);

                for (int dx = 0; dx < dw; )
                {
                    int n = CodeBit(false, Cbitdist, context);
                    bm.SetByteAt(up0 + dx++, n);
                    context = ShiftCrossContext(bm, cbm, context, n, up1, up0, xup1, xup0, xdn1, dx);
                }

                up1 = up0;
                up0 = bm.RowOffset(--dy);
                xup1 = xup0;
                xup0 = xdn1;
                xdn1 = cbm.RowOffset((--cy) - 1) + xd2c;
            }
        }