private void parseHeader()

in src/main/java/org/apache/pdfbox/jbig2/segments/GenericRegion.java [81:133]


    private void parseHeader() throws IOException, InvalidHeaderValueException
    {
        regionInfo.parseHeader();

        /* Bit 5-7 */
        subInputStream.readBits(3); // Dirty read...

        /* Bit 4 */
        if (subInputStream.readBit() == 1)
        {
            useExtTemplates = true;
        }

        /* Bit 3 */
        if (subInputStream.readBit() == 1)
        {
            isTPGDon = true;
        }

        /* Bit 1-2 */
        gbTemplate = (byte) (subInputStream.readBits(2) & 0xf);

        /* Bit 0 */
        if (subInputStream.readBit() == 1)
        {
            isMMREncoded = true;
        }

        if (!isMMREncoded)
        {
            final int amountOfGbAt;
            if (gbTemplate == 0)
            {
                if (useExtTemplates)
                {
                    amountOfGbAt = 12;
                }
                else
                {
                    amountOfGbAt = 4;
                }
            }
            else
            {
                amountOfGbAt = 1;
            }

            readGbAtPixels(amountOfGbAt);
        }

        /* Segment data structure */
        computeSegmentDataStructure();
    }