src/main/java/org/apache/pdfbox/jbig2/segments/GenericRegion.java [325:368]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            final int paddedWidth, int byteIndex, int idx) throws IOException
    {
        int context;
        int overriddenContext = 0;

        int line1 = 0;
        int line2 = 0;

        if (lineNumber >= 1)
        {
            line1 = regionBitmap.getByteAsInteger(idx);
        }

        if (lineNumber >= 2)
        {
            line2 = regionBitmap.getByteAsInteger(idx - rowStride) << 6;
        }

        context = (line1 & 0xf0) | (line2 & 0x3800);

        int nextByte;
        for (int x = 0; x < paddedWidth; x = nextByte)
        {
            /* 6.2.5.7 3d */
            byte result = 0;
            nextByte = x + 8;
            final int minorWidth = width - x > 8 ? 8 : width - x;

            if (lineNumber > 0)
            {
                line1 = (line1 << 8)
                        | (nextByte < width ? regionBitmap.getByteAsInteger(idx + 1) : 0);
            }

            if (lineNumber > 1)
            {
                line2 = (line2 << 8) | (nextByte < width
                        ? regionBitmap.getByteAsInteger(idx - rowStride + 1) << 6 : 0);
            }

            for (int minorX = 0; minorX < minorWidth; minorX++)
            {
                final int toShift = 7 - minorX;
                if (override)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/org/apache/pdfbox/jbig2/segments/GenericRegion.java [393:436]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            final int paddedWidth, int byteIndex, int idx) throws IOException
    {
        int context;
        int overriddenContext = 0;

        int line1 = 0;
        int line2 = 0;

        if (lineNumber >= 1)
        {
            line1 = regionBitmap.getByteAsInteger(idx);
        }

        if (lineNumber >= 2)
        {
            line2 = regionBitmap.getByteAsInteger(idx - rowStride) << 6;
        }

        context = (line1 & 0xf0) | (line2 & 0x3800);

        int nextByte;
        for (int x = 0; x < paddedWidth; x = nextByte)
        {
            /* 6.2.5.7 3d */
            byte result = 0;
            nextByte = x + 8;
            final int minorWidth = width - x > 8 ? 8 : width - x;

            if (lineNumber > 0)
            {
                line1 = (line1 << 8)
                        | (nextByte < width ? regionBitmap.getByteAsInteger(idx + 1) : 0);
            }

            if (lineNumber > 1)
            {
                line2 = (line2 << 8) | (nextByte < width
                        ? regionBitmap.getByteAsInteger(idx - rowStride + 1) << 6 : 0);
            }

            for (int minorX = 0; minorX < minorWidth; minorX++)
            {
                final int toShift = 7 - minorX;
                if (override)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



