Hi,

2012/6/14 Mans Rullgard <m...@mansr.com>:
>  static void guess_mv(MpegEncContext *s)
>  {
> -    uint8_t fixed[s->mb_stride * s->mb_height];
> +    uint8_t *fixed = s->fixed;

What about setting s->fixed to NULL when initializing, and only
setting s->fixed to something here, like (just an example):
uint8_t *fixed;
if (!s->fixed)
{
  FF_ALLOCZ_OR_GOTO(s->avctx, s->fixed, mb_array_size * sizeof(uint8_t), fail);
}
fixed = s->fixed;
[...]
fail:
  /* should probably return error here */

That way, no unnecessary allocation (even though it is small) is done
if ER does not need to be performed. I know error handling and
probably style are not correct in the above code snippet, so just take
this as an example.

All in all, if the above is too much of a bother, it is better to have
your patch applied than nothing.

> +            /* quantization tables */
> +            FF_ALLOCZ_OR_GOTO(s->avctx, s->cplx_tab,
> +                              mb_array_size * sizeof(float), fail);
> +            FF_ALLOCZ_OR_GOTO(s->avctx, s->bits_tab,
> +                              mb_array_size * sizeof(float), fail);

They do not look like quantization tables to me, but encoder image
analysis data for rate control.

Also, I guess FF_ALLOC_OR_GOTO can be used (no need to zero such an array).

-- 
Christophe
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to