minor update

This commit is contained in:
Blaise Tine
2021-03-31 14:07:12 -04:00
parent 7b2f96bc6d
commit 1332fd1b67
8 changed files with 631 additions and 623 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -52,8 +52,8 @@ int main() {
targ.karg = *arg; targ.karg = *arg;
targ.tile_width = arg->dst_width; targ.tile_width = arg->dst_width;
targ.tile_height = (arg->dst_height + arg->num_tasks - 1) / arg->num_tasks; targ.tile_height = (arg->dst_height + arg->num_tasks - 1) / arg->num_tasks;
targ.deltaX = 1.0f / (((float)arg->src_width) / arg->dst_width); targ.deltaX = 1.0f / arg->dst_width;
targ.deltaY = 1.0f / (((float)arg->src_height) / arg->dst_height); targ.deltaY = 1.0f / arg->dst_height;
vx_spawn_tasks(arg->num_tasks, kernel_body, &targ); vx_spawn_tasks(arg->num_tasks, kernel_body, &targ);
} }

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -20,7 +20,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
const char* kernel_file = "kernel.bin"; const char* kernel_file = "kernel.bin";
const char* input_file = "palette.tga"; const char* input_file = "toad.tga";
const char* output_file = "output.tga"; const char* output_file = "output.tga";
float scale = 1.0f; float scale = 1.0f;

View File

@@ -63,11 +63,13 @@ int LoadTGA(const char *filename,
return -1; return -1;
} }
// Because the TGA is BGR instead of RGB, we must swap RG components // TGA uses BGR instead of RGB, we must swap RG components
for (int i = 0; i < pitch; i += stride) { if (stride >= 3) {
auto tmp = line[i]; for (int i = 0; i < pitch; i += stride) {
line[i] = line[i + 2]; auto tmp = line[i];
line[i + 2] = tmp; line[i] = line[i + 2];
line[i + 2] = tmp;
}
} }
} }
break; break;
@@ -116,7 +118,19 @@ int SaveTGA(const char *filename,
for (uint32_t y = 0; y < height; ++y) { for (uint32_t y = 0; y < height; ++y) {
const uint8_t* pixel_row = pixel_bytes; const uint8_t* pixel_row = pixel_bytes;
for (uint32_t x = 0; x < width; ++x) { for (uint32_t x = 0; x < width; ++x) {
ofs.write((const char*)pixel_row, bpp); // TGA uses BGR instead of RGB, we must swap RG components
if (bpp == 4) {
ofs.write((const char*)pixel_row + 2, 1);
ofs.write((const char*)pixel_row + 1, 1);
ofs.write((const char*)pixel_row + 0, 1);
ofs.write((const char*)pixel_row + 3, 1);
} else if (bpp == 3) {
ofs.write((const char*)pixel_row + 2, 1);
ofs.write((const char*)pixel_row + 1, 1);
ofs.write((const char*)pixel_row + 0, 1);
} else{
ofs.write((const char*)pixel_row, bpp);
}
pixel_row += bpp; pixel_row += bpp;
} }
pixel_bytes -= pitch; pixel_bytes -= pitch;

View File

@@ -46,7 +46,7 @@ module VX_tex_sampler #(
VX_tex_format #( VX_tex_format #(
.CORE_ID (CORE_ID), .CORE_ID (CORE_ID),
.NUM_TEXELS (4) .NUM_TEXELS (4)
) tex_format_texel ( ) tex_format (
.texel_data (req_texels[i]), .texel_data (req_texels[i]),
.format (req_format), .format (req_format),