Optimize png_reverse_filter_copy_line_rgb

This commit is contained in:
twinaphex 2020-08-19 08:09:17 +02:00
parent dc3dc574d8
commit aa428cc415
1 changed files with 7 additions and 11 deletions

View File

@ -231,21 +231,17 @@ end:
static void png_reverse_filter_copy_line_rgb(uint32_t *data, static void png_reverse_filter_copy_line_rgb(uint32_t *data,
const uint8_t *decoded, unsigned width, unsigned bpp) const uint8_t *decoded, unsigned width, unsigned bpp)
{ {
unsigned i; uint32_t *data_ptr = NULL;
bpp /= 8; bpp /= 8;
for (i = 0; i < width; i++) for (data_ptr = &data[0]; data_ptr < data + width; data_ptr++)
{ {
uint32_t r, g, b; uint32_t r = *(decoded);
uint32_t g = *(decoded + bpp);
r = *decoded; uint32_t b = *(decoded + bpp + bpp);
decoded += bpp; decoded += (3 * bpp);
g = *decoded; *data_ptr = (0xffu << 24) | (r << 16) | (g << 8) | (b << 0);
decoded += bpp;
b = *decoded;
decoded += bpp;
data[i] = (0xffu << 24) | (r << 16) | (g << 8) | (b << 0);
} }
} }