comparison pngdec.c @ 9895:06e12f9b93d7 libavcodec

Support RGB48 PNG decoding
author kostya
date Tue, 30 Jun 2009 03:37:20 +0000
parents 3768b0da80b8
children c78fd9154378
comparison
equal deleted inserted replaced
9894:78b2fc137c27 9895:06e12f9b93d7
179 #define UNROLL_FILTER(op)\ 179 #define UNROLL_FILTER(op)\
180 if(bpp == 1) UNROLL1(1, op)\ 180 if(bpp == 1) UNROLL1(1, op)\
181 else if(bpp == 2) UNROLL1(2, op)\ 181 else if(bpp == 2) UNROLL1(2, op)\
182 else if(bpp == 3) UNROLL1(3, op)\ 182 else if(bpp == 3) UNROLL1(3, op)\
183 else if(bpp == 4) UNROLL1(4, op)\ 183 else if(bpp == 4) UNROLL1(4, op)\
184 else {\
185 for (; i < size; i += bpp) {\
186 int j;\
187 for (j = 0; j < bpp; j++)\
188 dst[i+j] = op(dst[i+j-bpp], src[i+j], last[i+j]);\
189 }\
190 }
184 191
185 /* NOTE: 'dst' can be equal to 'last' */ 192 /* NOTE: 'dst' can be equal to 'last' */
186 static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type, 193 static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type,
187 uint8_t *src, uint8_t *last, int size, int bpp) 194 uint8_t *src, uint8_t *last, int size, int bpp)
188 { 195 {
476 s->color_type == PNG_COLOR_TYPE_GRAY) { 483 s->color_type == PNG_COLOR_TYPE_GRAY) {
477 avctx->pix_fmt = PIX_FMT_GRAY8; 484 avctx->pix_fmt = PIX_FMT_GRAY8;
478 } else if (s->bit_depth == 16 && 485 } else if (s->bit_depth == 16 &&
479 s->color_type == PNG_COLOR_TYPE_GRAY) { 486 s->color_type == PNG_COLOR_TYPE_GRAY) {
480 avctx->pix_fmt = PIX_FMT_GRAY16BE; 487 avctx->pix_fmt = PIX_FMT_GRAY16BE;
488 } else if (s->bit_depth == 16 &&
489 s->color_type == PNG_COLOR_TYPE_RGB) {
490 avctx->pix_fmt = PIX_FMT_RGB48BE;
481 } else if (s->bit_depth == 1 && 491 } else if (s->bit_depth == 1 &&
482 s->color_type == PNG_COLOR_TYPE_GRAY) { 492 s->color_type == PNG_COLOR_TYPE_GRAY) {
483 avctx->pix_fmt = PIX_FMT_MONOBLACK; 493 avctx->pix_fmt = PIX_FMT_MONOBLACK;
484 } else if (s->color_type == PNG_COLOR_TYPE_PALETTE) { 494 } else if (s->color_type == PNG_COLOR_TYPE_PALETTE) {
485 avctx->pix_fmt = PIX_FMT_PAL8; 495 avctx->pix_fmt = PIX_FMT_PAL8;