(RPNG) Refactor png_reverse_filter_loop

This commit is contained in:
twinaphex 2015-03-13 21:34:18 +01:00
parent 1144e260d0
commit 2c48b2a25d

View File

@ -503,6 +503,7 @@ error:
static bool png_reverse_filter_loop(struct rpng_t *rpng,
uint32_t **data)
{
int ret = 0;
const struct png_ihdr *ihdr = NULL;
struct rpng_process_t *pngp = NULL;
rpng->process.adam7_restore_buf_size = 0;
@ -512,28 +513,27 @@ static bool png_reverse_filter_loop(struct rpng_t *rpng,
ihdr = &rpng->ihdr;
pngp = &rpng->process;
if (png_reverse_filter_init(ihdr, pngp) == -1)
return false;
if (rpng->ihdr.interlace == 1)
{
int ret = 0;
do
{
ret = png_reverse_filter_adam7(data,
ihdr, pngp);
}while(ret == 0);
if (ret == -1)
return false;
}
else
{
if (png_reverse_filter_init(ihdr, pngp) == -1)
return false;
if (!png_reverse_filter_regular(data,
ihdr, pngp))
return false;
ret = -1;
}
if (ret == -1)
return false;
return true;
}