From e2ca8a7268f0d6071d170b1d99e5a264392e1b2e Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Fri, 11 Apr 2025 00:36:59 +0200
Subject: [PATCH 1/2] avcodec/asvenc: Don't use FF_INPUT_BUFFER_MIN_SIZE

ASV-1/2 does not really have a header and so using
FF_INPUT_BUFFER_MIN_SIZE is wasteful as well as ugly
(such bounds should be codec-specific).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/asvenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c
index 9218a41021..e7d931cca9 100644
--- a/libavcodec/asvenc.c
+++ b/libavcodec/asvenc.c
@@ -271,8 +271,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         return ret;
     }
 
-    if ((ret = ff_alloc_packet(avctx, pkt, c->mb_height * c->mb_width * MAX_MB_SIZE +
-                               FF_INPUT_BUFFER_MIN_SIZE)) < 0)
+    ret = ff_alloc_packet(avctx, pkt, c->mb_height * c->mb_width * MAX_MB_SIZE + 3);
+    if (ret < 0)
         return ret;
 
     init_put_bits(&a->pb, pkt->data, pkt->size);
-- 
2.45.2