[FFmpeg-devel] [PATCH 2/2] avcodec/proresenc_kostya: allocate 1 slice more to avoid triggering the reallocation warning when the used space is actually less than the allocated

Christophe Gisquet christophe.gisquet at gmail.com
Tue Aug 19 09:49:10 CEST 2014


Hi,

2014-08-18 21:49 GMT+02:00 Michael Niedermayer <michaelni at gmx.at>:
> +    int max_slice_size = (ctx->frame_size_upper_bound - 200) / (ctx->pictures_per_frame * ctx->slices_per_picture + 1);

Regarding the reallocation check:
pkt_size <= buf - orig_buf + 2 * max_slice_size
For last slice, pkt_size would be (N+1)*max_slice_size ideally, and
(buf - orig_buf) would be around (N-1)*max_slice_size. Then the check
is ok.

However, reallocation increases allocated size by:
int delta = 200 + ctx->pictures_per_frame *
                                ctx->slices_per_picture * max_slice_size -
                                pkt_size;

In the same fashion, shouldn't delta computation be updated to be:
200 + (ctx->pictures_per_frame * ctx->slices_per_picture + 1) * etc ?

-- 
Christophe


More information about the ffmpeg-devel mailing list