| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#ifndef CRNLIB_H |
| 15 |
#define CRNLIB_H |
| 16 |
|
| 17 |
#ifdef _MSC_VER |
| 18 |
#pragma warning(disable : 4127) // conditional expression is constant |
| 19 |
#endif |
| 20 |
|
| 21 |
#define CRNLIB_VERSION 104 |
| 22 |
|
| 23 |
#define CRNLIB_SUPPORT_ATI_COMPRESS 0 |
| 24 |
#define CRNLIB_SUPPORT_SQUISH 0 |
| 25 |
|
| 26 |
typedef unsigned char crn_uint8; |
| 27 |
typedef unsigned short crn_uint16; |
| 28 |
typedef unsigned int crn_uint32; |
| 29 |
typedef signed char crn_int8; |
| 30 |
typedef signed short crn_int16; |
| 31 |
typedef signed int crn_int32; |
| 32 |
typedef unsigned int crn_bool; |
| 33 |
|
| 34 |
|
| 35 |
enum crn_file_type { |
| 36 |
|
| 37 |
cCRNFileTypeCRN = 0, |
| 38 |
|
| 39 |
|
| 40 |
cCRNFileTypeDDS, |
| 41 |
|
| 42 |
cCRNFileTypeForceDWORD = 0xFFFFFFFF |
| 43 |
}; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
enum crn_format { |
| 49 |
cCRNFmtInvalid = -1, |
| 50 |
|
| 51 |
cCRNFmtDXT1 = 0, |
| 52 |
|
| 53 |
cCRNFmtFirstValid = cCRNFmtDXT1, |
| 54 |
|
| 55 |
|
| 56 |
cCRNFmtDXT3, |
| 57 |
|
| 58 |
cCRNFmtDXT5, |
| 59 |
|
| 60 |
|
| 61 |
cCRNFmtDXT5_CCxY, |
| 62 |
cCRNFmtDXT5_xGxR, |
| 63 |
cCRNFmtDXT5_xGBR, |
| 64 |
cCRNFmtDXT5_AGBR, |
| 65 |
|
| 66 |
|
| 67 |
cCRNFmtDXN_XY, |
| 68 |
cCRNFmtDXN_YX, |
| 69 |
|
| 70 |
|
| 71 |
cCRNFmtDXT5A, |
| 72 |
|
| 73 |
cCRNFmtETC1, |
| 74 |
cCRNFmtETC2, |
| 75 |
cCRNFmtETC2A, |
| 76 |
cCRNFmtETC1S, |
| 77 |
cCRNFmtETC2AS, |
| 78 |
|
| 79 |
cCRNFmtTotal, |
| 80 |
|
| 81 |
cCRNFmtForceDWORD = 0xFFFFFFFF |
| 82 |
}; |
| 83 |
|
| 84 |
|
| 85 |
enum crn_limits { |
| 86 |
|
| 87 |
cCRNMaxLevelResolution = 4096, |
| 88 |
|
| 89 |
cCRNMinPaletteSize = 8, |
| 90 |
cCRNMaxPaletteSize = 8192, |
| 91 |
|
| 92 |
cCRNMaxFaces = 6, |
| 93 |
cCRNMaxLevels = 16, |
| 94 |
|
| 95 |
cCRNMaxHelperThreads = 15, |
| 96 |
|
| 97 |
cCRNMinQualityLevel = 0, |
| 98 |
cCRNMaxQualityLevel = 255 |
| 99 |
}; |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
enum crn_comp_flags { |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
cCRNCompFlagPerceptual = 1, |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
cCRNCompFlagHierarchical = 2, |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
cCRNCompFlagQuick = 4, |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
cCRNCompFlagUseBothBlockTypes = 8, |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
cCRNCompFlagUseTransparentIndicesForBlack = 16, |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
cCRNCompFlagDisableEndpointCaching = 32, |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
cCRNCompFlagManualPaletteSizes = 64, |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
cCRNCompFlagDXT1AForTransparency = 128, |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
cCRNCompFlagGrayscaleSampling = 256, |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
cCRNCompFlagDebugging = 0x80000000, |
| 153 |
|
| 154 |
cCRNCompFlagForceDWORD = 0xFFFFFFFF |
| 155 |
}; |
| 156 |
|
| 157 |
|
| 158 |
enum crn_dxt_quality { |
| 159 |
cCRNDXTQualitySuperFast, |
| 160 |
cCRNDXTQualityFast, |
| 161 |
cCRNDXTQualityNormal, |
| 162 |
cCRNDXTQualityBetter, |
| 163 |
cCRNDXTQualityUber, |
| 164 |
|
| 165 |
cCRNDXTQualityTotal, |
| 166 |
|
| 167 |
cCRNDXTQualityForceDWORD = 0xFFFFFFFF |
| 168 |
}; |
| 169 |
|
| 170 |
|
| 171 |
enum crn_dxt_compressor_type { |
| 172 |
cCRNDXTCompressorCRN, |
| 173 |
cCRNDXTCompressorCRNF, |
| 174 |
cCRNDXTCompressorRYG, |
| 175 |
|
| 176 |
#if CRNLIB_SUPPORT_ATI_COMPRESS |
| 177 |
cCRNDXTCompressorATI, |
| 178 |
#endif |
| 179 |
|
| 180 |
#if CRNLIB_SUPPORT_SQUISH |
| 181 |
cCRNDXTCompressorSquish, |
| 182 |
#endif |
| 183 |
|
| 184 |
cCRNTotalDXTCompressors, |
| 185 |
|
| 186 |
cCRNDXTCompressorForceDWORD = 0xFFFFFFFF |
| 187 |
}; |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
typedef crn_bool (*crn_progress_callback_func)(crn_uint32 phase_index, crn_uint32 total_phases, crn_uint32 subphase_index, crn_uint32 total_subphases, void* pUser_data_ptr); |
| 194 |
|
| 195 |
|
| 196 |
struct crn_comp_params { |
| 197 |
inline crn_comp_params() { clear(); } |
| 198 |
|
| 199 |
|
| 200 |
inline void clear() { |
| 201 |
m_size_of_obj = sizeof(*this); |
| 202 |
m_file_type = cCRNFileTypeCRN; |
| 203 |
m_faces = 1; |
| 204 |
m_width = 0; |
| 205 |
m_height = 0; |
| 206 |
m_levels = 1; |
| 207 |
m_format = cCRNFmtDXT1; |
| 208 |
m_flags = cCRNCompFlagPerceptual | cCRNCompFlagHierarchical | cCRNCompFlagUseBothBlockTypes; |
| 209 |
|
| 210 |
for (crn_uint32 f = 0; f < cCRNMaxFaces; f++) |
| 211 |
for (crn_uint32 l = 0; l < cCRNMaxLevels; l++) |
| 212 |
m_pImages[f][l] = NULL; |
| 213 |
|
| 214 |
m_target_bitrate = 0.0f; |
| 215 |
m_quality_level = cCRNMaxQualityLevel; |
| 216 |
m_dxt1a_alpha_threshold = 128; |
| 217 |
m_dxt_quality = cCRNDXTQualityUber; |
| 218 |
m_dxt_compressor_type = cCRNDXTCompressorCRN; |
| 219 |
m_alpha_component = 3; |
| 220 |
|
| 221 |
m_crn_adaptive_tile_color_psnr_derating = 2.0f; |
| 222 |
m_crn_adaptive_tile_alpha_psnr_derating = 2.0f; |
| 223 |
m_crn_color_endpoint_palette_size = 0; |
| 224 |
m_crn_color_selector_palette_size = 0; |
| 225 |
m_crn_alpha_endpoint_palette_size = 0; |
| 226 |
m_crn_alpha_selector_palette_size = 0; |
| 227 |
|
| 228 |
m_num_helper_threads = 0; |
| 229 |
m_userdata0 = 1; |
| 230 |
m_userdata1 = 0; |
| 231 |
m_pProgress_func = NULL; |
| 232 |
m_pProgress_func_data = NULL; |
| 233 |
} |
| 234 |
|
| 235 |
inline bool operator==(const crn_comp_params& rhs) const { |
| 236 |
#define CRNLIB_COMP(x) \ |
| 237 |
do { \ |
| 238 |
if ((x) != (rhs.x)) \ |
| 239 |
return false; \ |
| 240 |
} while (0) |
| 241 |
CRNLIB_COMP(m_size_of_obj); |
| 242 |
CRNLIB_COMP(m_file_type); |
| 243 |
CRNLIB_COMP(m_faces); |
| 244 |
CRNLIB_COMP(m_width); |
| 245 |
CRNLIB_COMP(m_height); |
| 246 |
CRNLIB_COMP(m_levels); |
| 247 |
CRNLIB_COMP(m_format); |
| 248 |
CRNLIB_COMP(m_flags); |
| 249 |
CRNLIB_COMP(m_target_bitrate); |
| 250 |
CRNLIB_COMP(m_quality_level); |
| 251 |
CRNLIB_COMP(m_dxt1a_alpha_threshold); |
| 252 |
CRNLIB_COMP(m_dxt_quality); |
| 253 |
CRNLIB_COMP(m_dxt_compressor_type); |
| 254 |
CRNLIB_COMP(m_alpha_component); |
| 255 |
CRNLIB_COMP(m_crn_adaptive_tile_color_psnr_derating); |
| 256 |
CRNLIB_COMP(m_crn_adaptive_tile_alpha_psnr_derating); |
| 257 |
CRNLIB_COMP(m_crn_color_endpoint_palette_size); |
| 258 |
CRNLIB_COMP(m_crn_color_selector_palette_size); |
| 259 |
CRNLIB_COMP(m_crn_alpha_endpoint_palette_size); |
| 260 |
CRNLIB_COMP(m_crn_alpha_selector_palette_size); |
| 261 |
CRNLIB_COMP(m_num_helper_threads); |
| 262 |
CRNLIB_COMP(m_userdata0); |
| 263 |
CRNLIB_COMP(m_userdata1); |
| 264 |
CRNLIB_COMP(m_pProgress_func); |
| 265 |
CRNLIB_COMP(m_pProgress_func_data); |
| 266 |
|
| 267 |
for (crn_uint32 f = 0; f < cCRNMaxFaces; f++) |
| 268 |
for (crn_uint32 l = 0; l < cCRNMaxLevels; l++) |
| 269 |
CRNLIB_COMP(m_pImages[f][l]); |
| 270 |
|
| 271 |
#undef CRNLIB_COMP |
| 272 |
return true; |
| 273 |
} |
| 274 |
|
| 275 |
|
| 276 |
inline bool check() const { |
| 277 |
if ((m_file_type > cCRNFileTypeDDS) || |
| 278 |
(((int)m_quality_level < (int)cCRNMinQualityLevel) || ((int)m_quality_level > (int)cCRNMaxQualityLevel)) || |
| 279 |
(m_dxt1a_alpha_threshold > 255) || |
| 280 |
((m_faces != 1) && (m_faces != 6)) || |
| 281 |
((m_width < 1) || (m_width > cCRNMaxLevelResolution)) || |
| 282 |
((m_height < 1) || (m_height > cCRNMaxLevelResolution)) || |
| 283 |
((m_levels < 1) || (m_levels > cCRNMaxLevels)) || |
| 284 |
((m_format < cCRNFmtDXT1) || (m_format >= cCRNFmtTotal)) || |
| 285 |
((m_crn_color_endpoint_palette_size) && ((m_crn_color_endpoint_palette_size < cCRNMinPaletteSize) || (m_crn_color_endpoint_palette_size > cCRNMaxPaletteSize))) || |
| 286 |
((m_crn_color_selector_palette_size) && ((m_crn_color_selector_palette_size < cCRNMinPaletteSize) || (m_crn_color_selector_palette_size > cCRNMaxPaletteSize))) || |
| 287 |
((m_crn_alpha_endpoint_palette_size) && ((m_crn_alpha_endpoint_palette_size < cCRNMinPaletteSize) || (m_crn_alpha_endpoint_palette_size > cCRNMaxPaletteSize))) || |
| 288 |
((m_crn_alpha_selector_palette_size) && ((m_crn_alpha_selector_palette_size < cCRNMinPaletteSize) || (m_crn_alpha_selector_palette_size > cCRNMaxPaletteSize))) || |
| 289 |
(m_alpha_component > 3) || |
| 290 |
(m_num_helper_threads > cCRNMaxHelperThreads) || |
| 291 |
(m_dxt_quality > cCRNDXTQualityUber) || |
| 292 |
(m_dxt_compressor_type >= cCRNTotalDXTCompressors)) { |
| 293 |
return false; |
| 294 |
} |
| 295 |
return true; |
| 296 |
} |
| 297 |
|
| 298 |
|
| 299 |
inline bool get_flag(crn_comp_flags flag) const { return (m_flags & flag) != 0; } |
| 300 |
inline void set_flag(crn_comp_flags flag, bool val) { |
| 301 |
m_flags &= ~flag; |
| 302 |
if (val) |
| 303 |
m_flags |= flag; |
| 304 |
} |
| 305 |
|
| 306 |
crn_uint32 m_size_of_obj; |
| 307 |
|
| 308 |
crn_file_type m_file_type; |
| 309 |
|
| 310 |
crn_uint32 m_faces; |
| 311 |
crn_uint32 m_width; |
| 312 |
crn_uint32 m_height; |
| 313 |
crn_uint32 m_levels; |
| 314 |
|
| 315 |
crn_format m_format; |
| 316 |
|
| 317 |
crn_uint32 m_flags; |
| 318 |
|
| 319 |
|
| 320 |
const crn_uint32* m_pImages[cCRNMaxFaces][cCRNMaxLevels]; |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
float m_target_bitrate; |
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
crn_uint32 m_quality_level; |
| 330 |
|
| 331 |
|
| 332 |
crn_uint32 m_dxt1a_alpha_threshold; |
| 333 |
crn_dxt_quality m_dxt_quality; |
| 334 |
crn_dxt_compressor_type m_dxt_compressor_type; |
| 335 |
|
| 336 |
|
| 337 |
crn_uint32 m_alpha_component; |
| 338 |
|
| 339 |
|
| 340 |
float m_crn_adaptive_tile_color_psnr_derating; |
| 341 |
float m_crn_adaptive_tile_alpha_psnr_derating; |
| 342 |
|
| 343 |
crn_uint32 m_crn_color_endpoint_palette_size; |
| 344 |
crn_uint32 m_crn_color_selector_palette_size; |
| 345 |
|
| 346 |
crn_uint32 m_crn_alpha_endpoint_palette_size; |
| 347 |
crn_uint32 m_crn_alpha_selector_palette_size; |
| 348 |
|
| 349 |
|
| 350 |
crn_uint32 m_num_helper_threads; |
| 351 |
|
| 352 |
|
| 353 |
crn_uint32 m_userdata0; |
| 354 |
crn_uint32 m_userdata1; |
| 355 |
|
| 356 |
|
| 357 |
crn_progress_callback_func m_pProgress_func; |
| 358 |
void* m_pProgress_func_data; |
| 359 |
}; |
| 360 |
|
| 361 |
|
| 362 |
enum crn_mip_mode { |
| 363 |
cCRNMipModeUseSourceOrGenerateMips, |
| 364 |
cCRNMipModeUseSourceMips, |
| 365 |
cCRNMipModeGenerateMips, |
| 366 |
cCRNMipModeNoMips, |
| 367 |
|
| 368 |
cCRNMipModeTotal, |
| 369 |
|
| 370 |
cCRNModeForceDWORD = 0xFFFFFFFF |
| 371 |
}; |
| 372 |
|
| 373 |
const char* crn_get_mip_mode_desc(crn_mip_mode m); |
| 374 |
const char* crn_get_mip_mode_name(crn_mip_mode m); |
| 375 |
|
| 376 |
|
| 377 |
enum crn_mip_filter { |
| 378 |
cCRNMipFilterBox, |
| 379 |
cCRNMipFilterTent, |
| 380 |
cCRNMipFilterLanczos4, |
| 381 |
cCRNMipFilterMitchell, |
| 382 |
cCRNMipFilterKaiser, |
| 383 |
|
| 384 |
cCRNMipFilterTotal, |
| 385 |
|
| 386 |
cCRNMipFilterForceDWORD = 0xFFFFFFFF |
| 387 |
}; |
| 388 |
|
| 389 |
const char* crn_get_mip_filter_name(crn_mip_filter f); |
| 390 |
|
| 391 |
|
| 392 |
enum crn_scale_mode { |
| 393 |
cCRNSMDisabled, |
| 394 |
cCRNSMAbsolute, |
| 395 |
cCRNSMRelative, |
| 396 |
cCRNSMLowerPow2, |
| 397 |
cCRNSMNearestPow2, |
| 398 |
cCRNSMNextPow2, |
| 399 |
|
| 400 |
cCRNSMTotal, |
| 401 |
|
| 402 |
cCRNSMForceDWORD = 0xFFFFFFFF |
| 403 |
}; |
| 404 |
|
| 405 |
const char* crn_get_scale_mode_desc(crn_scale_mode sm); |
| 406 |
|
| 407 |
|
| 408 |
struct crn_mipmap_params { |
| 409 |
inline crn_mipmap_params() { clear(); } |
| 410 |
|
| 411 |
inline void clear() { |
| 412 |
m_size_of_obj = sizeof(*this); |
| 413 |
m_mode = cCRNMipModeUseSourceOrGenerateMips; |
| 414 |
m_filter = cCRNMipFilterKaiser; |
| 415 |
m_gamma_filtering = true; |
| 416 |
m_gamma = 2.2f; |
| 417 |
|
| 418 |
m_blurriness = .9f; |
| 419 |
m_renormalize = false; |
| 420 |
m_rtopmip = false; |
| 421 |
m_tiled = false; |
| 422 |
m_max_levels = cCRNMaxLevels; |
| 423 |
m_min_mip_size = 1; |
| 424 |
|
| 425 |
m_scale_mode = cCRNSMDisabled; |
| 426 |
m_scale_x = 1.0f; |
| 427 |
m_scale_y = 1.0f; |
| 428 |
|
| 429 |
m_window_left = 0; |
| 430 |
m_window_top = 0; |
| 431 |
m_window_right = 0; |
| 432 |
m_window_bottom = 0; |
| 433 |
|
| 434 |
m_clamp_scale = false; |
| 435 |
m_clamp_width = 0; |
| 436 |
m_clamp_height = 0; |
| 437 |
} |
| 438 |
|
| 439 |
inline bool check() const { return true; } |
| 440 |
|
| 441 |
inline bool operator==(const crn_mipmap_params& rhs) const { |
| 442 |
#define CRNLIB_COMP(x) \ |
| 443 |
do { \ |
| 444 |
if ((x) != (rhs.x)) \ |
| 445 |
return false; \ |
| 446 |
} while (0) |
| 447 |
CRNLIB_COMP(m_size_of_obj); |
| 448 |
CRNLIB_COMP(m_mode); |
| 449 |
CRNLIB_COMP(m_filter); |
| 450 |
CRNLIB_COMP(m_gamma_filtering); |
| 451 |
CRNLIB_COMP(m_gamma); |
| 452 |
CRNLIB_COMP(m_blurriness); |
| 453 |
CRNLIB_COMP(m_renormalize); |
| 454 |
CRNLIB_COMP(m_rtopmip); |
| 455 |
CRNLIB_COMP(m_tiled); |
| 456 |
CRNLIB_COMP(m_max_levels); |
| 457 |
CRNLIB_COMP(m_min_mip_size); |
| 458 |
CRNLIB_COMP(m_scale_mode); |
| 459 |
CRNLIB_COMP(m_scale_x); |
| 460 |
CRNLIB_COMP(m_scale_y); |
| 461 |
CRNLIB_COMP(m_window_left); |
| 462 |
CRNLIB_COMP(m_window_top); |
| 463 |
CRNLIB_COMP(m_window_right); |
| 464 |
CRNLIB_COMP(m_window_bottom); |
| 465 |
CRNLIB_COMP(m_clamp_scale); |
| 466 |
CRNLIB_COMP(m_clamp_width); |
| 467 |
CRNLIB_COMP(m_clamp_height); |
| 468 |
return true; |
| 469 |
#undef CRNLIB_COMP |
| 470 |
} |
| 471 |
crn_uint32 m_size_of_obj; |
| 472 |
|
| 473 |
crn_mip_mode m_mode; |
| 474 |
crn_mip_filter m_filter; |
| 475 |
|
| 476 |
crn_bool m_gamma_filtering; |
| 477 |
float m_gamma; |
| 478 |
|
| 479 |
float m_blurriness; |
| 480 |
|
| 481 |
crn_uint32 m_max_levels; |
| 482 |
crn_uint32 m_min_mip_size; |
| 483 |
|
| 484 |
crn_bool m_renormalize; |
| 485 |
crn_bool m_rtopmip; |
| 486 |
crn_bool m_tiled; |
| 487 |
|
| 488 |
crn_scale_mode m_scale_mode; |
| 489 |
float m_scale_x; |
| 490 |
float m_scale_y; |
| 491 |
|
| 492 |
crn_uint32 m_window_left; |
| 493 |
crn_uint32 m_window_top; |
| 494 |
crn_uint32 m_window_right; |
| 495 |
crn_uint32 m_window_bottom; |
| 496 |
|
| 497 |
crn_bool m_clamp_scale; |
| 498 |
crn_uint32 m_clamp_width; |
| 499 |
crn_uint32 m_clamp_height; |
| 500 |
}; |
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
#ifndef CRNLIB_MIN_ALLOC_ALIGNMENT |
| 505 |
#define CRNLIB_MIN_ALLOC_ALIGNMENT sizeof(size_t) * 2 |
| 506 |
#endif |
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
typedef void* (*crn_realloc_func)(void* p, size_t size, size_t* pActual_size, bool movable, void* pUser_data); |
| 511 |
typedef size_t (*crn_msize_func)(void* p, void* pUser_data); |
| 512 |
void crn_set_memory_callbacks(crn_realloc_func pRealloc, crn_msize_func pMSize, void* pUser_data); |
| 513 |
|
| 514 |
|
| 515 |
void crn_free_block(void* pBlock); |
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
void* crn_compress(const crn_comp_params& comp_params, crn_uint32& compressed_size, crn_uint32* pActual_quality_level = NULL, float* pActual_bitrate = NULL); |
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
void* crn_compress(const crn_comp_params& comp_params, const crn_mipmap_params& mip_params, crn_uint32& compressed_size, crn_uint32* pActual_quality_level = NULL, float* pActual_bitrate = NULL); |
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
void* crn_decompress_crn_to_dds(const void* pCRN_file_data, crn_uint32& file_size); |
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
struct crn_texture_desc { |
| 552 |
crn_uint32 m_faces; |
| 553 |
crn_uint32 m_width; |
| 554 |
crn_uint32 m_height; |
| 555 |
crn_uint32 m_levels; |
| 556 |
crn_uint32 m_fmt_fourcc; |
| 557 |
}; |
| 558 |
bool crn_decompress_dds_to_images(const void* pDDS_file_data, crn_uint32 dds_file_size, crn_uint32** ppImages, crn_texture_desc& tex_desc); |
| 559 |
|
| 560 |
|
| 561 |
void crn_free_all_images(crn_uint32** ppImages, const crn_texture_desc& desc); |
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
crn_uint32 crn_get_format_fourcc(crn_format fmt); |
| 567 |
|
| 568 |
|
| 569 |
crn_uint32 crn_get_format_bits_per_texel(crn_format fmt); |
| 570 |
|
| 571 |
|
| 572 |
crn_uint32 crn_get_bytes_per_dxt_block(crn_format fmt); |
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
crn_format crn_get_fundamental_dxt_format(crn_format fmt); |
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
const char* crn_get_file_type_ext(crn_file_type file_type); |
| 582 |
|
| 583 |
|
| 584 |
const char* crn_get_format_string(crn_format fmt); |
| 585 |
|
| 586 |
|
| 587 |
const char* crn_get_dxt_quality_string(crn_dxt_quality q); |
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
typedef void* crn_block_compressor_context_t; |
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
crn_block_compressor_context_t crn_create_block_compressor(const crn_comp_params& params); |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
void crn_compress_block(crn_block_compressor_context_t pContext, const crn_uint32* pPixels, void* pDst_block); |
| 604 |
|
| 605 |
|
| 606 |
void crn_free_block_compressor(crn_block_compressor_context_t pContext); |
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
bool crn_decompress_block(const void* pSrc_block, crn_uint32* pDst_pixels, crn_format crn_fmt); |
| 615 |
|
| 616 |
#endif |
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
|