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

Justin Ruggles justin.ruggles
Sun Sep 14 18:38:27 CEST 2008


Michael Niedermayer wrote:
> On Sun, Sep 14, 2008 at 11:25:06AM -0400, Justin Ruggles wrote:
>> 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.
>> oops... and again...
> 
> ok
> i guess i should read submitted patches more carefull even for trivial
> changes.

applied.




More information about the ffmpeg-devel mailing list