diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-24 14:14:28 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-24 14:14:28 +0100 |
commit | 198ea7a96f64b60d26068ac30605d5b50245abeb (patch) | |
tree | f3733ea0f10027eebe49df94826e46e52e907b3d /libavcodec/pnm.c | |
parent | a77a27a24b27fc29d119b00866740e4d0b69ba28 (diff) | |
parent | b5f536d24b5ae360503935c34d5d59fa5181b94d (diff) | |
download | ffmpeg-198ea7a96f64b60d26068ac30605d5b50245abeb.tar.gz |
Merge commit 'b5f536d24b5ae360503935c34d5d59fa5181b94d'
* commit 'b5f536d24b5ae360503935c34d5d59fa5181b94d':
pnm: add high-bitdepth PGMYUV support for both encoder and decoder
Conflicts:
libavcodec/pnm.c
libavcodec/pnmdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pnm.c')
-rw-r--r-- | libavcodec/pnm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c index 8972143eab..fe120c7971 100644 --- a/libavcodec/pnm.c +++ b/libavcodec/pnm.c @@ -165,6 +165,13 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) avctx->pix_fmt = AV_PIX_FMT_GRAY16BE; } 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) { + if (s->maxval < 512) + avctx->pix_fmt = AV_PIX_FMT_YUV420P9BE; + else if (s->maxval < 1024) + avctx->pix_fmt = AV_PIX_FMT_YUV420P10BE; + else + avctx->pix_fmt = AV_PIX_FMT_YUV420P16; } else { av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n"); avctx->pix_fmt = AV_PIX_FMT_NONE; @@ -174,7 +181,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) }else s->maxval=1; /* more check if YUV420 */ - if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) { + if (av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PLANAR) { if ((avctx->width & 1) != 0) return AVERROR_INVALIDDATA; h = (avctx->height * 2); |