[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

Michael Niedermayer michaelni at gmx.at
Tue Aug 19 12:40:24 CEST 2014


On Tue, Aug 19, 2014 at 09:49:10AM +0200, Christophe Gisquet wrote:
> 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 ?

yes, locally changed


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140819/5e50db96/attachment.asc>


More information about the ffmpeg-devel mailing list