pngdec.c File Reference
#include "libavutil/bprint.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "png.h"
#include "pngdsp.h"
#include <zlib.h>
Include dependency graph for pngdec.c:

Go to the source code of this file.

Data Structures

struct  PNGDecContext
 

Macros

#define UNROLL1(bpp, op)
 
#define UNROLL_FILTER(op)
 
#define OP_SUB(x, s, l)   x+s
 
#define OP_AVG(x, s, l)   (((x + l) >> 1) + s) & 0xff
 
#define YUV2RGB(NAME, TYPE)
 

Typedefs

typedef struct PNGDecContext PNGDecContext
 

Functions

static void png_put_interlaced_row (uint8_t *dst, int width, int bits_per_pixel, int pass, int color_type, const uint8_t *src)
 
void ff_add_png_paeth_prediction (uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)
 
static void png_filter_row (PNGDSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *last, int size, int bpp)
 
static void png_handle_row (PNGDecContext *s)
 
static int png_decode_idat (PNGDecContext *s, int length)
 
static int decode_zbuf (AVBPrint *bp, const uint8_t *data, const uint8_t *data_end)
 
static uint8_tiso88591_to_utf8 (const uint8_t *in, size_t size_in)
 
static int decode_text_chunk (PNGDecContext *s, uint32_t length, int compressed, AVDictionary **dict)
 
static int decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int png_dec_init (AVCodecContext *avctx)
 
static av_cold int png_dec_end (AVCodecContext *avctx)
 

Variables

static const uint8_t png_pass_mask [NB_PASSES]
 
static const uint8_t png_pass_dsp_ymask [NB_PASSES]
 
static const uint8_t png_pass_dsp_mask [NB_PASSES]
 
AVCodec ff_png_decoder
 

Macro Definition Documentation

#define OP_AVG (   x,
  s,
 
)    (((x + l) >> 1) + s) & 0xff

Referenced by png_filter_row().

#define OP_SUB (   x,
  s,
 
)    x+s

Referenced by png_filter_row().

#define UNROLL1 (   bpp,
  op 
)
Value:
{\
r = dst[0];\
if(bpp >= 2) g = dst[1];\
if(bpp >= 3) b = dst[2];\
if(bpp >= 4) a = dst[3];\
for(; i <= size - bpp; i+=bpp) {\
dst[i+0] = r = op(r, src[i+0], last[i+0]);\
if(bpp == 1) continue;\
dst[i+1] = g = op(g, src[i+1], last[i+1]);\
if(bpp == 2) continue;\
dst[i+2] = b = op(b, src[i+2], last[i+2]);\
if(bpp == 3) continue;\
dst[i+3] = a = op(a, src[i+3], last[i+3]);\
}\
}
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
#define b
Definition: input.c:42
const char * r
Definition: vf_curves.c:94
int size
FFT buffer for g
Definition: stft_peak.m:17
loc<=1||loc >=hN-1 continue()
AVS_Value src
Definition: avisynth_c.h:523
synthesis window for stochastic i
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
for(j=16;j >0;--j)

Definition at line 187 of file pngdec.c.

#define UNROLL_FILTER (   op)
Value:
if(bpp == 1) UNROLL1(1, op)\
else if(bpp == 2) UNROLL1(2, op)\
else if(bpp == 3) UNROLL1(3, op)\
else if(bpp == 4) UNROLL1(4, op)\
for (; i < size; i++) {\
dst[i] = op(dst[i-bpp], src[i], last[i]);\
}\
int size
else[Y, I2]
AVS_Value src
Definition: avisynth_c.h:523
synthesis window for stochastic i
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
#define UNROLL1(bpp, op)
Definition: pngdec.c:187
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
for(j=16;j >0;--j)

Definition at line 203 of file pngdec.c.

Referenced by png_filter_row().

#define YUV2RGB (   NAME,
  TYPE 
)
Value:
static void deloco_ ## NAME(TYPE *dst, int size, int alpha) \
{ \
int i; \
for (i = 0; i < size; i += 3 + alpha) { \
int g = dst [i+1]; \
dst[i+0] += g; \
dst[i+2] += g; \
} \
}
static double alpha(void *priv, double x, double y)
Definition: vf_geq.c:86
int size
FFT buffer for g
Definition: stft_peak.m:17
synthesis window for stochastic i
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
for(j=16;j >0;--j)

Definition at line 267 of file pngdec.c.

Typedef Documentation

typedef struct PNGDecContext PNGDecContext

Function Documentation

static int decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame,
AVPacket avpkt 
)
static

Definition at line 503 of file pngdec.c.

static int decode_text_chunk ( PNGDecContext s,
uint32_t  length,
int  compressed,
AVDictionary **  dict 
)
static

Definition at line 455 of file pngdec.c.

Referenced by decode_frame().

static int decode_zbuf ( AVBPrint bp,
const uint8_t data,
const uint8_t data_end 
)
static

Definition at line 387 of file pngdec.c.

Referenced by decode_text_chunk().

void ff_add_png_paeth_prediction ( uint8_t dst,
uint8_t src,
uint8_t top,
int  w,
int  bpp 
)

Definition at line 160 of file pngdec.c.

Referenced by ff_pngdsp_init(), and png_filter_row().

static uint8_t* iso88591_to_utf8 ( const uint8_t in,
size_t  size_in 
)
static

Definition at line 431 of file pngdec.c.

Referenced by decode_text_chunk().

static av_cold int png_dec_end ( AVCodecContext avctx)
static

Definition at line 883 of file pngdec.c.

static av_cold int png_dec_init ( AVCodecContext avctx)
static

Definition at line 868 of file pngdec.c.

static int png_decode_idat ( PNGDecContext s,
int  length 
)
static

Definition at line 362 of file pngdec.c.

Referenced by decode_frame().

static void png_filter_row ( PNGDSPContext dsp,
uint8_t dst,
int  filter_type,
uint8_t src,
uint8_t last,
int  size,
int  bpp 
)
static

Definition at line 213 of file pngdec.c.

Referenced by png_handle_row().

static void png_handle_row ( PNGDecContext s)
static

Definition at line 282 of file pngdec.c.

Referenced by png_decode_idat().

static void png_put_interlaced_row ( uint8_t dst,
int  width,
int  bits_per_pixel,
int  pass,
int  color_type,
const uint8_t src 
)
static

Definition at line 90 of file pngdec.c.

Referenced by png_handle_row().

Variable Documentation

AVCodec ff_png_decoder
Initial value:
= {
.name = "png",
.priv_data_size = sizeof(PNGDecContext),
.capabilities = CODEC_CAP_DR1 ,
.long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_cold int png_dec_init(AVCodecContext *avctx)
Definition: pngdec.c:868
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
struct PNGDecContext PNGDecContext
static av_cold int png_dec_end(AVCodecContext *avctx)
Definition: pngdec.c:883
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: pngdec.c:503

Definition at line 892 of file pngdec.c.

const uint8_t png_pass_dsp_mask[NB_PASSES]
static
Initial value:
= {
0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff
}

Definition at line 83 of file pngdec.c.

Referenced by png_put_interlaced_row().

const uint8_t png_pass_dsp_ymask[NB_PASSES]
static
Initial value:
= {
0xff, 0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
}

Definition at line 78 of file pngdec.c.

Referenced by png_handle_row().

const uint8_t png_pass_mask[NB_PASSES]
static
Initial value:
= {
0x01, 0x01, 0x11, 0x11, 0x55, 0x55, 0xff,
}

Definition at line 73 of file pngdec.c.

Referenced by png_put_interlaced_row().