141 unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
142 unsigned int line_2_3 = block[5] + 256 * (block[6] + 256 * block[7]);
144 unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
146 unsigned int line_3_2 = ((line_2_3 & 0x000fff) << 12) | ((line_2_3 & 0xfff000) >> 12);
148 block[2] = line_3_2 & 0xff;
149 block[3] = (line_3_2 & 0xff00) >> 8;
150 block[4] = (line_3_2 & 0xff0000) >> 16;
151 block[5] = line_1_0 & 0xff;
152 block[6] = (line_1_0 & 0xff00) >> 8;
153 block[7] = (line_1_0 & 0xff0000) >> 16;
163 unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
164 unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
165 block[2] = line_1_0 & 0xff;
166 block[3] = (line_1_0 & 0xff00) >> 8;
167 block[4] = (line_1_0 & 0xff0000) >> 16;
177 unsigned int *r_num_valid_levels)
179 *r_num_valid_levels = 0;
192 unsigned int block_bytes = 0;
214 *r_num_valid_levels = levels;
216 unsigned int mip_width =
width;
217 unsigned int mip_height =
height;
221 for (
unsigned int i = 0; i < levels; i++) {
222 unsigned int blocks_per_row = (mip_width + 3) / 4;
223 unsigned int blocks_per_col = (mip_height + 3) / 4;
224 unsigned int blocks = blocks_per_row * blocks_per_col;
226 if (
data + block_bytes * blocks > data_end) {
229 *r_num_valid_levels = i;
233 if (mip_height == 1) {
237 if (mip_height == 2) {
239 for (
unsigned int i = 0; i < blocks_per_row; i++) {
240 half_block_function(
data + i * block_bytes);
245 for (
unsigned int i = 0; i < blocks; i++) {
246 full_block_function(
data + i * block_bytes);
252 unsigned int row_bytes = block_bytes * blocks_per_row;
255 for (
unsigned int y = 0;
y < blocks_per_col / 2;
y++) {
257 uint8_t *line2 =
data + (blocks_per_col -
y - 1) * row_bytes;
259 memcpy(temp_line, line1, row_bytes);
260 memcpy(line1, line2, row_bytes);
261 memcpy(line2, temp_line, row_bytes);
268 data += block_bytes * blocks;
269 mip_width =
MAX(1U, mip_width >> 1);
270 mip_height =
MAX(1U, mip_height >> 1);
static const uint FOURCC_DXT3
static const uint FOURCC_DXT5
static const uint FOURCC_DXT1
static void FlipDXT3BlockFull(uint8_t *block)
void(*)(uint8_t *block) FlipBlockFunction
static void FlipDXT5BlockHalf(uint8_t *block)
static void FlipDXT1BlockFull(uint8_t *block)
static void FlipDXT5BlockFull(uint8_t *block)
static void FlipDXT1BlockHalf(uint8_t *block)
static void FlipDXT3BlockHalf(uint8_t *block)
int FlipDXTCImage(unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data, int data_size, unsigned int *r_num_valid_levels)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Contains defines and structs used throughout the imbuf module.