(RPNG) Start adding restore_buf_size incrementing

This commit is contained in:
twinaphex 2015-03-13 19:47:51 +01:00
parent 03984168c6
commit 4852773da4

View File

@ -290,7 +290,7 @@ static int png_reverse_filter_init(const struct png_ihdr *ihdr,
return 0; return 0;
} }
if (pngp->pass_initialized) if (pngp->pass_initialized)
return 0; return 0;
@ -299,6 +299,7 @@ static int png_reverse_filter_init(const struct png_ihdr *ihdr,
if (pngp->stream.total_out < pass_size) if (pngp->stream.total_out < pass_size)
return -1; return -1;
pngp->restore_buf_size = 0;
pngp->prev_scanline = (uint8_t*)calloc(1, pngp->pitch); pngp->prev_scanline = (uint8_t*)calloc(1, pngp->pitch);
pngp->decoded_scanline = (uint8_t*)calloc(1, pngp->pitch); pngp->decoded_scanline = (uint8_t*)calloc(1, pngp->pitch);
@ -405,6 +406,7 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
if (pngp->h < ihdr->height) if (pngp->h < ihdr->height)
{ {
unsigned filter = *inflate_buf++; unsigned filter = *inflate_buf++;
pngp->restore_buf_size += 1;
ret = png_reverse_filter_copy_line(data, ret = png_reverse_filter_copy_line(data,
ihdr, inflate_buf, pngp, palette, filter); ihdr, inflate_buf, pngp, palette, filter);
} }
@ -416,7 +418,8 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
} }
pngp->h++; pngp->h++;
inflate_buf += pngp->pitch; inflate_buf += pngp->pitch;
pngp->restore_buf_size += pngp->pitch;
data += ihdr->width; data += ihdr->width;
}while(1); }while(1);
@ -485,11 +488,13 @@ end:
static bool png_reverse_filter_loop(struct rpng_t *rpng, static bool png_reverse_filter_loop(struct rpng_t *rpng,
uint32_t **data) uint32_t **data)
{ {
rpng->process.adam7_restore_buf_size = 0;
rpng->process.restore_buf_size = 0;
if (rpng->ihdr.interlace == 1) if (rpng->ihdr.interlace == 1)
{ {
int ret = 0; int ret = 0;
rpng->process.adam7_restore_buf_size = 0;
do do
{ {