From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C7E7949035 for ; Fri, 31 May 2024 21:44:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6ACE168D5B4; Sat, 1 Jun 2024 00:44:28 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F346168D3A1 for ; Sat, 1 Jun 2024 00:44:21 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2B9C220002 for ; Fri, 31 May 2024 21:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717191861; 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=tybnaoPwG6dC3C10ljcyag3zO7olfCaySrL9KD3uVm4=; b=DPutuAMjdSEyW+5mSd0ZH4VD06IRytjg1p2drucfIRhn7i3Xibn3Uya6EQvHBX4MyC0MLZ Ww7f4ZduChXm2GpWxbsIJ3mxn4iNI+CLLffUhlk8iF8411CZYO1dlECz96OEyAkyoZO9Fd +6jef7TcLejrqQb4BEZ4vOdkM18r14az8ZtLzg9CjmJ1RWWtCpe+xFxHm5MkmmVLpxhkPt ld0p6ObY08Crqv9FkRle2M+ovrTEBKAf8frE/0FrGEHuGea2kwE9XdKmHzrjC38Egjc4wg OJ4B/QcveeMVwzPpybG3PHMfph01DjOINOAQC1W79KiOxKuXgH3PbkpVnuh6bA== Date: Fri, 31 May 2024 23:44:19 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240531214419.GP2821752@pb2> References: <16200460.ujdIm7iVAk@basile.remlab.net> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 01/16] avutil/buffer: add helper to allocate aligned memory X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="===============1676443526099668747==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1676443526099668747== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="SLvi8k+ew82wFfnH" Content-Disposition: inline --SLvi8k+ew82wFfnH Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 31, 2024 at 11:06:49PM +0200, averne wrote: > Le 30/05/2024 =C3=A0 22:38, R=C3=A9mi Denis-Courmont a =C3=A9crit=C2=A0: > > Le torstaina 30. toukokuuta 2024, 22.43.03 EEST averne a =C3=A9crit : > >> This is useful eg. for memory-mapped buffers that need page-aligned me= mory, > >> when dealing with hardware devices > >> > >> Signed-off-by: averne > >> --- > >> libavutil/buffer.c | 31 +++++++++++++++++++++++++++++++ > >> libavutil/buffer.h | 7 +++++++ > >> 2 files changed, 38 insertions(+) > >> > >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c > >> index e4562a79b1..b8e357f540 100644 > >> --- a/libavutil/buffer.c > >> +++ b/libavutil/buffer.c > >> @@ -16,9 +16,14 @@ > >> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0211= 0-1301 > >> USA */ > >> > >> +#include "config.h" > >> + > >> #include > >> #include > >> #include > >> +#if HAVE_MALLOC_H > >> +#include > >> +#endif > >> > >> #include "avassert.h" > >> #include "buffer_internal.h" > >> @@ -100,6 +105,32 @@ AVBufferRef *av_buffer_allocz(size_t size) > >> return ret; > >> } > >> > >> +AVBufferRef *av_buffer_aligned_alloc(size_t size, size_t align) > >> +{ > >> + AVBufferRef *ret =3D NULL; > >> + uint8_t *data =3D NULL; > >> + > >> +#if HAVE_POSIX_MEMALIGN > >> + if (posix_memalign((void **)&data, align, size)) > >=20 > > Invalid cast. > >=20 >=20 > Neither gcc or clang emit a warning here, even on -Weverything. > What would be your idea of a valid cast then? First cast to intptr_t,=20 > then void** ? >=20 > >> + return NULL; > >> +#elif HAVE_ALIGNED_MALLOC > >> + data =3D aligned_alloc(align, size); on mingw64: src/libavutil/buffer.c: In function =E2=80=98av_buffer_aligned_alloc=E2=80= =99: src/libavutil/buffer.c:117:12: error: implicit declaration of function =E2= =80=98aligned_alloc=E2=80=99 [-Werror=3Dimplicit-function-declaration] 117 | data =3D aligned_alloc(align, size); | ^~~~~~~~~~~~~ thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answe= r. --SLvi8k+ew82wFfnH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZlpEqgAKCRBhHseHBAsP qwM5AKCSBoV+O8rRY6xXGxmdYRc/nlmTFACdHCdIcdN/6G1GmnPNyo3l8gxOh4Q= =37ND -----END PGP SIGNATURE----- --SLvi8k+ew82wFfnH-- --===============1676443526099668747== 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 https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --===============1676443526099668747==--