/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. #ifndef LL_PATCH_DCT_H
  27. #define LL_PATCH_DCT_H
  28. class LLVector3;
  29. // Code Values
  30. const U8 ZERO_CODE = 0x0;
  31. const U8 ZERO_EOB = 0x2;
  32. const U8 POSITIVE_VALUE = 0x6;
  33. const U8 NEGATIVE_VALUE = 0x7;
  34. const S8 NORMAL_PATCH_SIZE = 16;
  35. const S8 LARGE_PATCH_SIZE = 32;
  36. const U8 END_OF_PATCHES = 97;
  37. #define _PATCH_SIZE_16_AND_32_ONLY
  38. // Top level header for group of headers
  39. //typedef struct LL_Group_Header
  40. //{
  41. // U16 stride; // 2 = 2
  42. // U8 patch_size; // 1 = 3
  43. // U8 layer_type; // 1 = 4
  44. //} LLGroupHeader;
  45. class LLGroupHeader
  46. {
  47. public:
  48. U16 stride; // 2 = 2
  49. U8 patch_size; // 1 = 3
  50. U8 layer_type; // 1 = 4
  51. };
  52. // Individual patch header
  53. //typedef struct LL_Patch_Header
  54. //{
  55. // F32 dc_offset; // 4 bytes
  56. // U16 range; // 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch)
  57. // U8 quant_wbits; // 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2)
  58. // U16 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each)
  59. //} LLPatchHeader;
  60. class LLPatchHeader
  61. {
  62. public:
  63. F32 dc_offset; // 4 bytes
  64. U16 range; // 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch)
  65. U8 quant_wbits; // 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2)
  66. U16 patchids; // 2 = 10 (actually only uses 10 bits, 5 for each)
  67. };
  68. // Compression routines
  69. void init_patch_compressor(S32 patch_size, S32 patch_stride, S32 layer_type);
  70. void prescan_patch(F32 *patch, LLPatchHeader *php, F32 &zmax, F32 &zmin);
  71. void compress_patch(F32 *patch, S32 *cpatch, LLPatchHeader *php, S32 prequant);
  72. void get_patch_group_header(LLGroupHeader *gopp);
  73. // Decompression routines
  74. void set_group_of_patch_header(LLGroupHeader *gopp);
  75. void init_patch_decompressor(S32 size);
  76. void decompress_patch(F32 *patch, S32 *cpatch, LLPatchHeader *ph);
  77. void decompress_patchv(LLVector3 *v, S32 *cpatch, LLPatchHeader *ph);
  78. #endif