mirror of https://git.ffmpeg.org/ffmpeg.git
Revert "pnm: remove nonsense code"
Breaks decoding pgms with 256 < maxval < 65535.
Found-by: Carl Eugen Hoyos <cehoyos@ag.or.at>.
This reverts commit a0348d0966
.
This commit is contained in:
parent
ac8e70d735
commit
768e40b451
|
@ -163,6 +163,8 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
|
||||||
if (s->maxval >= 256) {
|
if (s->maxval >= 256) {
|
||||||
if (avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
|
if (avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
|
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) {
|
} else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
|
avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
|
||||||
} else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && s->maxval < 65536) {
|
} else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && s->maxval < 65536) {
|
||||||
|
|
Loading…
Reference in New Issue