114 unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
115 unsigned int line_2_3 = block[5] + 256 * (block[6] + 256 * block[7]);
117 unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
119 unsigned int line_3_2 = ((line_2_3 & 0x000fff) << 12) | ((line_2_3 & 0xfff000) >> 12);
121 block[2] = line_3_2 & 0xff;
122 block[3] = (line_3_2 & 0xff00) >> 8;
123 block[4] = (line_3_2 & 0xff0000) >> 16;
124 block[5] = line_1_0 & 0xff;
125 block[6] = (line_1_0 & 0xff00) >> 8;
126 block[7] = (line_1_0 & 0xff0000) >> 16;
136 unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
137 unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
138 block[2] = line_1_0 & 0xff;
139 block[3] = (line_1_0 & 0xff00) >> 8;
140 block[4] = (line_1_0 & 0xff0000) >> 16;
150 unsigned int *r_num_valid_levels)
152 *r_num_valid_levels = 0;
165 unsigned int block_bytes = 0;
187 *r_num_valid_levels = levels;
189 unsigned int mip_width =
width;
190 unsigned int mip_height =
height;
194 for (
unsigned int i = 0; i < levels; i++) {
195 unsigned int blocks_per_row = (mip_width + 3) / 4;
196 unsigned int blocks_per_col = (mip_height + 3) / 4;
197 unsigned int blocks = blocks_per_row * blocks_per_col;
199 if (
data + block_bytes * blocks > data_end) {
202 *r_num_valid_levels = i;
206 if (mip_height == 1) {
210 if (mip_height == 2) {
212 for (
unsigned int i = 0; i < blocks_per_row; i++) {
213 half_block_function(
data + i * block_bytes);
218 for (
unsigned int i = 0; i < blocks; i++) {
219 full_block_function(
data + i * block_bytes);
225 unsigned int row_bytes = block_bytes * blocks_per_row;
228 for (
unsigned int y = 0;
y < blocks_per_col / 2;
y++) {
230 uint8_t *line2 =
data + (blocks_per_col -
y - 1) * row_bytes;
232 memcpy(temp_line, line1, row_bytes);
233 memcpy(line1, line2, row_bytes);
234 memcpy(line2, temp_line, row_bytes);
241 data += block_bytes * blocks;
242 mip_width =
MAX(1U, mip_width >> 1);
243 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 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
_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
Contains defines and structs used throughout the imbuf module.
SyclQueue void void size_t num_bytes void