PageRenderTime 25ms CodeModel.GetById 21ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLIMAGEJ2CKDU_H
  27. #define LL_LLIMAGEJ2CKDU_H
  28. #include "llimagej2c.h"
  29. //
  30. // KDU core header files
  31. //
  32. #include "kdu_elementary.h"
  33. #include "kdu_messaging.h"
  34. #include "kdu_params.h"
  35. #include "kdu_compressed.h"
  36. #include "kdu_sample_processing.h"
  37. class LLKDUDecodeState;
  38. class LLKDUMemSource;
  39. class LLImageJ2CKDU : public LLImageJ2CImpl
  40. {
  41. public:
  42. enum ECodeStreamMode
  43. {
  44. MODE_FAST = 0,
  45. MODE_RESILIENT = 1,
  46. MODE_FUSSY = 2
  47. };
  48. LLImageJ2CKDU();
  49. virtual ~LLImageJ2CKDU();
  50. protected:
  51. /*virtual*/ BOOL getMetadata(LLImageJ2C &base);
  52. /*virtual*/ BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count);
  53. /*virtual*/ BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,
  54. BOOL reversible=FALSE);
  55. /*virtual*/ BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, int discard_level = -1, int* region = NULL);
  56. /*virtual*/ BOOL initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int blocks_size = -1, int precincts_size = -1, int levels = 0);
  57. private:
  58. 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);
  59. void setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode);
  60. void cleanupCodeStream();
  61. // Encode variable
  62. LLKDUMemSource *mInputp;
  63. kdu_codestream *mCodeStreamp;
  64. kdu_coords *mTPosp; // tile position
  65. kdu_dims *mTileIndicesp;
  66. int mBlocksSize;
  67. int mPrecinctsSize;
  68. int mLevels;
  69. // Temporary variables for in-progress decodes...
  70. LLImageRaw *mRawImagep;
  71. LLKDUDecodeState *mDecodeState;
  72. };
  73. #if LL_WINDOWS
  74. # define LLSYMEXPORT __declspec(dllexport)
  75. #elif LL_LINUX
  76. # define LLSYMEXPORT __attribute__ ((visibility("default")))
  77. #else
  78. # define LLSYMEXPORT
  79. #endif
  80. extern "C" LLSYMEXPORT const char* engineInfoLLImageJ2CKDU();
  81. extern "C" LLSYMEXPORT LLImageJ2CKDU* createLLImageJ2CKDU();
  82. extern "C" LLSYMEXPORT void destroyLLImageJ2CKDU(LLImageJ2CKDU* kdu);
  83. #endif