On Sun, Mar 09, 2025 at 11:58:03PM +0100, Michael Niedermayer wrote:
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ffv1enc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
> index b4080f29002..7c73ff12c2f 100644
> --- a/libavcodec/ffv1enc.c
> +++ b/libavcodec/ffv1enc.c
> @@ -1211,7 +1211,8 @@ size_t ff_ffv1_encode_buffer_size(AVCodecContext *avctx)
>      size_t maxsize = avctx->width*avctx->height * (1 + f->transparency);
>      if (f->chroma_planes)
>          maxsize += AV_CEIL_RSHIFT(avctx->width, f->chroma_h_shift) * AV_CEIL_RSHIFT(f->height, f->chroma_v_shift) * 2;
> -    maxsize += f->slice_count * 800; //for slice header
> +    maxsize += f->slice_count * 800; //for slice header and
> +    maxsize += f->slice_count * 9000 * !!f->flt; //remap table
>      if (f->version > 3) {
>          maxsize *= f->bits_per_raw_sample + 1;
>      } else {

will apply this without the typo and with a more correct estimation

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

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin