diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-07-28 21:42:47 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-07-28 21:45:37 +0000 |
commit | 768e40b451a459fefaceed6b1b3d6e70c93596ac (patch) | |
tree | 9f9c740798a1e055ff0e7b95b2237b017127548e | |
parent | ac8e70d7358ed6d319b5eac21cbeea223ed9d1c9 (diff) | |
download | ffmpeg-768e40b451a459fefaceed6b1b3d6e70c93596ac.tar.gz |
Revert "pnm: remove nonsense code"
Breaks decoding pgms with 256 < maxval < 65535.
Found-by: Carl Eugen Hoyos <cehoyos@ag.or.at>.
This reverts commit a0348d0966a81a66f3a1bf061576b24d5296b933.
-rw-r--r-- | libavcodec/pnm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c index 6e2e96c403..5a24befa36 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) { |