diff options
Diffstat (limited to 'linden/indra/llmessage/patch_dct.h')
-rw-r--r-- | linden/indra/llmessage/patch_dct.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/linden/indra/llmessage/patch_dct.h b/linden/indra/llmessage/patch_dct.h new file mode 100644 index 0000000..5d98921 --- /dev/null +++ b/linden/indra/llmessage/patch_dct.h | |||
@@ -0,0 +1,92 @@ | |||
1 | /** | ||
2 | * @file patch_dct.h | ||
3 | * @brief Function declarations for DCT and IDCT routines | ||
4 | * | ||
5 | * Copyright (c) 2000-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_PATCH_DCT_H | ||
29 | #define LL_PATCH_DCT_H | ||
30 | |||
31 | class LLVector3; | ||
32 | |||
33 | // Code Values | ||
34 | const U8 ZERO_CODE = 0x0; | ||
35 | const U8 ZERO_EOB = 0x2; | ||
36 | const U8 POSITIVE_VALUE = 0x6; | ||
37 | const U8 NEGATIVE_VALUE = 0x7; | ||
38 | |||
39 | const S8 NORMAL_PATCH_SIZE = 16; | ||
40 | const S8 LARGE_PATCH_SIZE = 32; | ||
41 | |||
42 | const U8 END_OF_PATCHES = 97; | ||
43 | |||
44 | #define _PATCH_SIZE_16_AND_32_ONLY | ||
45 | |||
46 | // Top level header for group of headers | ||
47 | //typedef struct LL_Group_Header | ||
48 | //{ | ||
49 | // U16 stride; // 2 = 2 | ||
50 | // U8 patch_size; // 1 = 3 | ||
51 | // U8 layer_type; // 1 = 4 | ||
52 | //} LLGroupHeader; | ||
53 | |||
54 | class LLGroupHeader | ||
55 | { | ||
56 | public: | ||
57 | U16 stride; // 2 = 2 | ||
58 | U8 patch_size; // 1 = 3 | ||
59 | U8 layer_type; // 1 = 4 | ||
60 | }; | ||
61 | |||
62 | // Individual patch header | ||
63 | |||
64 | //typedef struct LL_Patch_Header | ||
65 | //{ | ||
66 | // F32 dc_offset; // 4 bytes | ||
67 | // U16 range; // 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch) | ||
68 | // U8 quant_wbits; // 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2) | ||
69 | // U16 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each) | ||
70 | //} LLPatchHeader; | ||
71 | class LLPatchHeader | ||
72 | { | ||
73 | public: | ||
74 | F32 dc_offset; // 4 bytes | ||
75 | U16 range; // 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch) | ||
76 | U8 quant_wbits; // 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2) | ||
77 | U16 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each) | ||
78 | }; | ||
79 | |||
80 | // Compression routines | ||
81 | void init_patch_compressor(S32 patch_size, S32 patch_stride, S32 layer_type); | ||
82 | void prescan_patch(F32 *patch, LLPatchHeader *php, F32 &zmax, F32 &zmin); | ||
83 | void compress_patch(F32 *patch, S32 *cpatch, LLPatchHeader *php, S32 prequant); | ||
84 | void get_patch_group_header(LLGroupHeader *gopp); | ||
85 | |||
86 | // Decompression routines | ||
87 | void set_group_of_patch_header(LLGroupHeader *gopp); | ||
88 | void init_patch_decompressor(S32 size); | ||
89 | void decompress_patch(F32 *patch, S32 *cpatch, LLPatchHeader *ph); | ||
90 | void decompress_patchv(LLVector3 *v, S32 *cpatch, LLPatchHeader *ph); | ||
91 | |||
92 | #endif | ||