FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
pngenc.c File Reference
#include "avcodec.h"
#include "internal.h"
#include "bytestream.h"
#include "huffyuvencdsp.h"
#include "png.h"
#include "libavutil/avassert.h"
#include "libavutil/libm.h"
#include "libavutil/opt.h"
#include "libavutil/color_utils.h"
#include <zlib.h>

Go to the source code of this file.

Data Structures

struct  PNGEncContext
 

Macros

#define IOBUF_SIZE   4096
 
#define AV_WB32_PNG(buf, n)   AV_WB32(buf, lrint((n) * 100000))
 
#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 sub_left_prediction (PNGEncContext *c, uint8_t *dst, const uint8_t *src, int bpp, int size)
 
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 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 png_get_chrm (enum AVColorPrimaries prim, uint8_t *buf)
 
static int png_get_gama (enum AVColorTransferCharacteristic trc, uint8_t *buf)
 
static int encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
 
static av_cold int png_enc_init (AVCodecContext *avctx)
 
static av_cold int png_enc_close (AVCodecContext *avctx)
 

Variables

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

Macro Definition Documentation

#define IOBUF_SIZE   4096

Definition at line 35 of file pngenc.c.

Referenced by encode_frame(), and png_write_row().

#define AV_WB32_PNG (   buf,
  n 
)    AV_WB32(buf, lrint((n) * 100000))

Definition at line 236 of file pngenc.c.

Referenced by png_get_chrm(), and png_get_gama().

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

Definition at line 577 of file pngenc.c.

Definition at line 578 of file pngenc.c.

Function Documentation

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 53 of file pngenc.c.

Referenced by encode_frame().

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

Definition at line 92 of file pngenc.c.

Referenced by png_filter_row().

static void sub_left_prediction ( PNGEncContext c,
uint8_t dst,
const uint8_t src,
int  bpp,
int  size 
)
static

Definition at line 120 of file pngenc.c.

Referenced by 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 136 of file pngenc.c.

Referenced by 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 165 of file pngenc.c.

Referenced by encode_frame().

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().

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().

static int png_get_chrm ( enum AVColorPrimaries  prim,
uint8_t buf 
)
static

Definition at line 237 of file pngenc.c.

Referenced by encode_frame().

static int png_get_gama ( enum AVColorTransferCharacteristic  trc,
uint8_t buf 
)
static

Definition at line 279 of file pngenc.c.

Referenced by encode_frame().

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

Definition at line 289 of file pngenc.c.

static av_cold int png_enc_init ( AVCodecContext avctx)
static

Definition at line 525 of file pngenc.c.

static av_cold int png_enc_close ( AVCodecContext avctx)
static

Definition at line 571 of file pngenc.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{"dpi", "Set image resolution (in dots per inch)", OFFSET(dpi), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 0x10000, VE},
{"dpm", "Set image resolution (in dots per meter)", OFFSET(dpm), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 0x10000, VE},
{ NULL }
}

Definition at line 579 of file pngenc.c.

const AVClass pngenc_class
static
Initial value:
= {
.class_name = "PNG encoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 585 of file pngenc.c.

AVCodec ff_png_encoder
Initial value:
= {
.name = "png",
.long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
.priv_data_size = sizeof(PNGEncContext),
.close = png_enc_close,
.encode2 = encode_frame,
.pix_fmts = (const enum AVPixelFormat[]) {
},
.priv_class = &pngenc_class,
}

Definition at line 592 of file pngenc.c.