From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 7F6D448276 for ; Wed, 21 Jan 2026 23:53:33 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'9iTERM3qcNlZH5z5ghKKC+zwHLljprmnl3PAw2cB98Y=', expected b'Y/bzm5AG3Qur9fASKSm4WaV95G10p9wJItjccvTWKDs=')) header.d=niedermayer.cc header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1769039604; h=date : to : message-id : references : mime-version : in-reply-to : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : from; bh=3mKjLOCcqyFerDHFMitDf1fP4tLxQYYZQ4NNoAgANrM=; b=Q4ogslgO7L0/o+0uiLOY3WQn1ICnE5yV/pXtUjHWlue3gt2sjI0EOc/zwolrWdRF5+TAU wBz8MXKn3mDmmD/9eZw234K4NflgugJCnGpUKyqccoQsoWK4tJO+Keg3hmDggHUmu2+ZBen vp2spQMpAPlXErqljdZeE0sdZ8AIWGODYjIG/GFTY7RVkVC8Yhz1wcQFx4+mjeDhK0VNcfw TZzhEf+xpqNFS8IHNK9etAl+tF2qEgm0X5RmlzGZgmjWhumImHUwDva2TGP7ZKbzWbPJnBw l74dq0DFiQ1qVpJQJleN4pLqTf7H2eOMTSo2Kdu1j5EysCU/YDD8azEEth9w== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 0E42E690E9A; Thu, 22 Jan 2026 01:53:24 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1769039582; b=q7hJRuE6BoY88HHY3yNA2fqogwtzTz+ypHSw2BfQiUiHFFZWCP+YiqS5vEvsrHcIuT/ut Pr8I20aR68o0bl7wjK1qKsOGHigNdb5oh5hJcnjQsCbwUvXbiUGFgGaKWRJ298FAs202vOC f+fuNljG8J6gZ09u2bLvtJXi8ZIirPiWyN5u8vzoCNUgJKzlLYBXorudfPgEnt0k7YFhfyQ P/BkyiyDuWGtkQJ1/c0bxS3RJXfGA4k3b8Q/o4aKf/GjuZBsaLChRyAMRz7fpVMxrf3KfCM I84SHJ+412CYvRH7DBVEc75/DvuIPjI/kvUqRfa9wQY03zJD6IBv6qRbSgkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1769039582; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=9iTERM3qcNlZH5z5ghKKC+zwHLljprmnl3PAw2cB98Y=; b=WPTxJaOXEeLlWydaY3Jk4oAxQ8+8I6j3jZHd/NR8g6+UbApqXys+lONp9xL8jbwGDLQZA /C0LO4pGM6e3kH+vjJyEa7Ei2L/OE4no7tpREKxm1ZJxPTf66SBJuadJtgg83m67pthbJCZ xEFMVZ07mI1rDezi6R4Oy3NZwePSQCQgvPNsVnmYTPb1ODv9goNH73Nm6nsep6l3Q9h6QYo cYXanNbEaShFaNFMxxZb0y1cEO0T4U15VcZpaKghsR4r10l6Q6A1sOLNhwCwd8nH/qyKK9b s4t24H2tL1T10PJXtXPlGNIA8INtDgZOGfAsnWqMA2tMVJLGeI31H0yNxhCg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=niedermayer.cc; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=niedermayer.cc; arc=none (Message is not ARC signed); dmarc=none Received: from mslow3.mail.gandi.net (mslow3.mail.gandi.net [217.70.178.249]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 90A526801F6 for ; Thu, 22 Jan 2026 01:52:50 +0200 (EET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by mslow3.mail.gandi.net (Postfix) with ESMTP id CB0925802F5 for ; Wed, 21 Jan 2026 18:38:17 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 1D83C44465 for ; Wed, 21 Jan 2026 18:38:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1769020696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Y/bzm5AG3Qur9fASKSm4WaV95G10p9wJItjccvTWKDs=; b=YSwukwrErGHf4R4+8GlUKFUDYKgJtmy5fyfXmdlwEY2JQOnzTAXbRrWYJF6a3yozucNV6B BU3o2fRx5byZeLcPmS8pqgxmGW3rOLkxqf8Si2YEw1beIJ58ANWUWrsoFxnN3ax01t6+28 pST2dWgiE08jU5gItEh7ZgsSjFTnwLkH58B+WyK2BiIvbJVDP6YVhgYqweI/FxbAm6UnHm W6FjC1NkMHK6UKRPM0LDd4vyJZs/AbHU9GgpQAtXZfS/3Gs/WVUzXRL4QXzu2UXrMM4X8x kW/W8o3veQXIhhr0+tvwhm6R9deGZCt9xTzFseE9ysB1o7S1S/BYVZvw9r3ffQ== Date: Wed, 21 Jan 2026 19:38:15 +0100 To: FFmpeg development discussions and patches Message-ID: References: <176879650591.25.13669090667799477890@4457048688e7> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddugeegtdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdduhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeffledtfeevfeffheeuuefhtdejieelueeftdeitdfgheetgefffeefteekffdthfenucffohhmrghinhepfhhfmhhpvghgrdhorhhgnecukfhppeeguddrieeirdeiiedrhedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieeirdehtddphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhqihgupeduffekfeevgeeggeeihedpmhhouggvpehsmhhtphhouhhtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh Message-ID-Hash: 2VWHQBWGONZ5FEIDKYKFXNFPVNOE43FI X-Message-ID-Hash: 2VWHQBWGONZ5FEIDKYKFXNFPVNOE43FI X-MailFrom: SRS0=gZ5S=72=niedermayer.cc=michael@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] Re: [PR] avutil/mem: Add av_malloc_with_paddingz() (PR #21509) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michael Niedermayer via ffmpeg-devel Cc: Michael Niedermayer Content-Type: multipart/mixed; boundary="===============8268323324276255164==" Archived-At: List-Archive: List-Post: --===============8268323324276255164== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="igtdw7yhYMc9Y8un" Content-Disposition: inline --igtdw7yhYMc9Y8un Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 19, 2026 at 08:44:23AM +0000, Kieran Kunhya via ffmpeg-devel wr= ote: > On Mon, 19 Jan 2026, 04:22 michaelni via ffmpeg-devel, < > ffmpeg-devel@ffmpeg.org> wrote: >=20 > > PR #21509 opened by michaelni > > URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21509 > > Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21509.patch > > > > Add a av_malloc() that adds padding like AV_INPUT_BUFFER_PADDING_SIZE > > and clears it. > > > > This is a operation we commonly use so this function should simplify > > many cases > > > > Signed-off-by: Michael Niedermayer > > > > > > >From cc424b2a5568ee35a3435ff58a84d2a18c1c6843 Mon Sep 17 00:00:00 2001 > > From: Michael Niedermayer > > Date: Mon, 19 Jan 2026 05:15:23 +0100 > > Subject: [PATCH] avutil/mem: Add av_malloc_with_paddingz() > > > > Add a av_malloc() that adds padding like AV_INPUT_BUFFER_PADDING_SIZE > > and clears it. > > > > This is a operation we commonly use so this function should simplify > > many cases > > > > Signed-off-by: Michael Niedermayer > > --- > > libavutil/mem.c | 10 ++++++++++ > > libavutil/mem.h | 13 +++++++++++++ > > 2 files changed, 23 insertions(+) > > > > diff --git a/libavutil/mem.c b/libavutil/mem.c > > index b205d3fb25..aac7ef4d12 100644 > > --- a/libavutil/mem.c > > +++ b/libavutil/mem.c > > @@ -261,6 +261,16 @@ void *av_mallocz(size_t size) > > return ptr; > > } > > > > +void *av_malloc_with_paddingz(size_t size, size_t padding) > > +{ > > + if (size > SIZE_MAX - padding) > > + return NULL; > > + uint8_t *p =3D av_malloc(size + padding); > > + if(p) > > + memset(p + size, 0, padding); > > + return p; > > +} > > + > > void *av_calloc(size_t nmemb, size_t size) > > { > > size_t result; > > diff --git a/libavutil/mem.h b/libavutil/mem.h > > index ab7648ac57..6a4c144f18 100644 > > --- a/libavutil/mem.h > > +++ b/libavutil/mem.h > > @@ -129,6 +129,19 @@ void *av_malloc(size_t size) av_malloc_attrib > > av_alloc_size(1); > > */ > > void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); > > > > +/** > > + * Allocate a memory block with alignment suitable for all memory acce= sses > > + * (including vectors if available on the CPU) > > + * > > + * An additional padding will be allocated and cleared. > > + * > > + * @param size Size in bytes for the memory block to be allocated > > + * @param padding Size in bytes of padding allocated and zeroed after > > size. > > + * @return Pointer to the allocated block, or `NULL` if it cannot be > > allocated > > + * @see av_malloc() > > + */ > > +void *av_malloc_with_paddingz(size_t size, size_t padding) > > av_malloc_attrib av_alloc_size(1); > > + > > /** > > * Allocate a memory block for an array with av_malloc(). > > * > > -- > > 2.52.0 > > > > _______________________________________________ > > ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org > > To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org >=20 >=20 > Seems a bit wordy. av_malloc_paddedz instead? yes, i changed it to james suggestions of av_padded_malloc(), [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact --igtdw7yhYMc9Y8un Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaXEdEgAKCRBhHseHBAsP q03VAJ9y//fkNoZWs9mQw7OgsW8l7Gbb7ACcCWfqeVktDl98MAtXuQbGeAMzgiM= =l5pf -----END PGP SIGNATURE----- --igtdw7yhYMc9Y8un-- --===============8268323324276255164== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org --===============8268323324276255164==--