merge the formfield patch from ooo-build
[ooovba.git] / goodies / source / filter.vcl / itiff / ccidecom.hxx
blob3100428db594126b6e43b799c5f6181c7428ee3d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ccidecom.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CCIDECOM_HXX
32 #define _CCIDECOM_HXX
34 #include <tools/stream.hxx>
37 #define CCI_OPTION_2D 1 // 2D-Komprimierung (statt 1D)
38 #define CCI_OPTION_EOL 2 // EOL-Codes am Ende jeder Zeile vorhanden
39 #define CCI_OPTION_BYTEALIGNEOL 4 // Fuellbits vor jedem EOL-Code, so dass
40 // Ende von EOL auf Bytes aligend
41 #define CCI_OPTION_BYTEALIGNROW 8 // Rows beginnen immer auf Byte-Grenze
42 #define CCI_OPTION_INVERSEBITORDER 16
44 // Eintrag in eine Huffman-Tabelle:
45 struct CCIHuffmanTableEntry {
46 USHORT nValue; // Der Daten-Wert.
47 USHORT nCode; // Der Code durch den der Daten-Wert repraesentiert wird.
48 USHORT nCodeBits; // Laenge des Codes in Bits.
52 // Eintrag in eine Hash-Tabelle zur schnellen Dekodierung
53 struct CCILookUpTableEntry {
54 USHORT nValue;
55 USHORT nCodeBits;
59 class CCIDecompressor {
61 public:
63 CCIDecompressor( ULONG nOptions, UINT32 nImageWidth );
64 ~CCIDecompressor();
66 void StartDecompression( SvStream & rIStream );
68 BOOL DecompressScanline(BYTE * pTarget, ULONG nTargetBits );
70 private:
72 void MakeLookUp(const CCIHuffmanTableEntry * pHufTab,
73 const CCIHuffmanTableEntry * pHufTabSave,
74 CCILookUpTableEntry * pLookUp,
75 USHORT nHuffmanTableSize,
76 USHORT nMaxCodeBits);
78 BOOL ReadEOL( UINT32 nMaxFillBits );
80 BOOL Read2DTag();
82 BYTE ReadBlackOrWhite();
84 USHORT ReadCodeAndDecode(const CCILookUpTableEntry * pLookUp,
85 USHORT nMaxCodeBits);
87 void FillBits(BYTE * pTarget, USHORT nTargetBits,
88 USHORT nBitPos, USHORT nNumBits,
89 BYTE nBlackOrWhite);
91 USHORT CountBits(const BYTE * pData, USHORT nDataSizeBits,
92 USHORT nBitPos, BYTE nBlackOrWhite);
94 void Read1DScanlineData(BYTE * pTarget, USHORT nTargetBits);
96 void Read2DScanlineData(BYTE * pTarget, USHORT nTargetBits);
98 BOOL bTableBad;
100 BOOL bStatus;
102 BYTE* pByteSwap;
104 SvStream * pIStream;
106 UINT32 nEOLCount;
108 UINT32 nWidth;
110 ULONG nOptions;
112 BOOL bFirstEOL;
114 CCILookUpTableEntry * pWhiteLookUp;
115 CCILookUpTableEntry * pBlackLookUp;
116 CCILookUpTableEntry * p2DModeLookUp;
117 CCILookUpTableEntry * pUncompLookUp;
119 ULONG nInputBitsBuf;
120 USHORT nInputBitsBufSize;
122 BYTE * pLastLine;
123 ULONG nLastLineSize;
127 #endif