コード例 #1
0
        protected override void CodeBitmapDirectly(IBitmap 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++, (sbyte)n);
                    context = ShiftDirectContext(bm, context, n, up2, up1, up0, dx);
                }

                up2 = up1;
                up1 = up0;
                up0 = bm.RowOffset(--dy);
            }
        }
コード例 #2
0
        protected override void CodeBitmapByCrossCoding(IBitmap bm, IBitmap 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++, (sbyte)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;
            }
        }