summaryrefslogtreecommitdiff
path: root/src/static_libs/rg_etc/rg_etc1.h
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2014-02-07 17:44:01 +0900
committerCedric BAIL <cedric.bail@free.fr>2014-04-01 22:00:13 +0900
commit2cac84f56794bfdff45002099f6c9d95376eff8a (patch)
tree6d882a87ea3224f528cc6ffb17ee9d155578a4f9 /src/static_libs/rg_etc/rg_etc1.h
parent03b29127f1bf27ab38147308c5615c35c4ee5b65 (diff)
rg_etc: convert to Unix file format.
Diffstat (limited to 'src/static_libs/rg_etc/rg_etc1.h')
-rw-r--r--src/static_libs/rg_etc/rg_etc1.h152
1 files changed, 76 insertions, 76 deletions
diff --git a/src/static_libs/rg_etc/rg_etc1.h b/src/static_libs/rg_etc/rg_etc1.h
index 9a701506fd..9ce89a6cc6 100644
--- a/src/static_libs/rg_etc/rg_etc1.h
+++ b/src/static_libs/rg_etc/rg_etc1.h
@@ -1,76 +1,76 @@
1// File: rg_etc1.h - Fast, high quality ETC1 block packer/unpacker - Rich Geldreich <richgel99@gmail.com> 1// File: rg_etc1.h - Fast, high quality ETC1 block packer/unpacker - Rich Geldreich <richgel99@gmail.com>
2// Please see ZLIB license at the end of this file. 2// Please see ZLIB license at the end of this file.
3#pragma once 3#pragma once
4 4
5namespace rg_etc1 5namespace rg_etc1
6{ 6{
7 // Unpacks an 8-byte ETC1 compressed block to a block of 4x4 32bpp RGBA pixels. 7 // Unpacks an 8-byte ETC1 compressed block to a block of 4x4 32bpp RGBA pixels.
8 // Returns false if the block is invalid. Invalid blocks will still be unpacked with clamping. 8 // Returns false if the block is invalid. Invalid blocks will still be unpacked with clamping.
9 // This function is thread safe, and does not dynamically allocate any memory. 9 // This function is thread safe, and does not dynamically allocate any memory.
10 // If preserve_alpha is true, the alpha channel of the destination pixels will not be overwritten. Otherwise, alpha will be set to 255. 10 // If preserve_alpha is true, the alpha channel of the destination pixels will not be overwritten. Otherwise, alpha will be set to 255.
11 bool unpack_etc1_block(const void *pETC1_block, unsigned int* pDst_pixels_rgba, bool preserve_alpha = false); 11 bool unpack_etc1_block(const void *pETC1_block, unsigned int* pDst_pixels_rgba, bool preserve_alpha = false);
12 12
13 // Quality setting = the higher the quality, the slower. 13 // Quality setting = the higher the quality, the slower.
14 // To pack large textures, it is highly recommended to call pack_etc1_block() in parallel, on different blocks, from multiple threads (particularly when using cHighQuality). 14 // To pack large textures, it is highly recommended to call pack_etc1_block() in parallel, on different blocks, from multiple threads (particularly when using cHighQuality).
15 enum etc1_quality 15 enum etc1_quality
16 { 16 {
17 cLowQuality, 17 cLowQuality,
18 cMediumQuality, 18 cMediumQuality,
19 cHighQuality, 19 cHighQuality,
20 }; 20 };
21 21
22 struct etc1_pack_params 22 struct etc1_pack_params
23 { 23 {
24 etc1_quality m_quality; 24 etc1_quality m_quality;
25 bool m_dithering; 25 bool m_dithering;
26 26
27 inline etc1_pack_params() 27 inline etc1_pack_params()
28 { 28 {
29 clear(); 29 clear();
30 } 30 }
31 31
32 void clear() 32 void clear()
33 { 33 {
34 m_quality = cHighQuality; 34 m_quality = cHighQuality;
35 m_dithering = false; 35 m_dithering = false;
36 } 36 }
37 }; 37 };
38 38
39 // Important: pack_etc1_block_init() must be called before calling pack_etc1_block(). 39 // Important: pack_etc1_block_init() must be called before calling pack_etc1_block().
40 void pack_etc1_block_init(); 40 void pack_etc1_block_init();
41 41
42 // Packs a 4x4 block of 32bpp RGBA pixels to an 8-byte ETC1 block. 42 // Packs a 4x4 block of 32bpp RGBA pixels to an 8-byte ETC1 block.
43 // 32-bit RGBA pixels must always be arranged as (R,G,B,A) (R first, A last) in memory, independent of platform endianness. A should always be 255. 43 // 32-bit RGBA pixels must always be arranged as (R,G,B,A) (R first, A last) in memory, independent of platform endianness. A should always be 255.
44 // Returns squared error of result. 44 // Returns squared error of result.
45 // This function is thread safe, and does not dynamically allocate any memory. 45 // This function is thread safe, and does not dynamically allocate any memory.
46 // pack_etc1_block() does not currently support "perceptual" colorspace metrics - it primarily optimizes for RGB RMSE. 46 // pack_etc1_block() does not currently support "perceptual" colorspace metrics - it primarily optimizes for RGB RMSE.
47 unsigned int pack_etc1_block(void* pETC1_block, const unsigned int* pSrc_pixels_rgba, etc1_pack_params& pack_params); 47 unsigned int pack_etc1_block(void* pETC1_block, const unsigned int* pSrc_pixels_rgba, etc1_pack_params& pack_params);
48 48
49} // namespace rg_etc1 49} // namespace rg_etc1
50 50
51//------------------------------------------------------------------------------ 51//------------------------------------------------------------------------------
52// 52//
53// rg_etc1 uses the ZLIB license: 53// rg_etc1 uses the ZLIB license:
54// http://opensource.org/licenses/Zlib 54// http://opensource.org/licenses/Zlib
55// 55//
56// Copyright (c) 2012 Rich Geldreich 56// Copyright (c) 2012 Rich Geldreich
57// 57//
58// This software is provided 'as-is', without any express or implied 58// This software is provided 'as-is', without any express or implied
59// warranty. In no event will the authors be held liable for any damages 59// warranty. In no event will the authors be held liable for any damages
60// arising from the use of this software. 60// arising from the use of this software.
61// 61//
62// Permission is granted to anyone to use this software for any purpose, 62// Permission is granted to anyone to use this software for any purpose,
63// including commercial applications, and to alter it and redistribute it 63// including commercial applications, and to alter it and redistribute it
64// freely, subject to the following restrictions: 64// freely, subject to the following restrictions:
65// 65//
66// 1. The origin of this software must not be misrepresented; you must not 66// 1. The origin of this software must not be misrepresented; you must not
67// claim that you wrote the original software. If you use this software 67// claim that you wrote the original software. If you use this software
68// in a product, an acknowledgment in the product documentation would be 68// in a product, an acknowledgment in the product documentation would be
69// appreciated but is not required. 69// appreciated but is not required.
70// 70//
71// 2. Altered source versions must be plainly marked as such, and must not be 71// 2. Altered source versions must be plainly marked as such, and must not be
72// misrepresented as being the original software. 72// misrepresented as being the original software.
73// 73//
74// 3. This notice may not be removed or altered from any source distribution. 74// 3. This notice may not be removed or altered from any source distribution.
75// 75//
76//------------------------------------------------------------------------------ 76//------------------------------------------------------------------------------