Commit 7ea4a9f7 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Expeirment with bpp4 hardcode

parent f1ae3c4a
...@@ -85,6 +85,37 @@ trans_texture_swizzle(int width, int height, int bytes_per_pixel, int source_str ...@@ -85,6 +85,37 @@ trans_texture_swizzle(int width, int height, int bytes_per_pixel, int source_str
} }
} }
void
trans_texture_swizzle_bpp4(int width, int height, int source_stride,
const uint32_t *pixels,
uint32_t *ldest)
{
int block_pitch = ALIGN(width, 16) >> 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) {
int block_x_s = (x >> 4) * 256;
int rem_x = x & 0x0F;
int index = space_filler[rem_y][rem_x];
ldest[block_start_s + block_x_s + index] = pixels[source_start + x];
}
}
}
#if 1 #if 1
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -100,7 +131,8 @@ void main() { ...@@ -100,7 +131,8 @@ void main() {
uint8_t *out = malloc(TW*TH*4*2); uint8_t *out = malloc(TW*TH*4*2);
for (int i = 0; i < 64; ++i) { for (int i = 0; i < 64; ++i) {
trans_texture_swizzle(TW, TH, 4, TW*4, (uint8_t *) in, (uint8_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);
} }
uint8_t *reference = malloc(TW*TH*4*2); uint8_t *reference = malloc(TW*TH*4*2);
......
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