[FFmpeg-cvslog] Revert "pnm: remove nonsense code"

Paul B Mahol git at videolan.org
Sun Jul 28 23:45:47 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Jul 28 21:42:47 2013 +0000| [768e40b451a459fefaceed6b1b3d6e70c93596ac] | committer: Paul B Mahol

Revert "pnm: remove nonsense code"

Breaks decoding pgms with 256 < maxval < 65535.

Found-by: Carl Eugen Hoyos <cehoyos at ag.or.at>.

This reverts commit a0348d0966a81a66f3a1bf061576b24d5296b933.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=768e40b451a459fefaceed6b1b3d6e70c93596ac
---

 libavcodec/pnm.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 6e2e96c..5a24bef 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -163,6 +163,8 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
         if (s->maxval >= 256) {
             if (avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
                 avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
+                if (s->maxval != 65535)
+                    avctx->pix_fmt = AV_PIX_FMT_GRAY16;
             } else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) {
                 avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
             } else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && s->maxval < 65536) {



More information about the ffmpeg-cvslog mailing list