Libav
Data Structures | Macros | Functions | Variables
pngenc.c File Reference
#include "libavutil/opt.h"
#include "libavutil/stereo3d.h"
#include "avcodec.h"
#include "bytestream.h"
#include "huffyuvencdsp.h"
#include "png.h"
#include <zlib.h>

Go to the source code of this file.

Data Structures

struct  PNGEncContext
 

Macros

#define IOBUF_SIZE   4096
 
#define OFFSET(x)   offsetof(PNGEncContext, x)
 
#define VE   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void png_get_interlaced_row (uint8_t *dst, int row_size, int bits_per_pixel, int pass, const uint8_t *src, int width)
 
static void sub_png_paeth_prediction (uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)
 
static void png_filter_row (PNGEncContext *c, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *top, int size, int bpp)
 
static uint8_tpng_choose_filter (PNGEncContext *s, uint8_t *dst, uint8_t *src, uint8_t *top, int size, int bpp)
 
static void convert_from_rgb32 (uint8_t *dst, const uint8_t *src, int width)
 
static void png_write_chunk (uint8_t **f, uint32_t tag, const uint8_t *buf, int length)
 
static int png_write_row (PNGEncContext *s, const uint8_t *data, int size)
 
static int encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
 
static av_cold int png_enc_init (AVCodecContext *avctx)
 

Variables

static const AVOption options []
 
static const AVClass png_class
 
AVCodec ff_png_encoder
 

Macro Definition Documentation

◆ IOBUF_SIZE

#define IOBUF_SIZE   4096

Definition at line 36 of file pngenc.c.

Referenced by encode_frame(), and png_write_row().

◆ OFFSET

#define OFFSET (   x)    offsetof(PNGEncContext, x)

Definition at line 506 of file pngenc.c.

◆ VE

Definition at line 507 of file pngenc.c.

Function Documentation

◆ png_get_interlaced_row()

static void png_get_interlaced_row ( uint8_t dst,
int  row_size,
int  bits_per_pixel,
int  pass,
const uint8_t src,
int  width 
)
static

Definition at line 52 of file pngenc.c.

Referenced by encode_frame().

◆ sub_png_paeth_prediction()

static void sub_png_paeth_prediction ( uint8_t dst,
uint8_t src,
uint8_t top,
int  w,
int  bpp 
)
static

Definition at line 90 of file pngenc.c.

Referenced by png_filter_row().

◆ png_filter_row()

static void png_filter_row ( PNGEncContext c,
uint8_t dst,
int  filter_type,
uint8_t src,
uint8_t top,
int  size,
int  bpp 
)
static

Definition at line 118 of file pngenc.c.

Referenced by png_choose_filter().

◆ png_choose_filter()

static uint8_t* png_choose_filter ( PNGEncContext s,
uint8_t dst,
uint8_t src,
uint8_t top,
int  size,
int  bpp 
)
static

Definition at line 148 of file pngenc.c.

Referenced by encode_frame().

◆ convert_from_rgb32()

static void convert_from_rgb32 ( uint8_t dst,
const uint8_t src,
int  width 
)
static

Definition at line 178 of file pngenc.c.

Referenced by encode_frame().

◆ png_write_chunk()

static void png_write_chunk ( uint8_t **  f,
uint32_t  tag,
const uint8_t buf,
int  length 
)
static

Definition at line 195 of file pngenc.c.

Referenced by encode_frame(), and png_write_row().

◆ png_write_row()

static int png_write_row ( PNGEncContext s,
const uint8_t data,
int  size 
)
static

Definition at line 215 of file pngenc.c.

Referenced by encode_frame().

◆ encode_frame()

static int encode_frame ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame pict,
int *  got_packet 
)
static

Definition at line 236 of file pngenc.c.

◆ png_enc_init()

static av_cold int png_enc_init ( AVCodecContext avctx)
static

Definition at line 478 of file pngenc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "pred", "Prediction method", OFFSET(filter_type), AV_OPT_TYPE_INT, { .i64 = PNG_FILTER_VALUE_NONE }, PNG_FILTER_VALUE_NONE, PNG_FILTER_VALUE_MIXED, VE, "pred" },
{ "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PNG_FILTER_VALUE_NONE }, INT_MIN, INT_MAX, VE, "pred" },
{ "sub", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PNG_FILTER_VALUE_SUB }, INT_MIN, INT_MAX, VE, "pred" },
{ "up", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PNG_FILTER_VALUE_UP }, INT_MIN, INT_MAX, VE, "pred" },
{ "avg", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PNG_FILTER_VALUE_AVG }, INT_MIN, INT_MAX, VE, "pred" },
{ "paeth", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PNG_FILTER_VALUE_PAETH }, INT_MIN, INT_MAX, VE, "pred" },
{ "mixed", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = PNG_FILTER_VALUE_MIXED }, INT_MIN, INT_MAX, VE, "pred" },
{ NULL},
}
#define PNG_FILTER_VALUE_AVG
Definition: png.h:41
#define OFFSET(x)
Definition: pngenc.c:506
#define PNG_FILTER_VALUE_PAETH
Definition: png.h:42
#define PNG_FILTER_VALUE_MIXED
Definition: png.h:43
#define PNG_FILTER_VALUE_SUB
Definition: png.h:39
NULL
Definition: eval.c:55
#define PNG_FILTER_VALUE_UP
Definition: png.h:40
#define VE
Definition: pngenc.c:507
#define PNG_FILTER_VALUE_NONE
Definition: png.h:38

Definition at line 508 of file pngenc.c.

◆ png_class

const AVClass png_class
static
Initial value:
= {
.class_name = "png",
.item_name = av_default_item_name,
.option = options,
}
static const AVOption options[]
Definition: pngenc.c:508
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
av_default_item_name
Definition: dnxhdenc.c:55

Definition at line 520 of file pngenc.c.

◆ ff_png_encoder

AVCodec ff_png_encoder
Initial value:
= {
.name = "png",
.long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
.priv_data_size = sizeof(PNGEncContext),
.priv_class = &png_class,
.encode2 = encode_frame,
.pix_fmts = (const enum AVPixelFormat[]) {
},
}
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:61
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
Definition: pngenc.c:236
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:70
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:196
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:148
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:242
Y , 16bpp, big-endian.
Definition: pixfmt.h:94
static av_cold int png_enc_init(AVCodecContext *avctx)
Definition: pngenc.c:478
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:257
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
Definition: pixfmt.h:69
Y , 8bpp.
Definition: pixfmt.h:67
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:106
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:582
static const AVClass png_class
Definition: pngenc.c:520
AVPixelFormat
Pixel format.
Definition: pixfmt.h:57

Definition at line 526 of file pngenc.c.