private static int compressT(final int a0, final int a1, final int b1, final BitArrayOutputStream outputStream, final int codingA0Color,
            final int[] codingLine) {
        final int a1b1 = a1 - b1;
        if (-3 <= a1b1 && a1b1 <= 3) {
            final T4_T6_Tables.Entry entry;
            switch (a1b1) {
            case -3:
                entry = T4_T6_Tables.VL3;
                break;
            case -2:
                entry = T4_T6_Tables.VL2;
                break;
            case -1:
                entry = T4_T6_Tables.VL1;
                break;
            case 0:
                entry = T4_T6_Tables.V0;
                break;
            case 1:
                entry = T4_T6_Tables.VR1;
                break;
            case 2:
                entry = T4_T6_Tables.VR2;
                break;
            default:
                entry = T4_T6_Tables.VR3;
                break;
            }
            entry.writeBits(outputStream);
            return a1;
        }
        final int a2 = nextChangingElement(codingLine, 1 - codingA0Color, a1 + 1);
        final int a0a1 = a1 - a0;
        final int a1a2 = a2 - a1;
        T4_T6_Tables.H.writeBits(outputStream);
        writeRunLength(outputStream, a0a1, codingA0Color);
        writeRunLength(outputStream, a1a2, 1 - codingA0Color);
        return a2;
    }
Compressed with the "Modified Huffman" encoding of section 10 in the TIFF6 specification. No EOLs, no RTC, rows are padded to end on a byte boundary.

@param uncompressed uncompressed byte data
@param width        image width
@param height       image height
@return the compressed data
@throws ImagingException if it fails to write the compressed data
src/main/java/org/apache/commons/imaging/formats/tiff/itu_t4/T4AndT6Compression.java