il_wdp.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. //-----------------------------------------------------------------------------
  2. //
  3. // ImageLib Sources
  4. // Copyright (C) 2000-2008 by Denton Woods
  5. // Last modified: 09/26/2008
  6. //
  7. // Filename: src-IL/include/il_hdr.h
  8. //
  9. // Description: Reads a Microsoft HD Photo (.wdp)
  10. //
  11. //-----------------------------------------------------------------------------
  12. #ifndef WDP_H
  13. #define WDP_H
  14. #include "il_internal.h"
  15. //
  16. // Structures
  17. //
  18. typedef struct WDPHEAD
  19. {
  20. ILubyte Encoding[2];
  21. ILubyte UniqueID;
  22. ILubyte Version;
  23. ILuint Offset;
  24. } WDPHEAD;
  25. typedef struct WDPIFD
  26. {
  27. ILushort Tag;
  28. ILushort Type;
  29. ILuint Count;
  30. ILuint ValOff;
  31. ILuint NextOff;
  32. } WDPIFD;
  33. typedef struct WDPGUID
  34. {
  35. ILuint First;
  36. ILushort Second;
  37. ILushort Third;
  38. ILuint Fourth;
  39. ILuint Fifth;
  40. } WDPGUID;
  41. typedef struct WDPIMGHEAD
  42. {
  43. ILuint GDISignature[2];
  44. ILuint Codec;
  45. ILubyte Flags[2];
  46. ILubyte Format;
  47. ILuint Width, Height; // Can either be short or 32-bit int
  48. ILuint VertTiles, HorzTiles; // 12-bits each
  49. ILushort *TileWidth, *TileHeight; // 8 or 16-bits each
  50. ILubyte *TileStretch; // 8-bits each
  51. ILubyte ExtraPixels[3];
  52. } WDPIMGHEAD;
  53. typedef struct WDPIMGPLANE
  54. {
  55. ILubyte Flags1;
  56. ILubyte Color;
  57. ILubyte Bayer;
  58. ILubyte ShiftBits;
  59. ILubyte Mantissa;
  60. ILubyte Expbias;
  61. ILubyte Flags2;
  62. ILubyte NumChannels;
  63. } WDPIMGPLANE;
  64. typedef struct WDPDCQUANT
  65. {
  66. ILubyte ChMode;
  67. ILubyte DcQuant;
  68. ILubyte DcQuantY;
  69. ILubyte DcQuantUV;
  70. ILubyte DcQuantChan;
  71. } WDPDCQUANT;
  72. typedef struct WDPTILE
  73. {
  74. ILuint StartCode;
  75. ILubyte HashAndType;
  76. } WDPTILE;
  77. //
  78. // Image header defines
  79. //
  80. // Codec and sub-codec
  81. #define WDP_CODEC 0xF0
  82. #define WDP_SUBCODEC 0x0F
  83. // First set of flags
  84. #define WDP_TILING_FLAG 0x80
  85. #define WDP_BITSTREAM_FMT 0x40
  86. #define WDP_ORIENTATION 0x38
  87. #define WDP_INDEXTABLE 0x04
  88. #define WDP_OVERLAP 0x03
  89. // Second set of flags
  90. #define WDP_SHORT_HEADER 0x80
  91. #define WDP_LONG_WORD 0x40
  92. #define WDP_WINDOWING 0x20
  93. #define WDP_TRIM_FLEXBITS 0x10
  94. #define WDP_TILE_STRETCH 0x08
  95. #define WDP_ALPHACHANNEL 0x01
  96. // Format and bit-depth
  97. #define WDP_FORMAT 0xF0
  98. #define WDP_BITDEPTH 0x0F
  99. #define WDP_Y_ONLY 0x00
  100. #define WDP_YUV_420 0x01
  101. #define WDP_YUV_422 0x02
  102. #define WDP_YUV_444 0x03
  103. #define WDP_CMYK 0x04
  104. #define WDP_BAYER 0x05
  105. #define WDP_N_CHANNEL 0x06
  106. #define WDP_RGB 0x07
  107. #define WDP_RGBE 0x08
  108. // Bitdepth
  109. #define WDP_BD_1_WHITE 0x00
  110. #define WDP_BD_8 0x01
  111. #define WDP_BD_16 0x02
  112. #define WDP_BD_16S 0x03
  113. #define WDP_BD_16F 0x04
  114. #define WDP_BD_32 0x05
  115. #define WDP_BD_32S 0x06
  116. #define WDP_BD_32F 0x07
  117. #define WDP_BD_5 0x08
  118. #define WDP_BD_10 0x09
  119. #define WDP_BD_565 0x0A
  120. #define WDP_BD_1_BLACK 0x0F
  121. //
  122. // Image plane header defines
  123. //
  124. // First set of flags
  125. #define WDP_CLR_FMT 0xE0
  126. #define WDP_NO_SCALED 0x10
  127. #define WDP_BANDS_PRESENT 0x0F
  128. // Defines for n-channels
  129. #define WDP_NUM_CHANS 0xF0
  130. #define WDP_COLOR_INTERP 0x0F
  131. // Second set of flags
  132. #define WDP_DC_FRAME 0x80
  133. // Channel modes
  134. #define WDP_CH_UNIFORM 0x00
  135. #define WDP_CH_SEPARATE 0x01
  136. #define WDP_CH_INDEPENDENT 0x02
  137. // Tile types
  138. #define WDP_TILE_HASH 0xF8
  139. #define WDP_TILE_TYPE 0x03
  140. #define WDP_SPATIAL_TILE 0x00
  141. #define WDP_DC_TILE 0x01
  142. #define WDP_LOWPASS_TILE 0x02
  143. #define WDP_HIGHPASS_TILE 0x03
  144. #define WDP_FLEXBITS_TILE 0x04
  145. // Bands present
  146. #define WDP_SB_ALL 0x00
  147. #define WDP_SB_NO_FLEXBITS 0x01
  148. #define WDP_SB_NO_HIGHPASS 0x02
  149. #define WDP_SB_DC_ONLY 0x03
  150. #define WDP_SB_ISOLATED 0x04
  151. //
  152. // Internal functions
  153. //
  154. ILboolean iIsValidWdp();
  155. ILboolean iCheckWdp(WDPHEAD *Header);
  156. ILboolean iLoadWdpInternal();
  157. ILuint VLWESC();
  158. #endif//WDP_H