[FFmpeg-devel] [PATCH] y41p encoder and decoder

Nicolas George nicolas.george at normalesup.org
Sun Jan 1 16:36:18 CET 2012


Le duodi 12 nivôse, an CCXX, Paul B Mahol a écrit :
> y41p is a packed 12-bit 4:1:1 YUV format used by Brooktree.

Sorry, stupid question: how is it different from a rawvideo codec? A few
words in decoders.texi may be welcome.

> +    if (avpkt->size < 1.5 * avctx->height * avctx->width) {

I am a little uncomfortable with the float for that kind of thing. Using
"*3/2" is IMHO better. Maybe "pix = w*h; size = pix+pix/2" if you want to
avoid overflow while allowing huge frame sizes.

By the way, if the frame size is likely to come from untrusted sources
(including the demuxer), then you must check for overflow in the
multiplication.

> +    if (avctx->width & 7) {
> +        av_log(avctx, AV_LOG_ERROR, "y41p requires width to be
> divisible by 8.\n");
> +        return AVERROR_INVALIDDATA;

AVERROR(EINVAL) seems more appropriate.

> +    if (buf_size < avctx->width * avctx->height * 1.5) {

Ditto about the float and the check for overflow.

No other remarks from me, it looks fine, but I do not know that codec.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120101/4189bf13/attachment.asc>


More information about the ffmpeg-devel mailing list