pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1581603 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter: CCITTFaxFilter.java ccitt/TIFFFaxDecoder.java
Date Tue, 25 Mar 2014 23:50:08 GMT
Author: tilman
Date: Tue Mar 25 23:50:07 2014
New Revision: 1581603

URL: http://svn.apache.org/r1581603
Log:
PDFBOX-1074: implemented EncodedByteAlign = true for T6decode

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/TIFFFaxDecoder.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java?rev=1581603&r1=1581602&r2=1581603&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxFilter.java Tue Mar
25 23:50:07 2014
@@ -91,6 +91,7 @@ final class CCITTFaxFilter extends Filte
 
         // decompress data
         int k = decodeParms.getInt(COSName.K, 0);
+        boolean encodedByteAlign = decodeParms.getBoolean(COSName.ENCODED_BYTE_ALIGN, false);
         int arraySize = (cols + 7) / 8 * rows;
         TIFFFaxDecoder faxDecoder = new TIFFFaxDecoder(1, cols, rows);
         // TODO possible options??
@@ -112,7 +113,7 @@ final class CCITTFaxFilter extends Filte
         else if (k < 0)
         {
             decompressed = new byte[arraySize];
-            faxDecoder.decodeT6(decompressed, compressed, 0, rows, tiffOptions);
+            faxDecoder.decodeT6(decompressed, compressed, 0, rows, tiffOptions, encodedByteAlign);
         }
 
         // invert bitmap

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/TIFFFaxDecoder.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/TIFFFaxDecoder.java?rev=1581603&r1=1581602&r2=1581603&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/TIFFFaxDecoder.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/TIFFFaxDecoder.java Tue
Mar 25 23:50:07 2014
@@ -881,7 +881,8 @@ public final class TIFFFaxDecoder {
                                       byte[] compData,
                                       int startX,
                                       int height,
-                                      long tiffT6Options) {
+                                      long tiffT6Options,
+                                      boolean encodedByteAlign) {
         this.data = compData;
         compression = 4;
 
@@ -918,6 +919,11 @@ public final class TIFFFaxDecoder {
         int bitOffset;
 
         for (int lines = 0; lines < height; lines++) {
+            if (encodedByteAlign && bitPointer != 0)
+            {
+                bitPointer = 0;
+                bytePointer++;
+            }
             // a0 has to be set just before the start of the scanline.
             a0 = -1;
             isWhite = true;



Mime
View raw message