Go to the documentation of this file.
  112     0x01, 0x01, 0x11, 0x11, 0x55, 0x55, 0xff,
 
  117     0xff, 0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
 
  122     0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff
 
  129                                    int bits_per_pixel, 
int pass,
 
  132     int x, 
mask, dsp_mask, j, src_x, 
b, bpp;
 
  139     switch (bits_per_pixel) {
 
  142         for (x = 0; x < 
width; x++) {
 
  144             if ((dsp_mask << j) & 0x80) {
 
  145                 b = (
src[src_x >> 3] >> (7 - (src_x & 7))) & 1;
 
  146                 dst[x >> 3] &= 0xFF7F>>j;
 
  147                 dst[x >> 3] |= 
b << (7 - j);
 
  149             if ((
mask << j) & 0x80)
 
  155         for (x = 0; x < 
width; x++) {
 
  156             int j2 = 2 * (x & 3);
 
  158             if ((dsp_mask << j) & 0x80) {
 
  159                 b = (
src[src_x >> 2] >> (6 - 2*(src_x & 3))) & 3;
 
  160                 dst[x >> 2] &= 0xFF3F>>j2;
 
  161                 dst[x >> 2] |= 
b << (6 - j2);
 
  163             if ((
mask << j) & 0x80)
 
  169         for (x = 0; x < 
width; x++) {
 
  172             if ((dsp_mask << j) & 0x80) {
 
  173                 b = (
src[src_x >> 1] >> (4 - 4*(src_x & 1))) & 15;
 
  174                 dst[x >> 1] &= 0xFF0F>>j2;
 
  175                 dst[x >> 1] |= 
b << (4 - j2);
 
  177             if ((
mask << j) & 0x80)
 
  182         bpp = bits_per_pixel >> 3;
 
  185             for (x = 0; x < 
width; x++) {
 
  187                 if ((dsp_mask << j) & 0x80) {
 
  191                 if ((
mask << j) & 0x80)
 
  202     for (
i = 0; 
i < 
w; 
i++) {
 
  203         int a, 
b, 
c, p, pa, pb, pc;
 
  216         if (pa <= pb && pa <= pc)
 
  226 #define UNROLL1(bpp, op)                                                      \ 
  235         for (; i <= size - bpp; i += bpp) {                                   \ 
  236             dst[i + 0] = r = op(r, src[i + 0], last[i + 0]);                  \ 
  239             dst[i + 1] = g = op(g, src[i + 1], last[i + 1]);                  \ 
  242             dst[i + 2] = b = op(b, src[i + 2], last[i + 2]);                  \ 
  245             dst[i + 3] = a = op(a, src[i + 3], last[i + 3]);                  \ 
  249 #define UNROLL_FILTER(op)                                                     \ 
  252     } else if (bpp == 2) {                                                    \ 
  254     } else if (bpp == 3) {                                                    \ 
  256     } else if (bpp == 4) {                                                    \ 
  259     for (; i < size; i++) {                                                   \ 
  260         dst[i] = op(dst[i - bpp], src[i], last[i]);                           \ 
  267     int i, p, 
r, 
g, 
b, 
a;
 
  269     switch (filter_type) {
 
  274         for (
i = 0; 
i < bpp; 
i++)
 
  278             for (; 
i < 
size; 
i += bpp) {
 
  279                 unsigned s = *(
int *)(
src + 
i);
 
  280                 p = ((
s & 0x7f7f7f7f) + (p & 0x7f7f7f7f)) ^ ((
s ^ p) & 0x80808080);
 
  281                 *(
int *)(dst + 
i) = p;
 
  284 #define OP_SUB(x, s, l) ((x) + (s)) 
  292         for (
i = 0; 
i < bpp; 
i++) {
 
  296 #define OP_AVG(x, s, l) (((((x) + (l)) >> 1) + (s)) & 0xff) 
  300         for (
i = 0; 
i < bpp; 
i++) {
 
  304         if (bpp > 2 && 
size > 4) {
 
  321 #define YUV2RGB(NAME, TYPE) \ 
  322 static void deloco_ ## NAME(TYPE *dst, int size, int alpha) \ 
  325     for (i = 0; i < size; i += 3 + alpha) { \ 
  326         int g = dst [i + 1]; \ 
  337     if (
s->interlace_type) {
 
  340         return 100 - 100 * 
s->y / 
s->cur_h;
 
  350     if (!
s->interlace_type) {
 
  351         ptr = dst + dst_stride * (
s->y + 
s->y_offset) + 
s->x_offset * 
s->bpp;
 
  353             last_row = 
s->last_row;
 
  355             last_row = ptr - dst_stride;
 
  358                           last_row, 
s->row_size, 
s->bpp);
 
  361             if (
s->bit_depth == 16) {
 
  362                 deloco_rgb16((uint16_t *)(ptr - dst_stride), 
s->row_size / 2,
 
  365                 deloco_rgb8(ptr - dst_stride, 
s->row_size,
 
  370         if (
s->y == 
s->cur_h) {
 
  373                 if (
s->bit_depth == 16) {
 
  374                     deloco_rgb16((uint16_t *)ptr, 
s->row_size / 2,
 
  377                     deloco_rgb8(ptr, 
s->row_size,
 
  385             ptr = dst + dst_stride * (
s->y + 
s->y_offset) + 
s->x_offset * 
s->bpp;
 
  392                                   s->last_row, 
s->pass_row_size, 
s->bpp);
 
  394                 FFSWAP(
unsigned int, 
s->last_row_size, 
s->tmp_row_size);
 
  399                                        s->color_type, 
s->last_row);
 
  402             if (
s->y == 
s->cur_h) {
 
  403                 memset(
s->last_row, 0, 
s->row_size);
 
  414                         s->crow_size = 
s->pass_row_size + 1;
 
  415                         if (
s->pass_row_size != 0)
 
  427                            uint8_t *dst, ptrdiff_t dst_stride)
 
  431     s->zstream.next_in  = 
s->gb.buffer;
 
  435     while (
s->zstream.avail_in > 0) {
 
  437         if (
ret != Z_OK && 
ret != Z_STREAM_END) {
 
  441         if (
s->zstream.avail_out == 0) {
 
  445             s->zstream.avail_out = 
s->crow_size;
 
  446             s->zstream.next_out  = 
s->crow_buf;
 
  448         if (
ret == Z_STREAM_END && 
s->zstream.avail_in > 0) {
 
  450                    "%d undecompressed bytes left in buffer\n", 
s->zstream.avail_in);
 
  467     zstream.opaque = 
NULL;
 
  468     if (inflateInit(&zstream) != Z_OK)
 
  470     zstream.next_in  = 
data;
 
  471     zstream.avail_in = data_end - 
data;
 
  474     while (zstream.avail_in > 0) {
 
  480         zstream.next_out  = buf;
 
  481         zstream.avail_out = buf_size - 1;
 
  483         if (
ret != Z_OK && 
ret != Z_STREAM_END) {
 
  487         bp->len += zstream.next_out - buf;
 
  488         if (
ret == Z_STREAM_END)
 
  491     inflateEnd(&zstream);
 
  492     bp->str[bp->len] = 0;
 
  496     inflateEnd(&zstream);
 
  506     for (
i = 0; 
i < size_in; 
i++)
 
  507         extra += 
in[
i] >= 0x80;
 
  508     if (size_in == SIZE_MAX || extra > SIZE_MAX - size_in - 1)
 
  513     for (
i = 0; 
i < size_in; 
i++) {
 
  515             *(q++) = 0xC0 | (
in[
i] >> 6);
 
  516             *(q++) = 0x80 | (
in[
i] & 0x3F);
 
  531     const uint8_t *keyword_end = memchr(keyword, 0, data_end - keyword);
 
  538     data = keyword_end + 1;
 
  541         if (
data == data_end)
 
  554         text_len = data_end - text;
 
  561     if (!(kw_utf8 && txt_utf8)) {
 
  588     s->width  = 
s->cur_w = bytestream2_get_be32(&
s->gb);
 
  589     s->height = 
s->cur_h = bytestream2_get_be32(&
s->gb);
 
  591         s->cur_w = 
s->cur_h = 
s->width = 
s->height = 0;
 
  595     s->bit_depth        = bytestream2_get_byte(&
s->gb);
 
  596     if (
s->bit_depth != 1 && 
s->bit_depth != 2 && 
s->bit_depth != 4 &&
 
  597         s->bit_depth != 8 && 
s->bit_depth != 16) {
 
  601     s->color_type       = bytestream2_get_byte(&
s->gb);
 
  602     s->compression_type = bytestream2_get_byte(&
s->gb);
 
  603     if (
s->compression_type) {
 
  607     s->filter_type      = bytestream2_get_byte(&
s->gb);
 
  608     s->interlace_type   = bytestream2_get_byte(&
s->gb);
 
  613                 "compression_type=%d filter_type=%d interlace_type=%d\n",
 
  614                 s->width, 
s->height, 
s->bit_depth, 
s->color_type,
 
  615                 s->compression_type, 
s->filter_type, 
s->interlace_type);
 
  619     s->cur_w = 
s->cur_h = 
s->width = 
s->height = 0;
 
  644     size_t byte_depth = 
s->bit_depth > 8 ? 2 : 1;
 
  657         s->bits_per_pixel = 
s->bit_depth * 
s->channels;
 
  658         s->bpp            = (
s->bits_per_pixel + 7) >> 3;
 
  659         s->row_size       = (
s->cur_w * 
s->bits_per_pixel + 7) >> 3;
 
  661         if ((
s->bit_depth == 2 || 
s->bit_depth == 4 || 
s->bit_depth == 8) &&
 
  664         } 
else if ((
s->bit_depth == 2 || 
s->bit_depth == 4 || 
s->bit_depth == 8) &&
 
  667         } 
else if ((
s->bit_depth == 2 || 
s->bit_depth == 4 || 
s->bit_depth == 8) &&
 
  670         } 
else if (
s->bit_depth == 16 &&
 
  673         } 
else if (
s->bit_depth == 16 &&
 
  676         } 
else if (
s->bit_depth == 16 &&
 
  679         } 
else if ((
s->bits_per_pixel == 1 || 
s->bits_per_pixel == 2 || 
s->bits_per_pixel == 4 || 
s->bits_per_pixel == 8) &&
 
  684         } 
else if (
s->bit_depth == 8 &&
 
  687         } 
else if (
s->bit_depth == 16 &&
 
  692                                           "Bit depth %d color type %d",
 
  693                                           s->bit_depth, 
s->color_type);
 
  717                         "and color type %d with TRNS",
 
  718                         s->bit_depth, 
s->color_type);
 
  722             s->bpp += byte_depth;
 
  736         if (!
s->interlace_type) {
 
  737             s->crow_size = 
s->row_size + 1;
 
  743             s->crow_size = 
s->pass_row_size + 1;
 
  745         ff_dlog(avctx, 
"row_size=%d crow_size =%d\n",
 
  746                 s->row_size, 
s->crow_size);
 
  750             memcpy(p->
data[1], 
s->palette, 256 * 
sizeof(uint32_t));
 
  755         if (
s->interlace_type ||
 
  767         s->crow_buf          = 
s->buffer + 15;
 
  768         s->zstream.avail_out = 
s->crow_size;
 
  769         s->zstream.next_out  = 
s->crow_buf;
 
  776         s->bpp -= byte_depth;
 
  781         s->bpp += byte_depth;
 
  796     if ((length % 3) != 0 || length > 256 * 3)
 
  800     for (
i = 0; 
i < n; 
i++) {
 
  801         r = bytestream2_get_byte(&
s->gb);
 
  802         g = bytestream2_get_byte(&
s->gb);
 
  803         b = bytestream2_get_byte(&
s->gb);
 
  804         s->palette[
i] = (0xFF
U << 24) | (
r << 16) | (
g << 8) | 
b;
 
  807         s->palette[
i] = (0xFFU << 24);
 
  830         if (length > 256 || !(
s->hdr_state & 
PNG_PLTE))
 
  833         for (
i = 0; 
i < length; 
i++) {
 
  834             unsigned v = bytestream2_get_byte(&
s->gb);
 
  835             s->palette[
i] = (
s->palette[
i] & 0x00ffffff) | (v << 24);
 
  843         for (
i = 0; 
i < length / 2; 
i++) {
 
  847             if (
s->bit_depth > 8)
 
  848                 AV_WB16(&
s->transparent_color_be[2 * 
i], v);
 
  850                 s->transparent_color_be[
i] = v;
 
  867     while ((
s->iccp_name[cnt++] = bytestream2_get_byte(&
s->gb)) && cnt < 81);
 
  874     length = 
FFMAX(length - cnt, 0);
 
  876     if (bytestream2_get_byte(&
s->gb) != 0) {
 
  882     length = 
FFMAX(length - 1, 0);
 
  891     s->iccp_data_len = bp.len;
 
  907         for (j = 0; j < 
s->height; j++) {
 
  909             for (k = 7; k >= 1; k--)
 
  910                 if ((
s->width&7) >= k)
 
  911                     pd[8*
i + k - 1] = (pd[
i]>>8-k) & 1;
 
  912             for (
i--; 
i >= 0; 
i--) {
 
  913                 pd[8*
i + 7]=  pd[
i]     & 1;
 
  914                 pd[8*
i + 6]= (pd[
i]>>1) & 1;
 
  915                 pd[8*
i + 5]= (pd[
i]>>2) & 1;
 
  916                 pd[8*
i + 4]= (pd[
i]>>3) & 1;
 
  917                 pd[8*
i + 3]= (pd[
i]>>4) & 1;
 
  918                 pd[8*
i + 2]= (pd[
i]>>5) & 1;
 
  919                 pd[8*
i + 1]= (pd[
i]>>6) & 1;
 
  920                 pd[8*
i + 0]=  pd[
i]>>7;
 
  924     } 
else if (
s->bits_per_pixel == 2) {
 
  927         for (j = 0; j < 
s->height; j++) {
 
  930                 if ((
s->width&3) >= 3) pd[4*
i + 2]= (pd[
i] >> 2) & 3;
 
  931                 if ((
s->width&3) >= 2) pd[4*
i + 1]= (pd[
i] >> 4) & 3;
 
  932                 if ((
s->width&3) >= 1) pd[4*
i + 0]=  pd[
i] >> 6;
 
  933                 for (
i--; 
i >= 0; 
i--) {
 
  934                     pd[4*
i + 3]=  pd[
i]     & 3;
 
  935                     pd[4*
i + 2]= (pd[
i]>>2) & 3;
 
  936                     pd[4*
i + 1]= (pd[
i]>>4) & 3;
 
  937                     pd[4*
i + 0]=  pd[
i]>>6;
 
  940                 if ((
s->width&3) >= 3) pd[4*
i + 2]= ((pd[
i]>>2) & 3)*0x55;
 
  941                 if ((
s->width&3) >= 2) pd[4*
i + 1]= ((pd[
i]>>4) & 3)*0x55;
 
  942                 if ((
s->width&3) >= 1) pd[4*
i + 0]= ( pd[
i]>>6     )*0x55;
 
  943                 for (
i--; 
i >= 0; 
i--) {
 
  944                     pd[4*
i + 3]= ( pd[
i]     & 3)*0x55;
 
  945                     pd[4*
i + 2]= ((pd[
i]>>2) & 3)*0x55;
 
  946                     pd[4*
i + 1]= ((pd[
i]>>4) & 3)*0x55;
 
  947                     pd[4*
i + 0]= ( pd[
i]>>6     )*0x55;
 
  952     } 
else if (
s->bits_per_pixel == 4) {
 
  955         for (j = 0; j < 
s->height; j++) {
 
  958                 if (
s->width&1) pd[2*
i+0]= pd[
i]>>4;
 
  959                 for (
i--; 
i >= 0; 
i--) {
 
  960                     pd[2*
i + 1] = pd[
i] & 15;
 
  961                     pd[2*
i + 0] = pd[
i] >> 4;
 
  964                 if (
s->width & 1) pd[2*
i + 0]= (pd[
i] >> 4) * 0x11;
 
  965                 for (
i--; 
i >= 0; 
i--) {
 
  966                     pd[2*
i + 1] = (pd[
i] & 15) * 0x11;
 
  967                     pd[2*
i + 0] = (pd[
i] >> 4) * 0x11;
 
  978     uint32_t sequence_number;
 
  979     int cur_w, cur_h, x_offset, y_offset, dispose_op, blend_op;
 
  994     s->last_w = 
s->cur_w;
 
  995     s->last_h = 
s->cur_h;
 
  996     s->last_x_offset = 
s->x_offset;
 
  997     s->last_y_offset = 
s->y_offset;
 
  998     s->last_dispose_op = 
s->dispose_op;
 
 1000     sequence_number = bytestream2_get_be32(&
s->gb);
 
 1001     cur_w           = bytestream2_get_be32(&
s->gb);
 
 1002     cur_h           = bytestream2_get_be32(&
s->gb);
 
 1003     x_offset        = bytestream2_get_be32(&
s->gb);
 
 1004     y_offset        = bytestream2_get_be32(&
s->gb);
 
 1006     dispose_op      = bytestream2_get_byte(&
s->gb);
 
 1007     blend_op        = bytestream2_get_byte(&
s->gb);
 
 1010     if (sequence_number == 0 &&
 
 1011         (cur_w != 
s->width ||
 
 1012          cur_h != 
s->height ||
 
 1015         cur_w <= 0 || cur_h <= 0 ||
 
 1016         x_offset < 0 || y_offset < 0 ||
 
 1017         cur_w > 
s->width - x_offset|| cur_h > 
s->height - y_offset)
 
 1025     if ((sequence_number == 0 || !
s->last_picture.f->data[0]) &&
 
 1046     s->x_offset   = x_offset;
 
 1047     s->y_offset   = y_offset;
 
 1048     s->dispose_op = dispose_op;
 
 1049     s->blend_op   = blend_op;
 
 1058     uint8_t *pd_last = 
s->last_picture.f->data[0];
 
 1062     for (j = 0; j < 
s->height; j++) {
 
 1063         for (
i = 0; 
i < ls; 
i++)
 
 1064             pd[
i] += pd_last[
i];
 
 1066         pd_last += 
s->last_picture.f->linesize[0];
 
 1072 #define FAST_DIV255(x) ((((x) + 128) * 257) >> 16) 
 1078     ptrdiff_t      dst_stride = p->
linesize[0];
 
 1080     ptrdiff_t      src_stride = 
s->last_picture.f->linesize[0];
 
 1099         if (!
s->background_buf)
 
 1102         memcpy(
s->background_buf, 
src, src_stride * p->
height);
 
 1104         for (y = 
s->last_y_offset; y < s->last_y_offset + 
s->last_h; y++) {
 
 1105             memset(
s->background_buf + src_stride * y +
 
 1106                    s->bpp * 
s->last_x_offset, 0, 
s->bpp * 
s->last_w);
 
 1109         src = 
s->background_buf;
 
 1113     for (y = 0; y < 
s->y_offset; y++)
 
 1114         memcpy(dst + y * dst_stride, 
src + y * src_stride, p->
width * 
s->bpp);
 
 1115     for (y = 
s->y_offset; y < s->y_offset + 
s->cur_h; y++) {
 
 1116         memcpy(dst + y * dst_stride, 
src + y * src_stride, 
s->x_offset * 
s->bpp);
 
 1117         memcpy(dst + y * dst_stride + (
s->x_offset + 
s->cur_w) * 
s->bpp,
 
 1118                src + y * src_stride + (
s->x_offset + 
s->cur_w) * 
s->bpp,
 
 1119                (p->
width - 
s->cur_w - 
s->x_offset) * 
s->bpp);
 
 1121     for (y = 
s->y_offset + 
s->cur_h; y < p->
height; y++)
 
 1122         memcpy(dst + y * dst_stride, 
src + y * src_stride, p->
width * 
s->bpp);
 
 1126         for (y = 
s->y_offset; y < s->y_offset + 
s->cur_h; ++y) {
 
 1127             uint8_t       *foreground = dst + dst_stride * y + 
s->bpp * 
s->x_offset;
 
 1128             const uint8_t *background = 
src + src_stride * y + 
s->bpp * 
s->x_offset;
 
 1129             for (x = 
s->x_offset; x < s->x_offset + 
s->cur_w; ++x, foreground += 
s->bpp, background += 
s->bpp) {
 
 1131                 uint8_t foreground_alpha, background_alpha, output_alpha;
 
 1140                     foreground_alpha = foreground[3];
 
 1141                     background_alpha = background[3];
 
 1145                     foreground_alpha = foreground[1];
 
 1146                     background_alpha = background[1];
 
 1150                     foreground_alpha = 
s->palette[foreground[0]] >> 24;
 
 1151                     background_alpha = 
s->palette[background[0]] >> 24;
 
 1155                 if (foreground_alpha == 255)
 
 1158                 if (foreground_alpha == 0) {
 
 1159                     memcpy(foreground, background, 
s->bpp);
 
 1169                 output_alpha = foreground_alpha + 
FAST_DIV255((255 - foreground_alpha) * background_alpha);
 
 1173                 for (
b = 0; 
b < 
s->bpp - 1; ++
b) {
 
 1174                     if (output_alpha == 0) {
 
 1176                     } 
else if (background_alpha == 255) {
 
 1177                         output[
b] = 
FAST_DIV255(foreground_alpha * foreground[
b] + (255 - foreground_alpha) * background[
b]);
 
 1179                         output[
b] = (255 * foreground_alpha * foreground[
b] + (255 - foreground_alpha) * background_alpha * background[
b]) / (255 * output_alpha);
 
 1183                 memcpy(foreground, 
output, 
s->bpp);
 
 1195     uint32_t 
tag, length;
 
 1196     int decode_next_dat = 0;
 
 1222         length = bytestream2_get_be32(&
s->gb);
 
 1229             uint32_t crc_sig = 
AV_RB32(
s->gb.buffer + length + 4);
 
 1230             uint32_t crc_cal = ~
av_crc(crc_tab, UINT32_MAX, 
s->gb.buffer, length + 4);
 
 1231             if (crc_sig ^ crc_cal) {
 
 1243         tag = bytestream2_get_le32(&
s->gb);
 
 1251             case MKTAG(
'I', 
'H', 
'D', 
'R'):
 
 1252             case MKTAG(
'p', 
'H', 
'Y', 
's'):
 
 1253             case MKTAG(
't', 
'E', 
'X', 
't'):
 
 1254             case MKTAG(
'I', 
'D', 
'A', 
'T'):
 
 1255             case MKTAG(
't', 
'R', 
'N', 
'S'):
 
 1263         case MKTAG(
'I', 
'H', 
'D', 
'R'):
 
 1267         case MKTAG(
'p', 
'H', 
'Y', 
's'):
 
 1271         case MKTAG(
'f', 
'c', 
'T', 
'L'):
 
 1276             decode_next_dat = 1;
 
 1278         case MKTAG(
'f', 
'd', 
'A', 
'T'):
 
 1281             if (!decode_next_dat || length < 4) {
 
 1285             bytestream2_get_be32(&
s->gb);
 
 1288         case MKTAG(
'I', 
'D', 
'A', 
'T'):
 
 1294         case MKTAG(
'P', 
'L', 
'T', 
'E'):
 
 1298         case MKTAG(
't', 
'R', 
'N', 
'S'):
 
 1302         case MKTAG(
't', 
'E', 
'X', 
't'):
 
 1307         case MKTAG(
'z', 
'T', 
'X', 
't'):
 
 1312         case MKTAG(
's', 
'T', 
'E', 
'R'): {
 
 1313             int mode = bytestream2_get_byte(&
s->gb);
 
 1316                 s->stereo_mode = 
mode;
 
 1319                         "Unknown value in sTER chunk (%d)\n", 
mode);
 
 1324         case MKTAG(
'i', 
'C', 
'C', 
'P'): {
 
 1329         case MKTAG(
'c', 
'H', 
'R', 
'M'): {
 
 1332             s->white_point[0] = bytestream2_get_be32(&
s->gb);
 
 1333             s->white_point[1] = bytestream2_get_be32(&
s->gb);
 
 1336             for (
i = 0; 
i < 3; 
i++) {
 
 1337                 s->display_primaries[
i][0] = bytestream2_get_be32(&
s->gb);
 
 1338                 s->display_primaries[
i][1] = bytestream2_get_be32(&
s->gb);
 
 1344         case MKTAG(
'g', 
'A', 
'M', 
'A'): {
 
 1347             int num = bytestream2_get_be32(&
s->gb);
 
 1360         case MKTAG(
'I', 
'E', 
'N', 
'D'):
 
 1386     if (
s->bits_per_pixel <= 4)
 
 1391         size_t byte_depth = 
s->bit_depth > 8 ? 2 : 1;
 
 1392         size_t raw_bpp = 
s->bpp - byte_depth;
 
 1397         for (y = 0; y < 
s->height; ++y) {
 
 1400             if (
s->bpp == 2 && byte_depth == 1) {
 
 1402                 uint8_t *rowp  = &row[1 * 
s->width - 1];
 
 1403                 int tcolor = 
s->transparent_color_be[0];
 
 1404                 for (x = 
s->width; x > 0; --x) {
 
 1405                     *
pixel-- = *rowp == tcolor ? 0 : 0xff;
 
 1408             } 
else if (
s->bpp == 4 && byte_depth == 1) {
 
 1410                 uint8_t *rowp  = &row[3 * 
s->width - 1];
 
 1411                 int tcolor = 
AV_RL24(
s->transparent_color_be);
 
 1412                 for (x = 
s->width; x > 0; --x) {
 
 1420                 for (x = 
s->width; x > 0; --x) {
 
 1422                     memmove(
pixel, &row[raw_bpp * (x - 1)], raw_bpp);
 
 1424                     if (!memcmp(
pixel, 
s->transparent_color_be, raw_bpp)) {
 
 1425                         memset(&
pixel[raw_bpp], 0, byte_depth);
 
 1427                         memset(&
pixel[raw_bpp], 0xff, byte_depth);
 
 1435     if (
s->last_picture.f->data[0]) {
 
 1437             && 
s->last_picture.f->width == p->
width 
 1438             && 
s->last_picture.f->height== p->
height 
 1439             && 
s->last_picture.f->format== p->
format 
 1443             else if (CONFIG_APNG_DECODER &&
 
 1461     s->iccp_data_len = 0;
 
 1462     s->iccp_name[0]  = 0;
 
 1464     s->stereo_mode = -1;
 
 1486         memcpy(sd->
data, 
s->iccp_data, 
s->iccp_data_len);
 
 1491     if (
s->stereo_mode >= 0) {
 
 1513         for (
int i = 0; 
i < 3; 
i++) {
 
 1529 #if CONFIG_PNG_DECODER 
 1531                         void *
data, 
int *got_frame,
 
 1536     int buf_size           = avpkt->
size;
 
 1547     sig = bytestream2_get_be64(&
s->gb);
 
 1554     s->y = 
s->has_trns = 0;
 
 1561     s->zstream.opaque = 
NULL;
 
 1562     ret = inflateInit(&
s->zstream);
 
 1590     inflateEnd(&
s->zstream);
 
 1596 #if CONFIG_APNG_DECODER 
 1598                         void *
data, 
int *got_frame,
 
 1622     if ((
ret = inflateInit(&
s->zstream)) != Z_OK) {
 
 1657     inflateEnd(&
s->zstream);
 
 1700     if (src_frame && src_frame->
f->
data[0]) {
 
 1719     if (!
s->last_picture.f || !
s->picture.f) {
 
 1741     s->last_row_size = 0;
 
 1743     s->tmp_row_size = 0;
 
 1752 #if CONFIG_APNG_DECODER 
 1761     .
decode         = decode_frame_apng,
 
 1769 #if CONFIG_PNG_DECODER 
 1778     .
decode         = decode_frame_png,
 
  
static void error(const char *err)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
static void clear_frame_metadata(PNGDecContext *s)
void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)
static av_cold int init(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src)
#define FFSWAP(type, a, b)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
unsigned int last_row_size
#define MKTAG(a, b, c, d)
int ff_png_get_nb_channels(int color_type)
@ APNG_DISPOSE_OP_BACKGROUND
void(* add_paeth_prediction)(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, buffer_size_t size)
Add a new side data to a frame.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
@ AVCOL_RANGE_JPEG
Full range content.
static int decode_zbuf(AVBPrint *bp, const uint8_t *data, const uint8_t *data_end)
static int output_frame(PNGDecContext *s, AVFrame *f, const AVFrame *src)
static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s, uint32_t length)
static uint8_t * iso88591_to_utf8(const uint8_t *in, size_t size_in)
unsigned int tmp_row_size
void ff_png_zfree(void *opaque, void *ptr)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before ff_thread_await_progress() has been called on them. reget_buffer() and buffer age optimizations no longer work. *The contents of buffers must not be written to after ff_thread_report_progress() has been called on them. This includes draw_edges(). Porting codecs to frame threading
#define FF_DEBUG_PICT_INFO
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define PNG_FILTER_TYPE_LOCO
static int decode_text_chunk(PNGDecContext *s, uint32_t length, int compressed)
int ff_png_pass_row_size(int pass, int bits_per_pixel, int width)
enum AVDiscard skip_frame
Skip decoding for selected frames.
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have so the codec calls ff_thread_report set FF_CODEC_CAP_ALLOCATE_PROGRESS in AVCodec caps_internal and use ff_thread_get_buffer() to allocate frames. The frames must then be freed with ff_thread_release_buffer(). Otherwise decode directly into the user-supplied frames. Call ff_thread_report_progress() after some part of the current picture has decoded. A good place to put this is where draw_horiz_band() is called - add this if it isn 't called anywhere
static av_cold int png_dec_end(AVCodecContext *avctx)
enum PNGImageState pic_state
int key_frame
1 -> keyframe, 0-> not
static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s, uint32_t length)
static const uint8_t png_pass_dsp_ymask[NB_PASSES]
#define PNG_COLOR_TYPE_RGB_ALPHA
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int skip_tag(AVIOContext *in, int32_t tag_name)
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
#define YUV2RGB(NAME, TYPE)
static const uint16_t mask[17]
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static int png_decode_idat(PNGDecContext *s, int length, uint8_t *dst, ptrdiff_t dst_stride)
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
static int decode_fctl_chunk(AVCodecContext *avctx, PNGDecContext *s, uint32_t length)
#define PNG_COLOR_TYPE_RGB
#define av_assert0(cond)
assert() equivalent, that is always enabled.
enum PNGHeaderState hdr_state
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int percent_missing(PNGDecContext *s)
@ APNG_DISPOSE_OP_PREVIOUS
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int flags
Additional information about the frame packing.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
@ AVDISCARD_ALL
discard all
@ AV_PIX_FMT_GRAY8A
alias for AV_PIX_FMT_YA8
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static av_cold int png_dec_init(AVCodecContext *avctx)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Rational number (pair of numerator and denominator).
unsigned background_buf_allocated
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_FRAME_DATA_ICC_PROFILE
The data contains an ICC profile as an opaque octet buffer following the format described by ISO 1507...
#define PNG_COLOR_TYPE_GRAY
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
#define AV_EF_EXPLODE
abort decoding on minor error detection
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
const uint8_t ff_png_pass_ymask[NB_PASSES]
static const uint8_t png_pass_mask[NB_PASSES]
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
static av_always_inline int bytestream2_tell(GetByteContext *g)
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
static void handle_small_bpp(PNGDecContext *s, AVFrame *p)
#define PNG_FILTER_VALUE_NONE
enum AVPictureType pict_type
Picture type of the frame.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s, uint32_t length, AVFrame *p)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_EF_IGNORE_ERR
ignore errors and continue
void av_bprint_get_buffer(AVBPrint *buf, unsigned size, unsigned char **mem, unsigned *actual_size)
Allocate bytes in the buffer for external use.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static void handle_p_frame_png(PNGDecContext *s, AVFrame *p)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static void png_put_interlaced_row(uint8_t *dst, int width, int bits_per_pixel, int pass, int color_type, const uint8_t *src)
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
#define PNG_FILTER_VALUE_AVG
static AVRational av_make_q(int num, int den)
Create an AVRational.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define PNG_FILTER_VALUE_PAETH
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_RL24
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
#define PNG_FILTER_VALUE_UP
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
#define AVERROR_EXTERNAL
Generic error in an external library.
int flags
A combination of AV_PKT_FLAG values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
#define FF_COMPLIANCE_NORMAL
#define FF_THREAD_FRAME
Decode more than one frame at once.
av_cold void ff_pngdsp_init(PNGDSPContext *dsp)
int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
Compute the size of an image line with format pix_fmt and width width for the plane plane.
AVDictionary * frame_metadata
static int decode_iccp_chunk(PNGDecContext *s, int length, AVFrame *f)
int interlaced_frame
The content of the picture is interlaced.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
void(* add_bytes_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)
#define PNG_FILTER_VALUE_SUB
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
uint32_t display_primaries[3][2]
static void png_handle_row(PNGDecContext *s, uint8_t *dst, ptrdiff_t dst_stride)
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
#define FF_DEBUG_STARTCODE
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
void * ff_png_zalloc(void *opaque, unsigned int items, unsigned int size)
const char * name
Name of the codec implementation.
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have update_thread_context() run it in the next thread. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. If there are inter-frame dependencies
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data,...
enum AVStereo3DType type
How views are packed within the video.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call ff_thread_finish_setup() afterwards. If some code can 't be moved
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
void ff_png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *last, int size, int bpp)
main external API structure.
int active_thread_type
Which multithreading methods are in use by the codec.
static int decode_plte_chunk(AVCodecContext *avctx, PNGDecContext *s, uint32_t length)
static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, AVFrame *p, const AVPacket *avpkt)
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
#define UNROLL_FILTER(op)
uint8_t transparent_color_be[6]
void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_padded_malloc except that buffer will always be 0-initialized after call.
static const uint8_t png_pass_dsp_mask[NB_PASSES]
int discard_damaged_percentage
The percentage of damaged samples to discard a frame.
static int decode_phys_chunk(AVCodecContext *avctx, PNGDecContext *s)
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
#define FF_CODEC_CAP_ALLOCATE_PROGRESS
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
#define avpriv_request_sample(...)
Structure to hold side data for an AVFrame.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define PNG_COLOR_TYPE_GRAY_ALPHA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s, AVFrame *p)
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
#define PNG_COLOR_TYPE_PALETTE
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
#define av_fourcc2str(fourcc)