blob: 18497d41b6f2b3bbc2649a6e91626c8850e41f2c [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2000-2003 Constantin Kaplinsky. All Rights Reserved.
DRC33c15e32011-11-03 18:49:21 +00002 * Copyright (C) 2011 D. R. Commander. All Rights Reserved.
Pierre Ossman80b42092015-11-10 17:17:34 +01003 * Copyright 2009-2015 Pierre Ossman for Cendio AB
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00004 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 * USA.
19 */
20#ifndef __RFB_TIGHTDECODER_H__
21#define __RFB_TIGHTDECODER_H__
22
23#include <rdr/ZlibInStream.h>
24#include <rfb/Decoder.h>
DRC33c15e32011-11-03 18:49:21 +000025#include <rfb/JpegDecompressor.h>
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000026
27namespace rfb {
28
29 class TightDecoder : public Decoder {
DRC33c15e32011-11-03 18:49:21 +000030
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000031 public:
Pierre Ossman86350622015-11-10 13:02:12 +010032 TightDecoder();
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000033 virtual ~TightDecoder();
Pierre Ossman86350622015-11-10 13:02:12 +010034 virtual void readRect(const Rect& r, rdr::InStream* is,
Pierre Ossman80b42092015-11-10 17:17:34 +010035 const ConnParams& cp, rdr::OutStream* os);
36 virtual void decodeRect(const Rect& r, const void* buffer,
37 size_t buflen, const ConnParams& cp,
38 ModifiablePixelBuffer* pb);
DRC33c15e32011-11-03 18:49:21 +000039
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000040 private:
Pierre Ossman7b5c0692014-03-17 14:35:51 +010041 rdr::U32 readCompact(rdr::InStream* is);
42
Pierre Ossman80b42092015-11-10 17:17:34 +010043 void FilterGradient24(const rdr::U8* inbuf, const PixelFormat& pf,
44 rdr::U32* outbuf, int stride, const Rect& r);
DRC33c15e32011-11-03 18:49:21 +000045
Pierre Ossman80b42092015-11-10 17:17:34 +010046 void FilterGradient(const rdr::U8* inbuf, const PixelFormat& pf,
47 rdr::U16* outbuf, int stride, const Rect& r);
48 void FilterGradient(const rdr::U8* inbuf, const PixelFormat& pf,
49 rdr::U32* outbuf, int stride, const Rect& r);
DRC33c15e32011-11-03 18:49:21 +000050
Pierre Ossman80b42092015-11-10 17:17:34 +010051 void FilterPalette(const rdr::U8* palette, int palSize,
52 const rdr::U8* inbuf, rdr::U8* outbuf,
53 int stride, const Rect& r);
54 void FilterPalette(const rdr::U16* palette, int palSize,
55 const rdr::U8* inbuf, rdr::U16* outbuf,
56 int stride, const Rect& r);
57 void FilterPalette(const rdr::U32* palette, int palSize,
58 const rdr::U8* inbuf, rdr::U32* outbuf,
59 int stride, const Rect& r);
DRC33c15e32011-11-03 18:49:21 +000060
Pierre Ossman80b42092015-11-10 17:17:34 +010061 private:
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000062 rdr::ZlibInStream zis[4];
DRC33c15e32011-11-03 18:49:21 +000063 JpegDecompressor jd;
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000064 };
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000065}
66
67#endif