aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-07-29 00:00:42 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-07-29 00:02:59 +0200
commit9f2d73168f54ded7129d3a67c0dee988990abb1a (patch)
tree461be3211290c94414166efce34e62293dda58da /libavcodec
parent930d035e72ca78abf30d8627a82bbfd36fa350ac (diff)
downloadffmpeg-9f2d73168f54ded7129d3a67c0dee988990abb1a.tar.gz
Revert "pnm: remove nonsense code"
Breaks decoding pgms with 255 < maxval < 65535. Found-by: Carl Eugen Hoyos <cehoyos@ag.or.at>. This reverts commit a0348d0966a81a66f3a1bf061576b24d5296b933. (cherry picked from commit 768e40b451a459fefaceed6b1b3d6e70c93596ac)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pnm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 6d1eb6d0ed..243b746104 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) {