[FFmpeg-devel] [PATCH 3/4] proresenc_kostya: realloc if buffer too small

Christophe Gisquet christophe.gisquet at gmail.com
Tue Aug 12 11:56:21 CEST 2014


2014-08-12 10:19 GMT+02:00 Michael Niedermayer <michaelni at gmx.at>:
> the "serious undersizing" check already depends on the assumtation
> that FF_MIN_BUFFER_SIZE is larger than a slice,

Yes, and here lies the issue: if we haven't been able to guess it
correctly previously, how likely are we to guess it correctly here?
Take 2*max(previous_slice_size) ?

> what i meant was that in case we knowingly allocate a smaller buffer
> than the max then reallocation would not be a "abnormal" condition
> and thus would not need a warning.
> smaller mallocs might be faster, so if for example a 50% sized
> buffer is enough for 99.9% of cases needing realloc only in 0.1%
> it might be faster to allocate less than the maximum
> but i made no benchmarks so it might be negligible ...

I see your point. But this is prores, an intermediate codec where
people don't mind having tens of MB/s and use workstations. I don't
think they really mind the extra allocation. Plus the codec already is
lenient: ctx->frame_size_upper_bound is usually a rather high bound
(except of course when it's buggy like here).


More information about the ffmpeg-devel mailing list