PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llmessage/patch_dct.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 91 lines | 35 code | 13 blank | 43 comment | 0 complexity | a9ef2e756866807166af9c19900ec276 MD5 | raw file
 1/** 
 2 * @file patch_dct.h
 3 * @brief Function declarations for DCT and IDCT routines
 4 *
 5 * $LicenseInfo:firstyear=2000&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_PATCH_DCT_H
28#define LL_PATCH_DCT_H
29
30class LLVector3;
31
32// Code Values
33const U8 ZERO_CODE	= 0x0;
34const U8 ZERO_EOB = 0x2;
35const U8 POSITIVE_VALUE = 0x6;
36const U8 NEGATIVE_VALUE = 0x7;
37
38const S8 NORMAL_PATCH_SIZE	= 16;
39const S8 LARGE_PATCH_SIZE = 32;
40
41const U8 END_OF_PATCHES = 97;
42
43#define _PATCH_SIZE_16_AND_32_ONLY
44
45// Top level header for group of headers
46//typedef struct LL_Group_Header
47//{
48//	U16  stride;		// 2 = 2
49//	U8  patch_size;		// 1 = 3
50//	U8  layer_type;		// 1 = 4
51//} LLGroupHeader;
52
53class LLGroupHeader
54{
55public:
56	U16	stride;			// 2 = 2
57	U8	patch_size;		// 1 = 3
58	U8	layer_type;		// 1 = 4
59};
60
61// Individual patch header
62
63//typedef struct LL_Patch_Header
64//{
65//	F32 dc_offset;		// 4 bytes
66//	U16 range;			// 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch)
67//	U8  quant_wbits;	// 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2)
68//	U16	patchids;		// 2 = 10 (actually only uses 10 bits, 5 for each)
69//} LLPatchHeader;
70class LLPatchHeader
71{
72public:
73	F32	dc_offset;		// 4 bytes
74	U16	range;			// 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch)
75	U8	quant_wbits;	// 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2)
76	U16	patchids;		// 2 = 10 (actually only uses 10 bits, 5 for each)
77};
78
79// Compression routines
80void init_patch_compressor(S32 patch_size, S32 patch_stride, S32 layer_type);
81void prescan_patch(F32 *patch, LLPatchHeader *php, F32 &zmax, F32 &zmin);
82void compress_patch(F32 *patch, S32 *cpatch, LLPatchHeader *php, S32 prequant);
83void get_patch_group_header(LLGroupHeader *gopp);
84
85// Decompression routines
86void set_group_of_patch_header(LLGroupHeader *gopp);
87void init_patch_decompressor(S32 size);
88void decompress_patch(F32 *patch, S32 *cpatch, LLPatchHeader *ph);
89void decompress_patchv(LLVector3 *v, S32 *cpatch, LLPatchHeader *ph);
90
91#endif