Commit c33237fe authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Experiment with known align16

parent 7ea4a9f7
......@@ -114,7 +114,37 @@ trans_texture_swizzle_bpp4(int width, int height, int source_stride,
}
}
void
trans_texture_swizzle_bpp4_align16(int width, int height, int source_stride,
const uint32_t *pixels,
uint32_t *ldest)
{
int block_pitch = width >> 4;
int bytes_per_pixel = 4;
source_stride /= 4;
/* Calculate maximum size, overestimating a bit */
uint32_t sz = bytes_per_pixel * 256 * ((height >> 4) + 1) * block_pitch;
for (int y = 0; y < height; ++y) {
int block_y = y >> 4;
int rem_y = y & 0x0F;
int block_start_s = block_y * block_pitch * 256;
int source_start = y * source_stride;
for (int x = 0; x < width; x += 16) {
int block_x_s = (x >> 4) * 256;
for (int j = 0; j < 16; ++j) {
int rem_x = j;
int index = space_filler[rem_y][rem_x];
ldest[block_start_s + block_x_s + index] = pixels[source_start + x];
}
}
}
}
#if 1
#include <stdio.h>
......@@ -131,7 +161,8 @@ void main() {
uint8_t *out = malloc(TW*TH*4*2);
for (int i = 0; i < 64; ++i) {
trans_texture_swizzle_bpp4(TW, TH, TW*4, (uint32_t *) in, (uint32_t *) out);
trans_texture_swizzle_bpp4_align16(TW, TH, TW*4, (uint32_t *) in, (uint32_t *) out);
//trans_texture_swizzle_bpp4(TW, TH, TW*4, (uint32_t *) in, (uint32_t *) out);
//trans_texture_swizzle(TW, TH, 4, TW*4, (uint32_t *) in, (uint32_t *) out);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment