On 22/02/13 12:05, Kostya Shishkov wrote:
> ---
> Why: I need to dump 8- and 10-bit data into frames at work, so I've picked the
> simplest format standard tools (e.g. ImageMagic) can handle.
> But since Libav couldn't handle it I tried to add higher bitdepth support for
> its PGMYUV decoder, and tried to do it properly, and tried to add encoder
> counterpart too. Hence this patch.
>
> P.S. FATE test would be nice too.
> ---
> libavcodec/pnm.c | 9 ++++++++-
> libavcodec/pnmdec.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> libavcodec/pnmenc.c | 15 ++++++++++++---
> 3 files changed, 65 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
> index 5d13650..094e03d 100644
> --- a/libavcodec/pnm.c
> +++ b/libavcodec/pnm.c
> @@ -157,6 +157,13 @@ int ff_pnm_decode_header(AVCodecContext *avctx,
> PNMContext * const s)
> } else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) {
> if (s->maxval > 255)
> 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;
Is there an upper limit for 16bit?
The rest looks fine even after a second read.
lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel