pngenc.c
Go to the documentation of this file.
1 /*
2  * PNG image format
3  * Copyright (c) 2003 Fabrice Bellard
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #include "avcodec.h"
22 #include "internal.h"
23 #include "bytestream.h"
24 #include "dsputil.h"
25 #include "png.h"
26 
27 #include "libavutil/avassert.h"
28 
29 /* TODO:
30  * - add 2, 4 and 16 bit depth support
31  */
32 
33 #include <zlib.h>
34 
35 //#define DEBUG
36 
37 #define IOBUF_SIZE 4096
38 
39 typedef struct PNGEncContext {
41 
46 
48 
49  z_stream zstream;
52 
54  int bits_per_pixel, int pass,
55  const uint8_t *src, int width)
56 {
57  int x, mask, dst_x, j, b, bpp;
58  uint8_t *d;
59  const uint8_t *s;
60  static const int masks[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
61 
62  mask = masks[pass];
63  switch(bits_per_pixel) {
64  case 1:
65  memset(dst, 0, row_size);
66  dst_x = 0;
67  for(x = 0; x < width; x++) {
68  j = (x & 7);
69  if ((mask << j) & 0x80) {
70  b = (src[x >> 3] >> (7 - j)) & 1;
71  dst[dst_x >> 3] |= b << (7 - (dst_x & 7));
72  dst_x++;
73  }
74  }
75  break;
76  default:
77  bpp = bits_per_pixel >> 3;
78  d = dst;
79  s = src;
80  for(x = 0; x < width; x++) {
81  j = x & 7;
82  if ((mask << j) & 0x80) {
83  memcpy(d, s, bpp);
84  d += bpp;
85  }
86  s += bpp;
87  }
88  break;
89  }
90 }
91 
92 static void sub_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)
93 {
94  int i;
95  for(i = 0; i < w; i++) {
96  int a, b, c, p, pa, pb, pc;
97 
98  a = src[i - bpp];
99  b = top[i];
100  c = top[i - bpp];
101 
102  p = b - c;
103  pc = a - c;
104 
105  pa = abs(p);
106  pb = abs(pc);
107  pc = abs(p + pc);
108 
109  if (pa <= pb && pa <= pc)
110  p = a;
111  else if (pb <= pc)
112  p = b;
113  else
114  p = c;
115  dst[i] = src[i] - p;
116  }
117 }
118 
120  uint8_t *src, uint8_t *top, int size, int bpp)
121 {
122  int i;
123 
124  switch(filter_type) {
126  memcpy(dst, src, size);
127  break;
129  dsp->diff_bytes(dst, src, src-bpp, size);
130  memcpy(dst, src, bpp);
131  break;
132  case PNG_FILTER_VALUE_UP:
133  dsp->diff_bytes(dst, src, top, size);
134  break;
136  for(i = 0; i < bpp; i++)
137  dst[i] = src[i] - (top[i] >> 1);
138  for(; i < size; i++)
139  dst[i] = src[i] - ((src[i-bpp] + top[i]) >> 1);
140  break;
142  for(i = 0; i < bpp; i++)
143  dst[i] = src[i] - top[i];
144  sub_png_paeth_prediction(dst+i, src+i, top+i, size-i, bpp);
145  break;
146  }
147 }
148 
150  uint8_t *src, uint8_t *top, int size, int bpp)
151 {
152  int pred = s->filter_type;
153  av_assert0(bpp || !pred);
154  if(!top && pred)
155  pred = PNG_FILTER_VALUE_SUB;
156  if(pred == PNG_FILTER_VALUE_MIXED) {
157  int i;
158  int cost, bcost = INT_MAX;
159  uint8_t *buf1 = dst, *buf2 = dst + size + 16;
160  for(pred=0; pred<5; pred++) {
161  png_filter_row(&s->dsp, buf1+1, pred, src, top, size, bpp);
162  buf1[0] = pred;
163  cost = 0;
164  for(i=0; i<=size; i++)
165  cost += abs((int8_t)buf1[i]);
166  if(cost < bcost) {
167  bcost = cost;
168  FFSWAP(uint8_t*, buf1, buf2);
169  }
170  }
171  return buf2;
172  } else {
173  png_filter_row(&s->dsp, dst+1, pred, src, top, size, bpp);
174  dst[0] = pred;
175  return dst;
176  }
177 }
178 
179 static void png_write_chunk(uint8_t **f, uint32_t tag,
180  const uint8_t *buf, int length)
181 {
182  uint32_t crc;
183  uint8_t tagbuf[4];
184 
185  bytestream_put_be32(f, length);
186  crc = crc32(0, Z_NULL, 0);
187  AV_WL32(tagbuf, tag);
188  crc = crc32(crc, tagbuf, 4);
189  bytestream_put_be32(f, av_bswap32(tag));
190  if (length > 0) {
191  crc = crc32(crc, buf, length);
192  memcpy(*f, buf, length);
193  *f += length;
194  }
195  bytestream_put_be32(f, crc);
196 }
197 
198 /* XXX: do filtering */
199 static int png_write_row(PNGEncContext *s, const uint8_t *data, int size)
200 {
201  int ret;
202 
203  s->zstream.avail_in = size;
204  s->zstream.next_in = (uint8_t *)data;
205  while (s->zstream.avail_in > 0) {
206  ret = deflate(&s->zstream, Z_NO_FLUSH);
207  if (ret != Z_OK)
208  return -1;
209  if (s->zstream.avail_out == 0) {
210  if(s->bytestream_end - s->bytestream > IOBUF_SIZE + 100)
211  png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, IOBUF_SIZE);
212  s->zstream.avail_out = IOBUF_SIZE;
213  s->zstream.next_out = s->buf;
214  }
215  }
216  return 0;
217 }
218 
220  const AVFrame *pict, int *got_packet)
221 {
222  PNGEncContext *s = avctx->priv_data;
223  AVFrame * const p= &s->picture;
224  int bit_depth, color_type, y, len, row_size, ret, is_progressive;
225  int bits_per_pixel, pass_row_size, enc_row_size;
226  int64_t max_packet_size;
227  int compression_level;
228  uint8_t *ptr, *top;
229  uint8_t *crow_base = NULL, *crow_buf, *crow;
230  uint8_t *progressive_buf = NULL;
231  uint8_t *top_buf = NULL;
232 
233  *p = *pict;
235  p->key_frame= 1;
236 
237  is_progressive = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
238  switch(avctx->pix_fmt) {
239  case AV_PIX_FMT_RGBA64BE:
240  bit_depth = 16;
241  color_type = PNG_COLOR_TYPE_RGB_ALPHA;
242  break;
243  case AV_PIX_FMT_RGB48BE:
244  bit_depth = 16;
245  color_type = PNG_COLOR_TYPE_RGB;
246  break;
247  case AV_PIX_FMT_RGBA:
248  bit_depth = 8;
249  color_type = PNG_COLOR_TYPE_RGB_ALPHA;
250  break;
251  case AV_PIX_FMT_RGB24:
252  bit_depth = 8;
253  color_type = PNG_COLOR_TYPE_RGB;
254  break;
255  case AV_PIX_FMT_GRAY16BE:
256  bit_depth = 16;
257  color_type = PNG_COLOR_TYPE_GRAY;
258  break;
259  case AV_PIX_FMT_GRAY8:
260  bit_depth = 8;
261  color_type = PNG_COLOR_TYPE_GRAY;
262  break;
263  case AV_PIX_FMT_GRAY8A:
264  bit_depth = 8;
265  color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
266  break;
268  bit_depth = 1;
269  color_type = PNG_COLOR_TYPE_GRAY;
270  break;
271  case AV_PIX_FMT_PAL8:
272  bit_depth = 8;
273  color_type = PNG_COLOR_TYPE_PALETTE;
274  break;
275  default:
276  return -1;
277  }
278  bits_per_pixel = ff_png_get_nb_channels(color_type) * bit_depth;
279  row_size = (avctx->width * bits_per_pixel + 7) >> 3;
280 
281  s->zstream.zalloc = ff_png_zalloc;
282  s->zstream.zfree = ff_png_zfree;
283  s->zstream.opaque = NULL;
284  compression_level = avctx->compression_level == FF_COMPRESSION_DEFAULT ?
285  Z_DEFAULT_COMPRESSION :
286  av_clip(avctx->compression_level, 0, 9);
287  ret = deflateInit2(&s->zstream, compression_level,
288  Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY);
289  if (ret != Z_OK)
290  return -1;
291 
292  enc_row_size = deflateBound(&s->zstream, row_size);
293  max_packet_size = avctx->height * (int64_t)(enc_row_size +
294  ((enc_row_size + IOBUF_SIZE - 1) / IOBUF_SIZE) * 12)
296  if (max_packet_size > INT_MAX)
297  return AVERROR(ENOMEM);
298  if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) < 0)
299  return ret;
300 
301  s->bytestream_start =
302  s->bytestream = pkt->data;
303  s->bytestream_end = pkt->data + pkt->size;
304 
305  crow_base = av_malloc((row_size + 32) << (s->filter_type == PNG_FILTER_VALUE_MIXED));
306  if (!crow_base)
307  goto fail;
308  crow_buf = crow_base + 15; // pixel data should be aligned, but there's a control byte before it
309  if (is_progressive) {
310  progressive_buf = av_malloc(row_size + 1);
311  if (!progressive_buf)
312  goto fail;
313  }
314  if (is_progressive) {
315  top_buf = av_malloc(row_size + 1);
316  if (!top_buf)
317  goto fail;
318  }
319 
320  /* write png header */
322  s->bytestream += 8;
323 
324  AV_WB32(s->buf, avctx->width);
325  AV_WB32(s->buf + 4, avctx->height);
326  s->buf[8] = bit_depth;
327  s->buf[9] = color_type;
328  s->buf[10] = 0; /* compression type */
329  s->buf[11] = 0; /* filter type */
330  s->buf[12] = is_progressive; /* interlace type */
331 
332  png_write_chunk(&s->bytestream, MKTAG('I', 'H', 'D', 'R'), s->buf, 13);
333 
334  AV_WB32(s->buf, avctx->sample_aspect_ratio.num);
335  AV_WB32(s->buf + 4, avctx->sample_aspect_ratio.den);
336  s->buf[8] = 0; /* unit specifier is unknown */
337  png_write_chunk(&s->bytestream, MKTAG('p', 'H', 'Y', 's'), s->buf, 9);
338 
339  /* put the palette if needed */
340  if (color_type == PNG_COLOR_TYPE_PALETTE) {
341  int has_alpha, alpha, i;
342  unsigned int v;
343  uint32_t *palette;
344  uint8_t *alpha_ptr;
345 
346  palette = (uint32_t *)p->data[1];
347  ptr = s->buf;
348  alpha_ptr = s->buf + 256 * 3;
349  has_alpha = 0;
350  for(i = 0; i < 256; i++) {
351  v = palette[i];
352  alpha = v >> 24;
353  if (alpha != 0xff)
354  has_alpha = 1;
355  *alpha_ptr++ = alpha;
356  bytestream_put_be24(&ptr, v);
357  }
358  png_write_chunk(&s->bytestream, MKTAG('P', 'L', 'T', 'E'), s->buf, 256 * 3);
359  if (has_alpha) {
360  png_write_chunk(&s->bytestream, MKTAG('t', 'R', 'N', 'S'), s->buf + 256 * 3, 256);
361  }
362  }
363 
364  /* now put each row */
365  s->zstream.avail_out = IOBUF_SIZE;
366  s->zstream.next_out = s->buf;
367  if (is_progressive) {
368  int pass;
369 
370  for(pass = 0; pass < NB_PASSES; pass++) {
371  /* NOTE: a pass is completely omitted if no pixels would be
372  output */
373  pass_row_size = ff_png_pass_row_size(pass, bits_per_pixel, avctx->width);
374  if (pass_row_size > 0) {
375  top = NULL;
376  for(y = 0; y < avctx->height; y++) {
377  if ((ff_png_pass_ymask[pass] << (y & 7)) & 0x80) {
378  ptr = p->data[0] + y * p->linesize[0];
379  FFSWAP(uint8_t*, progressive_buf, top_buf);
380  png_get_interlaced_row(progressive_buf, pass_row_size,
381  bits_per_pixel, pass,
382  ptr, avctx->width);
383  crow = png_choose_filter(s, crow_buf, progressive_buf, top, pass_row_size, bits_per_pixel>>3);
384  png_write_row(s, crow, pass_row_size + 1);
385  top = progressive_buf;
386  }
387  }
388  }
389  }
390  } else {
391  top = NULL;
392  for(y = 0; y < avctx->height; y++) {
393  ptr = p->data[0] + y * p->linesize[0];
394  crow = png_choose_filter(s, crow_buf, ptr, top, row_size, bits_per_pixel>>3);
395  png_write_row(s, crow, row_size + 1);
396  top = ptr;
397  }
398  }
399  /* compress last bytes */
400  for(;;) {
401  ret = deflate(&s->zstream, Z_FINISH);
402  if (ret == Z_OK || ret == Z_STREAM_END) {
403  len = IOBUF_SIZE - s->zstream.avail_out;
404  if (len > 0 && s->bytestream_end - s->bytestream > len + 100) {
405  png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, len);
406  }
407  s->zstream.avail_out = IOBUF_SIZE;
408  s->zstream.next_out = s->buf;
409  if (ret == Z_STREAM_END)
410  break;
411  } else {
412  goto fail;
413  }
414  }
415  png_write_chunk(&s->bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0);
416 
417  pkt->size = s->bytestream - s->bytestream_start;
418  pkt->flags |= AV_PKT_FLAG_KEY;
419  *got_packet = 1;
420  ret = 0;
421 
422  the_end:
423  av_free(crow_base);
424  av_free(progressive_buf);
425  av_free(top_buf);
426  deflateEnd(&s->zstream);
427  return ret;
428  fail:
429  ret = -1;
430  goto the_end;
431 }
432 
434  PNGEncContext *s = avctx->priv_data;
435 
436  switch(avctx->pix_fmt) {
437  case AV_PIX_FMT_RGBA:
438  avctx->bits_per_coded_sample = 32;
439  break;
440  case AV_PIX_FMT_RGB24:
441  avctx->bits_per_coded_sample = 24;
442  break;
443  case AV_PIX_FMT_GRAY8:
444  avctx->bits_per_coded_sample = 0x28;
445  break;
447  avctx->bits_per_coded_sample = 1;
448  break;
449  case AV_PIX_FMT_PAL8:
450  avctx->bits_per_coded_sample = 8;
451  }
452 
454  avctx->coded_frame= &s->picture;
455  ff_dsputil_init(&s->dsp, avctx);
456 
458  if(avctx->pix_fmt == AV_PIX_FMT_MONOBLACK)
460 
461  return 0;
462 }
463 
465  .name = "png",
466  .type = AVMEDIA_TYPE_VIDEO,
467  .id = AV_CODEC_ID_PNG,
468  .priv_data_size = sizeof(PNGEncContext),
469  .init = png_enc_init,
470  .encode2 = encode_frame,
472  .pix_fmts = (const enum AVPixelFormat[]){
479  },
480  .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
481 };
#define PNG_FILTER_VALUE_AVG
Definition: png.h:41
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
Definition: dsputil.c:2675
float v
const char * s
Definition: avisynth_c.h:668
#define FF_COMPRESSION_DEFAULT
This structure describes decoded (raw) audio or video data.
Definition: frame.h:76
BYTE int const BYTE int int row_size
Definition: avisynth_c.h:713
struct PNGEncContext PNGEncContext
static uint8_t * png_choose_filter(PNGEncContext *s, uint8_t *dst, uint8_t *src, uint8_t *top, int size, int bpp)
Definition: pngenc.c:149
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:70
AVFrame * coded_frame
the picture in the bitstream
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
uint8_t * bytestream
Definition: pngenc.c:42
int num
numerator
Definition: rational.h:44
Sinusoidal phase f
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
Definition: pngenc.c:219
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 pass
Definition: fft.c:335
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define PNG_COLOR_TYPE_RGB
Definition: png.h:33
#define PNG_COLOR_TYPE_GRAY_ALPHA
Definition: png.h:35
#define PNG_COLOR_TYPE_PALETTE
Definition: png.h:32
AVFrame picture
Definition: pngenc.c:45
output residual component w
int filter_type
Definition: pngenc.c:47
set threshold d
#define PNG_FILTER_VALUE_PAETH
Definition: png.h:42
#define AV_WB32(p, darg)
Definition: intreadwrite.h:265
#define AV_WL32(p, darg)
Definition: intreadwrite.h:282
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
uint8_t
#define av_cold
Definition: attributes.h:78
#define PNG_COLOR_TYPE_RGB_ALPHA
Definition: png.h:34
8 bit with PIX_FMT_RGB32 palette
Definition: pixfmt.h:79
#define CODEC_CAP_INTRA_ONLY
Codec is intra only.
static void sub_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)
Definition: pngenc.c:92
static AVPacket pkt
Definition: demuxing.c:56
#define b
Definition: input.c:42
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:209
uint8_t * data
uint32_t tag
Definition: movenc.c:894
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
#define PNG_FILTER_VALUE_MIXED
Definition: png.h:43
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Discrete Time axis x
static double alpha(void *priv, double x, double y)
Definition: vf_geq.c:86
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:183
static void png_get_interlaced_row(uint8_t *dst, int row_size, int bits_per_pixel, int pass, const uint8_t *src, int width)
Definition: pngenc.c:53
static const uint16_t mask[17]
Definition: lzw.c:37
z_stream zstream
Definition: pngenc.c:49
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Spectrum Plot time data
int ff_png_get_nb_channels(int color_type)
Definition: png.c:49
int flags
CODEC_FLAG_*.
#define PNGSIG
Definition: png.h:52
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
external API header
#define NB_PASSES
Definition: png.h:50
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:97
int size
int flags
A combination of AV_PKT_FLAG values.
uint8_t * bytestream_start
Definition: pngenc.c:43
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:144
8bit gray, 8bit alpha
Definition: pixfmt.h:141
#define PNG_FILTER_VALUE_SUB
Definition: png.h:39
#define FF_MIN_BUFFER_SIZE
minimum encoding buffer size Used to avoid some checks during header writing.
static void png_write_chunk(uint8_t **f, uint32_t tag, const uint8_t *buf, int length)
Definition: pngenc.c:179
#define PNG_COLOR_TYPE_GRAY
Definition: png.h:31
ret
Definition: avfilter.c:821
int width
picture width / height.
#define CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
void(* diff_bytes)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w)
Definition: dsputil.h:198
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
static const float pred[4]
Definition: siprdata.h:259
NULL
Definition: eval.c:55
#define IOBUF_SIZE
Definition: pngenc.c:37
static int width
Definition: tests/utils.c:158
#define av_bswap32
Definition: bfin/bswap.h:33
AVCodec ff_png_encoder
Definition: pngenc.c:464
AVS_Value src
Definition: avisynth_c.h:523
#define PNG_FILTER_VALUE_UP
Definition: png.h:40
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:101
main external API structure.
const uint8_t ff_png_pass_ymask[NB_PASSES]
Definition: png.c:25
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:73
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
Y , 16bpp, big-endian.
Definition: pixfmt.h:101
synthesis window for stochastic i
static av_cold int png_enc_init(AVCodecContext *avctx)
Definition: pngenc.c:433
uint8_t * bytestream_end
Definition: pngenc.c:44
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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.Buffer references ownership and permissions
#define AV_WB64(p, darg)
Definition: intreadwrite.h:303
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:87
uint8_t buf[IOBUF_SIZE]
Definition: pngenc.c:50
int palette
Definition: v4l.c:61
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
Definition: pixfmt.h:78
Y , 8bpp.
Definition: pixfmt.h:76
common internal api header.
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define PNG_FILTER_VALUE_NONE
Definition: png.h:38
static double c[64]
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:111
int prediction_method
prediction method (needed for huffyuv)
int den
denominator
Definition: rational.h:45
function y
Definition: D.m:1
void ff_png_zfree(void *opaque, void *ptr)
Definition: png.c:44
DSP utils.
static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *top, int size, int bpp)
Definition: pngenc.c:119
int len
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:139
static int png_write_row(PNGEncContext *s, const uint8_t *data, int size)
Definition: pngenc.c:199
int ff_png_pass_row_size(int pass, int bits_per_pixel, int width)
Definition: png.c:62
#define FFSWAP(type, a, b)
Definition: common.h:61
const char int length
Definition: avisynth_c.h:668
DSPContext dsp
Definition: pngenc.c:40
#define MKTAG(a, b, c, d)
Definition: common.h:282
void * ff_png_zalloc(void *opaque, unsigned int items, unsigned int size)
Definition: png.c:39
AVPixelFormat
Pixel format.
Definition: pixfmt.h:66
This structure stores compressed data.
DSPContext.
Definition: dsputil.h:127