Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for missed optimisation with grayscale same layouts #257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions spng/spng.c
Original file line number Diff line number Diff line change
Expand Up @@ -3749,13 +3749,15 @@ int spng_decode_image(spng_ctx *ctx, void *out, size_t len, int fmt, int flags)

f.apply_trns = 0;
}
else if(fmt == SPNG_FMT_GA8 && ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth <= 8)
else if(fmt == SPNG_FMT_GA8 && (ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE ||
ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA) && ihdr->bit_depth <= 8)
{
if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA &&
ihdr->bit_depth == depth_target) f.same_layout = 1;
else if(ihdr->bit_depth <= 8) f.unpack = 1;
}
else if(fmt == SPNG_FMT_GA16 && ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth == 16)
else if(fmt == SPNG_FMT_GA16 && (ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE ||
ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA) && ihdr->bit_depth == 16)
{
if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA &&
ihdr->bit_depth == depth_target) f.same_layout = 1;
Expand Down