summaryrefslogtreecommitdiff
path: root/xpdf/JPXStream.h
diff options
context:
space:
mode:
Diffstat (limited to 'xpdf/JPXStream.h')
-rw-r--r--xpdf/JPXStream.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/xpdf/JPXStream.h b/xpdf/JPXStream.h
index 2c46ca0..d00a55e 100644
--- a/xpdf/JPXStream.h
+++ b/xpdf/JPXStream.h
@@ -199,7 +199,7 @@ struct JPXTileComp {
//----- computed
Guint x0, y0, x1, y1; // bounds of the tile-comp, in ref coords
- Guint w; // x1 - x0
+ Guint w, h; // data size = {x1 - x0, y1 - y0} >> reduction
Guint cbW; // code-block width
Guint cbH; // code-block height
@@ -234,6 +234,9 @@ struct JPXTile {
Guint precinct; // precinct
Guint layer; // layer
+ //----- tile part info
+ Guint nextTilePart; // next expected tile-part
+
//----- children
JPXTileComp *tileComps; // the tile-components (len = JPXImage.nComps)
};
@@ -247,6 +250,11 @@ struct JPXImage {
Guint xTileSize, yTileSize; // size of tiles
Guint xTileOffset, // offset of first tile
yTileOffset;
+ Guint xSizeR, ySizeR; // size of reference grid >> reduction
+ Guint xOffsetR, yOffsetR; // image offset >> reduction
+ Guint xTileSizeR, yTileSizeR; // size of tiles >> reduction
+ Guint xTileOffsetR, // offset of first tile >> reduction
+ yTileOffsetR;
Guint nComps; // number of components
//----- computed
@@ -259,6 +267,14 @@ struct JPXImage {
//------------------------------------------------------------------------
+enum JPXDecodeResult {
+ jpxDecodeOk,
+ jpxDecodeNonFatalError,
+ jpxDecodeFatalError
+};
+
+//------------------------------------------------------------------------
+
class JPXStream: public FilterStream {
public:
@@ -273,14 +289,15 @@ public:
virtual GBool isBinary(GBool last = gTrue);
virtual void getImageParams(int *bitsPerComponent,
StreamColorSpaceMode *csMode);
+ void reduceResolution(int reductionA) { reduction = reductionA; }
private:
void fillReadBuf();
void getImageParams2(int *bitsPerComponent, StreamColorSpaceMode *csMode);
- GBool readBoxes();
+ JPXDecodeResult readBoxes();
GBool readColorSpecBox(Guint dataLen);
- GBool readCodestream(Guint len);
+ JPXDecodeResult readCodestream(Guint len);
GBool readTilePart();
GBool readTilePartData(Guint tileIdx,
Guint tilePartLen, GBool tilePartToEOC);
@@ -314,6 +331,7 @@ private:
Guint nComps; // number of components
Guint *bpc; // bits per component, for each component
Guint width, height; // image size
+ int reduction; // log2(reduction in resolution)
GBool haveImgHdr; // set if a JP2/JPX image header has been
// found
JPXColorSpec cs; // color specification