mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
Revert "(RPNG) optimizations to copy_line_bw"
This reverts commit 9b29217564b567241ed47bdd52d978d9acdf4f9e.
This commit is contained in:
parent
e3d77d7f28
commit
003ff126ce
@ -266,24 +266,32 @@ static void png_reverse_filter_copy_line_rgba(uint32_t *data,
|
|||||||
static void png_reverse_filter_copy_line_bw(uint32_t *data,
|
static void png_reverse_filter_copy_line_bw(uint32_t *data,
|
||||||
const uint8_t *decoded, unsigned width, unsigned depth)
|
const uint8_t *decoded, unsigned width, unsigned depth)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i, bit;
|
||||||
static const unsigned
|
static const unsigned mul_table[] = { 0, 0xff, 0x55, 0, 0x11, 0, 0, 0, 0x01 };
|
||||||
mul_table[] = { 0, 0xff, 0x55, 0, 0x11, 0, 0, 0, 0x01 };
|
unsigned mul, mask;
|
||||||
unsigned mul = mul_table[depth];
|
|
||||||
unsigned mask = (1 << depth) - 1;
|
|
||||||
unsigned bit = 0;
|
|
||||||
uint32_t *data_ptr = NULL;
|
|
||||||
|
|
||||||
for ( i = 0, data_ptr = &data[0]
|
if (depth == 16)
|
||||||
; i < width
|
{
|
||||||
; i++, data_ptr++, bit += depth)
|
for (i = 0; i < width; i++)
|
||||||
|
{
|
||||||
|
uint32_t val = decoded[i << 1];
|
||||||
|
data[i] = (val * 0x010101) | (0xffu << 24);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mul = mul_table[depth];
|
||||||
|
mask = (1 << depth) - 1;
|
||||||
|
bit = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < width; i++, bit += depth)
|
||||||
{
|
{
|
||||||
unsigned byte = bit >> 3;
|
unsigned byte = bit >> 3;
|
||||||
unsigned val = decoded[byte] >> (8 - depth - (bit & 7));
|
unsigned val = decoded[byte] >> (8 - depth - (bit & 7));
|
||||||
|
|
||||||
val &= mask;
|
val &= mask;
|
||||||
val *= mul;
|
val *= mul;
|
||||||
*data_ptr = (val * 0x010101) | (0xffu << 24);
|
data[i] = (val * 0x010101) | (0xffu << 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,23 +617,7 @@ static int png_reverse_filter_copy_line(uint32_t *data, const struct png_ihdr *i
|
|||||||
switch (ihdr->color_type)
|
switch (ihdr->color_type)
|
||||||
{
|
{
|
||||||
case PNG_IHDR_COLOR_GRAY:
|
case PNG_IHDR_COLOR_GRAY:
|
||||||
if (ihdr->depth == 16)
|
png_reverse_filter_copy_line_bw(data, pngp->decoded_scanline, ihdr->width, ihdr->depth);
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
const uint8_t *decoded = pngp->decoded_scanline;
|
|
||||||
unsigned width = ihdr->width;
|
|
||||||
uint32_t *data_ptr = NULL;
|
|
||||||
|
|
||||||
for ( i = 0, data_ptr = &data[0]
|
|
||||||
; i < width
|
|
||||||
; data_ptr++, i++)
|
|
||||||
{
|
|
||||||
uint32_t val = decoded[i << 1];
|
|
||||||
*data_ptr = (val * 0x010101) | (0xffu << 24);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
png_reverse_filter_copy_line_bw(data, pngp->decoded_scanline, ihdr->width, ihdr->depth);
|
|
||||||
break;
|
break;
|
||||||
case PNG_IHDR_COLOR_RGB:
|
case PNG_IHDR_COLOR_RGB:
|
||||||
png_reverse_filter_copy_line_rgb(data, pngp->decoded_scanline, ihdr->width, ihdr->depth);
|
png_reverse_filter_copy_line_rgb(data, pngp->decoded_scanline, ihdr->width, ihdr->depth);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user