pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1581708 - in /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox: cos/COSName.java filter/CCITTFaxDecodeFilter.java filter/TIFFFaxDecoder.java
Date Wed, 26 Mar 2014 06:42:33 GMT
Author: tilman
Date: Wed Mar 26 06:42:33 2014
New Revision: 1581708

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

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/TIFFFaxDecoder.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java?rev=1581708&r1=1581707&r2=1581708&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSName.java Wed Mar 26
06:42:33 2014
@@ -535,6 +535,10 @@ public final class COSName extends COSBa
     /**
      * A common COSName value.
      */
+    public static final COSName ENCODED_BYTE_ALIGN = new COSName("EncodedByteAlign");
+    /**
+     * A common COSName value.
+     */
     public static final COSName ENCODING = new COSName( "Encoding" );
     /**
      * A common COSName value.
@@ -562,6 +566,11 @@ public final class COSName extends COSBa
      * A common COSName value.
      */
     public static final COSName ENCRYPT_META_DATA = new COSName( "EncryptMetadata" );
+
+    /**
+     * A common COSName value.
+     */
+    public static final COSName END_OF_LINE = new COSName("EndOfLine");
     
     /**
      * A common COSName value.

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java?rev=1581708&r1=1581707&r2=1581708&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/CCITTFaxDecodeFilter.java
Wed Mar 26 06:42:33 2014
@@ -102,6 +102,7 @@ public class CCITTFaxDecodeFilter implem
             rows = Math.max(rows, height);
         }
         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??
@@ -123,7 +124,7 @@ public class CCITTFaxDecodeFilter implem
         else if (k < 0)
         {
             byte[] decompressed = new byte[arraySize];
-            faxDecoder.decodeT6(decompressed, compressed, 0, rows, tiffOptions);
+            faxDecoder.decodeT6(decompressed, compressed, 0, rows, tiffOptions, encodedByteAlign);
             result.write(decompressed);
         }
     }

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/TIFFFaxDecoder.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/TIFFFaxDecoder.java?rev=1581708&r1=1581707&r2=1581708&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/TIFFFaxDecoder.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/filter/TIFFFaxDecoder.java
Wed Mar 26 06:42:33 2014
@@ -878,7 +878,8 @@ class TIFFFaxDecoder {
                                       byte[] compData,
                                       int startX,
                                       int height,
-                                      long tiffT6Options) {
+                                      long tiffT6Options,
+                                      boolean encodedByteAlign) {
         this.data = compData;
         compression = 4;
 
@@ -915,6 +916,11 @@ 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