poppler/JPEG2000Stream.cc |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit d4e24e5754f5a0bf335ddf83747d0dc85b7c409f
Author: Thomas Freitag <[email protected]>
Date:   Sun Mar 6 22:46:23 2016 +0100

    implement jpx streams with depth < 8
    
    Bug #94371

diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc
index 4c632d7..8699b10 100644
--- a/poppler/JPEG2000Stream.cc
+++ b/poppler/JPEG2000Stream.cc
@@ -6,7 +6,7 @@
 //
 // Copyright 2008-2010, 2012 Albert Astals Cid <[email protected]>
 // Copyright 2011 Daniel Glöckner <[email protected]>
-// Copyright 2014 Thomas Freitag <[email protected]>
+// Copyright 2014, 2016 Thomas Freitag <[email protected]>
 // Copyright 2013, 2014 Adrian Johnson <[email protected]>
 // Copyright 2015 Adam Reichold <[email protected]>
 // Copyright 2015 Jakub Wilk <[email protected]>
@@ -188,6 +188,7 @@ void JPXStream::init()
       }
       unsigned char *cdata = (unsigned char 
*)priv->image->comps[component].data;
       int adjust = 0;
+      int depth = priv->image->comps[component].prec;
       if (priv->image->comps[component].prec > 8)
        adjust = priv->image->comps[component].prec - 8;
       int sgndcorr = 0;
@@ -201,6 +202,8 @@ void JPXStream::init()
          if (unlikely(r > 255))
            r = 255;
         }
+        if (depth < 8)
+          r = r << (8 - depth);
        *(cdata++) = r;
       }
     }
@@ -335,6 +338,7 @@ void JPXStream::init()
       }
       unsigned char *cdata = (unsigned char 
*)priv->image->comps[component].data;
       int adjust = 0;
+      int depth = priv->image->comps[component].prec;
       if (priv->image->comps[component].prec > 8)
        adjust = priv->image->comps[component].prec - 8;
       int sgndcorr = 0;
@@ -348,6 +352,8 @@ void JPXStream::init()
          if (unlikely(r > 255))
            r = 255;
         }
+        if (depth < 8)
+          r = r << (8 - depth);
        *(cdata++) = r;
       }
     }
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to