[FFmpeg-devel] [PATCH] [issue 566] return error for rgb 16-bit pnm files

Michael Niedermayer michaelni
Sun Sep 14 17:29:40 CEST 2008


On Sun, Sep 14, 2008 at 11:23:23AM -0400, Justin Ruggles wrote:
> Michael Niedermayer wrote:
> > 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
> 
> New patch attached.

ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- 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/90281462/attachment.pgp>



More information about the ffmpeg-devel mailing list