[FFmpeg-devel] [PATCH 5/5] libxvid: Reduce the size of an array

Timothy Gu timothygu99 at gmail.com
Fri Aug 2 02:27:36 CEST 2013


On Jul 31, 2013 12:15 PM, "Michael Niedermayer" <michaelni at gmx.at> wrote:
>
> On Tue, Jul 30, 2013 at 07:42:32PM -0700, Timothy Gu wrote:
> > It is not possible to have a plugin[] array with 5 or more elements.
> > ---
> >
> > Changed according to newer versions of other patches
> >
> >  libavcodec/libxvid.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
> > index edf5f43..8945c28 100644
> > --- a/libavcodec/libxvid.c
> > +++ b/libavcodec/libxvid.c
> > @@ -364,7 +364,7 @@ static av_cold int xvid_encode_init(AVCodecContext
*avctx)  {
> >      xvid_plugin_ssim_t        ssim            = { 0 };
> >      xvid_gbl_init_t           xvid_gbl_init   = { 0 };
> >      xvid_enc_create_t         xvid_enc_create = { 0 };
> > -    xvid_enc_plugin_t         plugins[7];
> > +    xvid_enc_plugin_t         plugins[4];
>
> the patch is correct but why should the array be tightened up ?

For the sake of saving a few bytes in memory.

> also it might make sense (independant of this patch) to check that
> the array is large enough for the used plugins

I don't think there is a need for that. A developer can just count the
value of the counter by hand to make sure the array doesn't overload.

[...]

Timothy


More information about the ffmpeg-devel mailing list