[FFmpeg-devel] [PATCH]64bit png decoding

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Jan 11 00:22:02 CET 2012


Hi!

Attached patch allows to reencode the sample from ticket #639 to tiff on BE.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index b439329..28a26eb 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -301,7 +301,7 @@ static void png_handle_row(PNGDecContext *s)
         if (s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
             png_filter_row(s, s->tmp_row, s->crow_buf[0], s->crow_buf + 1,
                            s->last_row, s->row_size, s->bpp);
-            convert_to_rgb32(ptr, s->tmp_row, s->width, s->filter_type == PNG_FILTER_TYPE_LOCO);
+            convert_to_rgb32(ptr, s->tmp_row, s->width * s->bit_depth >> 3, s->filter_type == PNG_FILTER_TYPE_LOCO);
             FFSWAP(uint8_t*, s->last_row, s->tmp_row);
         } else {
             /* in normal case, we avoid one copy */
@@ -494,6 +494,9 @@ static int decode_frame(AVCodecContext *avctx,
                 } else if (s->bit_depth == 16 &&
                            s->color_type == PNG_COLOR_TYPE_RGB) {
                     avctx->pix_fmt = PIX_FMT_RGB48BE;
+                } else if (s->bit_depth == 16 &&
+                           s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
+                    avctx->pix_fmt = PIX_FMT_RGBA64BE;
                 } else if (s->color_type == PNG_COLOR_TYPE_PALETTE) {
                     avctx->pix_fmt = PIX_FMT_PAL8;
                 } else if (s->bit_depth == 1) {


More information about the ffmpeg-devel mailing list