#include "pngdsp.h"
#include "thread.h"
-/* TODO:
- * - add 16 bit depth support
- */
-
#include <zlib.h>
typedef struct PNGDecContext {
uint32_t palette[256];
uint8_t *crow_buf;
uint8_t *last_row;
- int last_row_size;
+ unsigned int last_row_size;
uint8_t *tmp_row;
+ unsigned int tmp_row_size;
uint8_t *buffer;
int buffer_size;
int pass;
png_filter_row(&s->dsp, s->tmp_row, s->crow_buf[0], s->crow_buf + 1,
s->last_row, s->pass_row_size, s->bpp);
FFSWAP(uint8_t*, s->last_row, s->tmp_row);
+ FFSWAP(unsigned int, s->last_row_size, s->tmp_row_size);
got_line = 1;
}
if ((png_pass_dsp_ymask[s->pass] << (s->y & 7)) & 0x80) {
goto fail;
if (s->interlace_type ||
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
- s->tmp_row = av_malloc(s->row_size);
+ av_fast_padded_malloc(&s->tmp_row, &s->tmp_row_size, s->row_size);
if (!s->tmp_row)
goto fail;
}
the_end:
inflateEnd(&s->zstream);
s->crow_buf = NULL;
- av_freep(&s->tmp_row);
return ret;
fail:
av_dict_free(&metadata);
s->buffer_size = 0;
av_freep(&s->last_row);
s->last_row_size = 0;
+ av_freep(&s->tmp_row);
+ s->tmp_row_size = 0;
return 0;
}