[FFmpeg-devel] [PATCH] [issue 566] return error for rgb 16-bit pnm files
Michael Niedermayer
michaelni
Sun Sep 14 17:09:13 CEST 2008
On Sun, Sep 14, 2008 at 10:53:44AM -0400, Justin Ruggles wrote:
> Hi,
>
> Patch attached to resolve issue 566. It would be nice to implement
> PIX_FMT_RGB48/64, but for now we at least need an error instead of
> silently generating bad output.
>
> Thanks,
> Justin
> Index: libavcodec/pnm.c
> ===================================================================
> --- libavcodec/pnm.c (revision 15319)
> +++ libavcodec/pnm.c (working copy)
> @@ -106,7 +106,13 @@
> else
> avctx->pix_fmt = PIX_FMT_GRAY8;
> } else if (depth == 3) {
> + if (maxval < 256) {
> avctx->pix_fmt = PIX_FMT_RGB24;
> + } else {
> + av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n");
> + avctx->pix_fmt = PIX_FMT_NONE;
> + return -1;
> + }
> } else if (depth == 4) {
> avctx->pix_fmt = PIX_FMT_RGB32;
> } else {
ok
> @@ -131,6 +137,10 @@
> avctx->pix_fmt = PIX_FMT_GRAY16BE;
> if (s->maxval != 65535)
> avctx->pix_fmt = PIX_FMT_GRAY16;
> + } else if(s->maxval >= 256) {
> + av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n");
> + avctx->pix_fmt = PIX_FMT_NONE;
> + return -1;
> }
the if(s->maxval >= 256) {
can be factored out
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080914/b55d9e32/attachment.pgp>
More information about the ffmpeg-devel
mailing list