patch_dct.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_PATCH_DCT_H
00033 #define LL_PATCH_DCT_H
00034 
00035 class LLVector3;
00036 
00037 // Code Values
00038 const U8 ZERO_CODE      = 0x0;
00039 const U8 ZERO_EOB = 0x2;
00040 const U8 POSITIVE_VALUE = 0x6;
00041 const U8 NEGATIVE_VALUE = 0x7;
00042 
00043 const S8 NORMAL_PATCH_SIZE      = 16;
00044 const S8 LARGE_PATCH_SIZE = 32;
00045 
00046 const U8 END_OF_PATCHES = 97;
00047 
00048 #define _PATCH_SIZE_16_AND_32_ONLY
00049 
00050 // Top level header for group of headers
00051 //typedef struct LL_Group_Header
00052 //{
00053 //      U16  stride;            // 2 = 2
00054 //      U8  patch_size;         // 1 = 3
00055 //      U8  layer_type;         // 1 = 4
00056 //} LLGroupHeader;
00057 
00058 class LLGroupHeader
00059 {
00060 public:
00061         U16     stride;                 // 2 = 2
00062         U8      patch_size;             // 1 = 3
00063         U8      layer_type;             // 1 = 4
00064 };
00065 
00066 // Individual patch header
00067 
00068 //typedef struct LL_Patch_Header
00069 //{
00070 //      F32 dc_offset;          // 4 bytes
00071 //      U16 range;                      // 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch)
00072 //      U8  quant_wbits;        // 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2)
00073 //      U16     patchids;               // 2 = 10 (actually only uses 10 bits, 5 for each)
00074 //} LLPatchHeader;
00075 class LLPatchHeader
00076 {
00077 public:
00078         F32     dc_offset;              // 4 bytes
00079         U16     range;                  // 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch)
00080         U8      quant_wbits;    // 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2)
00081         U16     patchids;               // 2 = 10 (actually only uses 10 bits, 5 for each)
00082 };
00083 
00084 // Compression routines
00085 void init_patch_compressor(S32 patch_size, S32 patch_stride, S32 layer_type);
00086 void prescan_patch(F32 *patch, LLPatchHeader *php, F32 &zmax, F32 &zmin);
00087 void compress_patch(F32 *patch, S32 *cpatch, LLPatchHeader *php, S32 prequant);
00088 void get_patch_group_header(LLGroupHeader *gopp);
00089 
00090 // Decompression routines
00091 void set_group_of_patch_header(LLGroupHeader *gopp);
00092 void init_patch_decompressor(S32 size);
00093 void decompress_patch(F32 *patch, S32 *cpatch, LLPatchHeader *ph);
00094 void decompress_patchv(LLVector3 *v, S32 *cpatch, LLPatchHeader *ph);
00095 
00096 #endif

Generated on Thu Jul 1 06:09:57 2010 for Second Life Viewer by  doxygen 1.4.7