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

Moritz Barsnick barsnick at gmx.net
Mon Jun 29 01:56:10 EEST 2020


On Sun, Jun 28, 2020 at 20:13:28 +0530, gautamramk at gmail.com wrote:
> +            int val;
> +            if (bytestream2_get_bytes_left(&s->g) < 1)
> +                return AVERROR_INVALIDDATA;
> +            if (sign) {
> +                val = bytestream2_get_byte(&s->g) + (1 << (depth - 1));
> +                val <<= (8 - depth);
> +                *(line + j) = val;
> +            } else {
> +                val = bytestream2_get_byteu(&s->g);
> +                val <<= (8 - depth);
> +                *(line + j) = val;
> +            }

I may be missing something, but it looks like you are duplicating code
in if() and else which could be put behind their blocks.

> +            if (sign) {
> +                val = (int16_t)bytestream2_get_be16(&s->g) + (1 << (depth - 1));
> +                val <<= (16 - depth);
> +                *(line + j) = val;
> +            } else {
> +                val = bytestream2_get_be16u(&s->g);
> +                val <<= (16 - depth);
> +                *(line + j) = val;
> +            }

Same here.


Apart from that, all reference samples seem to be probed, demuxed and
decoded successfully (but I didn't look at the decoding result).

Moritz


More information about the ffmpeg-devel mailing list