libavcodec/pngdec.c File Reference

#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "png.h"
#include "pngdsp.h"
#include <zlib.h>

Go to the source code of this file.

Data Structures

struct  PNGDecContext

Defines

#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)

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_frame (AVCodecContext *avctx, void *data, int *data_size, 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


Define Documentation

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

#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; 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]);\
    }\
}

Definition at line 184 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)\
    else {\
        for (; i < size; i += bpp) {\
            int j;\
            for (j = 0; j < bpp; j++)\
                dst[i+j] = op(dst[i+j-bpp], src[i+j], last[i+j]);\
        }\
    }

Definition at line 200 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; \
    } \
}

Definition at line 268 of file pngdec.c.

Referenced by yuv420_bgr24_TMPL(), yuv420_bgr32_TMPL(), yuv420_rgb15_TMPL(), yuv420_rgb16_TMPL(), yuv420_rgb24_TMPL(), and yuv420_rgb32_TMPL().


Function Documentation

static int decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
AVPacket avpkt 
) [static]

Definition at line 387 of file pngdec.c.

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

Definition at line 157 of file pngdec.c.

Referenced by ff_pngdsp_init(), and png_filter_row().

static av_cold int png_dec_end ( AVCodecContext avctx  )  [static]

Definition at line 727 of file pngdec.c.

static av_cold int png_dec_init ( AVCodecContext avctx  )  [static]

Definition at line 713 of file pngdec.c.

static int png_decode_idat ( PNGDecContext s,
int  length 
) [static]

Definition at line 363 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 214 of file pngdec.c.

Referenced by png_choose_filter(), and png_handle_row().

static void png_handle_row ( PNGDecContext s  )  [static]

Definition at line 283 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 88 of file pngdec.c.

Referenced by png_handle_row().


Variable Documentation

Initial value:

 {
    .name           = "png",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_PNG,
    .priv_data_size = sizeof(PNGDecContext),
    .init           = png_dec_init,
    .close          = png_dec_end,
    .decode         = decode_frame,
    .capabilities   = CODEC_CAP_DR1 ,
    .long_name      = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"),
}

Definition at line 739 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 81 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 76 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 71 of file pngdec.c.

Referenced by png_put_interlaced_row().


Generated on Fri Oct 26 02:47:58 2012 for FFmpeg by  doxygen 1.5.8