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

Nicolas George george at nsup.org
Sat Jul 4 16:32:31 EEST 2020


Gautam Ramakrishnan (12020-07-04):
> > Minor: we could have FFBETWEEN() for that.
> I shall use this.

You would need to add it first, which is ok by me.

Note that (x >= a) && (x < b) can be written in a more efficient way:

	(unsigned)x - a < (unsigned)b - a

> If I got you right, you mean initialize 'line' outside the first for loop.
> Keep incrementing after every line is traversed. This is similar to the
> one in jpeg2000dec.c. Shall do that if that is what you meant.

Yes, that is exactly what I mean.

> Should manually take the 2's complement instead? Could write
> an inline function for that.

I think we cannot avoid doing this.

> > The multiplication can overflow.
> width and height could both be 32 bit. Typecasting to 64 bit might
> also overflow in that
> case. Any other alternatives?

We must check the operands before multiplying. Something like this:

	if (height > INT_MAX / width / bpp)

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200704/33e43a6a/attachment.sig>


More information about the ffmpeg-devel mailing list