LibreOffice Module vcl (master)  1
lzwdecom.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_ITIFF_LZWDECOM_HXX
21 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_ITIFF_LZWDECOM_HXX
22 
23 #include <sal/types.h>
24 #include <array>
25 
26 #define MAX_TABLE_SIZE 4096
27 
29 {
30  sal_uInt16 nPrevCode;
31  sal_uInt16 nDataCount;
33 };
34 
35 class SvStream;
36 
38 {
39 public:
42 
43  void StartDecompression(SvStream& rIStream);
44 
45  // Returns the number of written bytes. If < nMaxCount there is
46  // no more data to be unpacked or an error occurred.
47  sal_uInt64 Decompress(sal_uInt8* pTarget, sal_uInt32 nMaxCount);
48 
49 private:
50  sal_uInt16 GetNextCode();
51  void AddToTable(sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData);
52  void DecompressSome();
53 
55 
56  std::array<LZWTableEntry, MAX_TABLE_SIZE> aTable;
57  sal_uInt16 nTableSize;
58 
60 
61  sal_uInt16 nOldCode;
62 
63  std::array<sal_uInt8, MAX_TABLE_SIZE> pOutBuf;
65  sal_uInt16 nOutBufDataLen;
66 
68  sal_uInt16 nInputBitsBufSize;
69 };
70 
71 #endif
72 
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 GetNextCode()
Definition: lzwdecom.cxx:115
void AddToTable(sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData)
Definition: lzwdecom.cxx:148
sal_uInt8 nInputBitsBuf
Definition: lzwdecom.hxx:67
sal_uInt16 nDataCount
Definition: lzwdecom.hxx:31
std::array< LZWTableEntry, MAX_TABLE_SIZE > aTable
Definition: lzwdecom.hxx:56
sal_uInt16 nTableSize
Definition: lzwdecom.hxx:57
SvStream * pIStream
Definition: lzwdecom.hxx:54
sal_uInt16 nPrevCode
Definition: lzwdecom.hxx:30
sal_uInt8 * pOutBufData
Definition: lzwdecom.hxx:64
void StartDecompression(SvStream &rIStream)
Definition: lzwdecom.cxx:52
sal_uInt16 nOutBufDataLen
Definition: lzwdecom.hxx:65
std::array< sal_uInt8, MAX_TABLE_SIZE > pOutBuf
Definition: lzwdecom.hxx:63
unsigned char sal_uInt8
sal_uInt16 nOldCode
Definition: lzwdecom.hxx:61
sal_uInt64 Decompress(sal_uInt8 *pTarget, sal_uInt32 nMaxCount)
Definition: lzwdecom.cxx:77
sal_uInt16 nInputBitsBufSize
Definition: lzwdecom.hxx:68
void DecompressSome()
Definition: lzwdecom.cxx:180
sal_uInt8 nData
Definition: lzwdecom.hxx:32