Legendary Explorer Core
Nightly
Core library for working with Mass Effect Trilogy / Legendary Edition files
Toggle main menu visibility
Loading...
Searching...
No Matches
CompressonatorXCodec.h
Go to the documentation of this file.
1
//===============================================================================
2
// Copyright (c) 2017 Pawel Kolodziejski <aquadran at users.sourceforge.net>
3
// Copyright (c) 2007-2016 Advanced Micro Devices, Inc. All rights reserved.
4
// Copyright (c) 2004-2006 ATI Technologies Inc.
5
//===============================================================================
6
//
7
// Permission is hereby granted, free of charge, to any person obtaining a copy
8
// of this software and associated documentation files(the "Software"), to deal
9
// in the Software without restriction, including without limitation the rights
10
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11
// copies of the Software, and to permit persons to whom the Software is
12
// furnished to do so, subject to the following conditions :
13
//
14
// The above copyright notice and this permission notice shall be included in
15
// all copies or substantial portions of the Software.
16
//
17
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
20
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
// THE SOFTWARE.
24
//
25
// File Name: ATIXCodec.h
26
// Description: performs the DXT-style block compression
27
//
29
30
#ifndef _ATIXCODEC_H_
31
#define _ATIXCODEC_H_
32
33
/*------------------------------------------------------------------------------------
34
void CompRGBBlock(CMP_FLOAT* block_32, [IN] array of the 3 component color vectors (888)
35
CMP_DWORD block_dxtc[2], [OUT] compressed data in DXT1 for mat
36
int _NbrClrs = BLOCK_SIZE_4X4, [IN] actuall number of elements in the array
37
bool _bUseSSE2 = true); [IN] switch to SSE2 implementation
38
------------------------------------------------------------------------------------*/
39
CMP_FLOAT
CompRGBBlock
(
CMP_FLOAT
* block_32,
40
CMP_WORD
dwBlockSize,
41
CMP_BYTE
nRedBits,
42
CMP_BYTE
nGreenBits,
43
CMP_BYTE
nBlueBits,
44
CMP_BYTE
nEndpoints[3][2],
45
CMP_BYTE
* pcIndices,
46
CMP_BYTE
dwNumPoints,
47
bool
_bUseSSE2,
48
bool
b3DRefinement,
49
CMP_BYTE
nRefinementSteps,
50
CMP_FLOAT
* _pfChannelWeights = NULL,
51
bool
_bUseAlpha =
false
,
52
CMP_FLOAT
_fAlphaThreshold = 0.5);
53
54
/*------------------------------------------------------------------------------------
55
void CompRGBBlock(CMP_DWORD* block_32, [IN] array of the 3 component color vectors (888)
56
CMP_DWORD block_dxtc[2], [OUT] compressed data in DXT1 for mat
57
int _NbrClrs = BLOCK_SIZE_4X4, [IN] actuall number of elements in the array
58
bool _bUseSSE2 = true); [IN] switch to SSE2 implementation
59
------------------------------------------------------------------------------------*/
60
CMP_FLOAT
CompRGBBlock
(
CMP_DWORD
* block_32,
61
CMP_WORD
dwBlockSize,
62
CMP_BYTE
nRedBits,
63
CMP_BYTE
nGreenBits,
64
CMP_BYTE
nBlueBits,
65
CMP_BYTE
nEndpoints[3][2],
66
CMP_BYTE
* pcIndices,
67
CMP_BYTE
dwNumPoints,
68
bool
_bUseSSE2,
69
bool
b3DRefinement,
70
CMP_BYTE
nRefinementSteps,
71
CMP_FLOAT
* _pfChannelWeights = NULL,
72
bool
_bUseAlpha =
false
,
73
CMP_BYTE
_nAlphaThreshold = 128);
74
75
/*--------------------------------------------------------------------------------------------
76
// input [0,1]
77
void CompBlock1X(CMP_FLOAT* _Blk, [IN] scalar data block (alphas or normals) in float format
78
CMP_DWORD blockCompressed[2], [OUT] compressed data in DXT5 alpha foramt
79
int _NbrClrs, [IN] actual number of elements in the block
80
int _intPrec, [IN} integer precision; it applies both to the input data and
81
to the ramp points
82
int _fracPrec, [IN] fractional precision of the ramp points
83
bool _bFixedRamp, [IN] non-fixed ramp means we have input and generate
84
output as float. fixed ramp means that they are fractional numbers.
85
bool _bUseSSE2 [IN] forces to switch to the SSE2 implementation
86
)
87
88
---------------------------------------------------------------------------------------------*/
89
90
CMP_FLOAT
CompBlock1X
(
CMP_FLOAT
* _Blk,
91
CMP_WORD
dwBlockSize,
92
CMP_BYTE
nEndpoints[2],
93
CMP_BYTE
* pcIndices,
94
CMP_BYTE
dwNumPoints,
95
bool
bFixedRampPoints,
96
bool
_bUseSSE2 =
true
,
97
int
_intPrec = 8,
98
int
_fracPrec = 0,
99
bool
_bFixedRamp =
true
);
100
101
/*--------------------------------------------------------------------------------------------
102
// input [0,255]
103
void CompBlock1X(CMP_BYTE* _Blk, [IN] scalar data block (alphas or normals) in 8 bits format
104
CMP_DWORD blockCompressed[2], [OUT] compressed data in DXT5 alpha foramt
105
int _NbrClrs, [IN] actual number of elements in the block
106
int _intPrec, [IN] integer precision; it applies both to the input data and
107
to the ramp points
108
int _fracPrec, [IN] fractional precision of the ramp points
109
bool _bFixedRamp, [IN] always true at this point
110
bool _bUseSSE2 [IN] forces to switch to the SSE2 implementation
111
)
112
---------------------------------------------------------------------------------------------*/
113
114
CMP_FLOAT
CompBlock1X
(
CMP_BYTE
* _Blk,
115
CMP_WORD
dwBlockSize,
116
CMP_BYTE
nEndpoints[2],
117
CMP_BYTE
* pcIndices,
118
CMP_BYTE
dwNumPoints,
119
bool
bFixedRampPoints,
120
bool
_bUseSSE2 =
true
,
121
int
_intPrec = 8,
122
int
_fracPrec = 0,
123
bool
_bFixedRamp =
true
);
124
125
#endif
CMP_BYTE
unsigned char CMP_BYTE
An 8-bit integer format.
Definition
Common.h:34
CMP_DWORD
unsigned int CMP_DWORD
A 32-bit integer format.
Definition
Common.h:32
CMP_FLOAT
float CMP_FLOAT
A 32-bit float format.
Definition
Common.h:36
CMP_WORD
unsigned short CMP_WORD
A 16-bit integer format.
Definition
Common.h:33
CompBlock1X
CMP_FLOAT CompBlock1X(CMP_FLOAT *_Blk, CMP_WORD dwBlockSize, CMP_BYTE nEndpoints[2], CMP_BYTE *pcIndices, CMP_BYTE dwNumPoints, bool bFixedRampPoints, bool _bUseSSE2, int _intPrec, int _fracPrec, bool _bFixedRamp)
Definition
CompressonatorXCodec.cpp:2925
CompRGBBlock
CMP_FLOAT CompRGBBlock(CMP_FLOAT *block_32, CMP_WORD dwBlockSize, CMP_BYTE nRedBits, CMP_BYTE nGreenBits, CMP_BYTE nBlueBits, CMP_BYTE nEndpoints[3][NUM_ENDPOINTS], CMP_BYTE *pcIndices, CMP_BYTE dwNumPoints, bool _bUseSSE2, bool b3DRefinement, CMP_BYTE nRefinementSteps, CMP_FLOAT *_pfChannelWeights, bool _bUseAlpha, CMP_FLOAT _fAlphaThreshold)
Definition
CompressonatorXCodec.cpp:2188
LegendaryExplorer
LegendaryExplorerCore
Textures
Codecs
CompressonatorXCodec.h
Generated by
1.18.0