[FFmpeg-devel] [PATCH v2 1/2] libavcodec/pgxdec: Add PGX decoder

Gautam Ramakrishnan gautamramk at gmail.com
Sun Jun 28 13:45:42 EEST 2020


On Sun, Jun 28, 2020 at 12:41 AM Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>
> Am Sa., 27. Juni 2020 um 20:11 Uhr schrieb <gautamramk at gmail.com>:
>
> > +static int ff_pgx_decode_header(AVCodecContext *avctx, PGXContext * s,
> > +                                int *depth, int *width, int *height,
> > +                                int *sign)
> > +{
> > +    const char *header_start = "PG ML ";
> > +    int byte;
> > +
> > +    if (bytestream2_get_bytes_left(&s->g) < 13) {
> > +        return AVERROR_INVALIDDATA;
> > +    }
>
> Do other decoders do this for 13 bytes or less?
This could be improved. I modify it.
>
> > +    // Checks whether file starts with "PG ML "
> > +    if (memcmp(header_start, s->g.buffer, 6))
> > +        return AVERROR_INVALIDDATA;
>
> If you really have to keep this why isn't it:
> memcmp("PG ML ", s->g.buffer, 6)
> which would make the ugly comment go away?
I shall change this. I do not understand how the check can be
removed. It is compulsory that a PGX file must have these bytes



-- 
-------------
Gautam |


More information about the ffmpeg-devel mailing list