[FFmpeg-devel] [PATCH 3/3] Implement inline function av_fill_image_max_step() and use it for factorizing code.

Stefano Sabatini stefano.sabatini-lala
Wed Aug 18 23:03:28 CEST 2010


On date Wednesday 2010-08-18 14:20:20 +0200, Michael Karcher encoded:
> Am Mittwoch, den 18.08.2010, 13:48 +0200 schrieb Michael Niedermayer:
> > > +static inline void av_fill_image_max_step(int max_step[4], int max_step_comp[4], const AVPixFmtDescriptor *pix_desc)
> > > +{
> > > +    int i;
> > > +    memset(max_step     , 0, 4*sizeof(max_step     [0]));
> > isnt sizeof(max_step) the same?
> 
> No. C is an evil language. As "int max_step[4]" is a parameter to a
> function, and arrays passed as parameters decay to pointers, the
> function declaration behaves like the parameter were "int *max_step".
> And having sizeof(int*) == 4*sizeof(int) is quite unlikely.
> 
> If max_step were a local or global variable instead of a formal
> parameter, sizeof(max_step) would have been working.

Patch applied (but renamed av_fill_image_max_pixstep() for more
expressivity).

Regards.
-- 
FFmpeg = Fundamental & Fast Monstrous Practical Elfic Gadget



More information about the ffmpeg-devel mailing list