[FFmpeg-devel] PixFmtInfo cleanup

Michael Niedermayer michaelni
Mon Feb 23 03:06:51 CET 2009

On Sun, Feb 22, 2009 at 05:58:59PM -0800, Baptiste Coudurier wrote:
> Hi,
> On 2/22/2009 5:26 PM, Michael Niedermayer wrote:
> > 
> > [...]
> >
> >     uint8_t log2_chroma_w;      ///< chroma_width = -((-luma_width )>>log2_chroma_w)
> >     uint8_t log2_chroma_h;      ///< chroma_height= -((-luma_height)>>log2_chroma_h)
> Please don't try to do a contest on getting the most obfuscated API ever
> designed. I'm all for this new API, and I'm also all for designing it to
> make it obvious and simple.
> IMHO this is too much.

We already have these 2 fields in pixfmtinfo and we do need them
above is a unambigous definition of their meaning.

I surely agree with you that this should be written in english first
before this C code based definition in the comments 
but its essential that chroma_width/height is calculated that way because
otherwise your code will be exploitable.
example YV12
chroma_width= -((-5)>>1) = 3
if instead you do 5>>1 you get 2 which would allocate a image that is
too small

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090223/0a8e7516/attachment.pgp>

More information about the ffmpeg-devel mailing list