PageRenderTime 1ms CodeModel.GetById 27ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llkdu/llimagej2ckdu.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 95 lines | 53 code | 12 blank | 30 comment | 0 complexity | 62a66de2c071e90ae3b96de2cf96c93a MD5 | raw file
 1/** 
 2 * @file llimagej2ckdu.h
 3 * @brief This is an implementation of JPEG2000 encode/decode using Kakadu
 4 *
 5 * $LicenseInfo:firstyear=2010&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef LL_LLIMAGEJ2CKDU_H
28#define LL_LLIMAGEJ2CKDU_H
29
30#include "llimagej2c.h"
31
32//
33// KDU core header files
34//
35#include "kdu_elementary.h"
36#include "kdu_messaging.h"
37#include "kdu_params.h"
38#include "kdu_compressed.h"
39#include "kdu_sample_processing.h"
40
41class LLKDUDecodeState;
42class LLKDUMemSource;
43
44class LLImageJ2CKDU : public LLImageJ2CImpl
45{	
46public:
47	enum ECodeStreamMode 
48	{
49		MODE_FAST = 0,
50		MODE_RESILIENT = 1,
51		MODE_FUSSY = 2
52	};
53	LLImageJ2CKDU();
54	virtual ~LLImageJ2CKDU();
55	
56protected:
57	/*virtual*/ BOOL getMetadata(LLImageJ2C &base);
58	/*virtual*/ BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count);
59	/*virtual*/ BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,
60								BOOL reversible=FALSE);
61	/*virtual*/ BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL);
62	/*virtual*/ BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0);
63
64private:
65	BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level = -1, int* region = NULL);
66	void setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode);
67	void cleanupCodeStream();
68
69	// Encode variable
70	LLKDUMemSource *mInputp;
71	kdu_codestream *mCodeStreamp;
72	kdu_coords *mTPosp; // tile position
73	kdu_dims *mTileIndicesp;
74	int mBlocksSize;
75	int mPrecinctsSize;
76	int mLevels;
77
78	// Temporary variables for in-progress decodes...
79	LLImageRaw *mRawImagep;
80	LLKDUDecodeState *mDecodeState;
81};
82
83#if LL_WINDOWS
84# define LLSYMEXPORT __declspec(dllexport)
85#elif LL_LINUX
86# define LLSYMEXPORT __attribute__ ((visibility("default")))
87#else
88# define LLSYMEXPORT
89#endif
90
91extern "C" LLSYMEXPORT const char* engineInfoLLImageJ2CKDU();
92extern "C" LLSYMEXPORT LLImageJ2CKDU* createLLImageJ2CKDU();
93extern "C" LLSYMEXPORT void destroyLLImageJ2CKDU(LLImageJ2CKDU* kdu);
94
95#endif