[FFmpeg-devel] [PATCH] [issue 566] return error for rgb 16-bit pnm files
Justin Ruggles
justin.ruggles
Sun Sep 14 17:23:23 CEST 2008
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.
Thanks,
Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: issue_566_pnm_rgb48.diff
Type: text/x-patch
Size: 1396 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080914/f7659d86/attachment.bin>
More information about the ffmpeg-devel
mailing list