Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 01/16] avutil/buffer: add helper to allocate aligned memory
Date: Fri, 31 May 2024 23:44:19 +0200
Message-ID: <20240531214419.GP2821752@pb2> (raw)
In-Reply-To: <de68be06-0dae-4975-b406-7d317dc32242@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2209 bytes --]

On Fri, May 31, 2024 at 11:06:49PM +0200, averne wrote:
> Le 30/05/2024 à 22:38, Rémi Denis-Courmont a écrit :
> > Le torstaina 30. toukokuuta 2024, 22.43.03 EEST averne a écrit :
> >> This is useful eg. for memory-mapped buffers that need page-aligned memory,
> >> when dealing with hardware devices
> >>
> >> Signed-off-by: averne <averne381@gmail.com>
> >> ---
> >>  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 02110-1301
> >> USA */
> >>
> >> +#include "config.h"
> >> +
> >>  #include <stdatomic.h>
> >>  #include <stdint.h>
> >>  #include <string.h>
> >> +#if HAVE_MALLOC_H
> >> +#include <malloc.h>
> >> +#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 = NULL;
> >> +    uint8_t    *data = NULL;
> >> +
> >> +#if HAVE_POSIX_MEMALIGN
> >> +    if (posix_memalign((void **)&data, align, size))
> > 
> > Invalid cast.
> > 
> 
> 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, 
> then void** ?
> 
> >> +        return NULL;
> >> +#elif HAVE_ALIGNED_MALLOC
> >> +    data = aligned_alloc(align, size);

on mingw64:

src/libavutil/buffer.c: In function ‘av_buffer_aligned_alloc’:
src/libavutil/buffer.c:117:12: error: implicit declaration of function ‘aligned_alloc’ [-Werror=implicit-function-declaration]
  117 |     data = aligned_alloc(align, size);
      |            ^~~~~~~~~~~~~

thx

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

There will always be a question for which you do not know the correct answer.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

  reply	other threads:[~2024-05-31 21:44 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30 19:43 [FFmpeg-devel] [PATCH 00/16] NVidia Tegra hardware decoding backend averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 01/16] avutil/buffer: add helper to allocate aligned memory averne
2024-05-30 20:38   ` Rémi Denis-Courmont
2024-05-31 21:06     ` averne
2024-05-31 21:44       ` Michael Niedermayer [this message]
2024-06-02 18:37         ` averne
2024-06-01  6:59       ` Rémi Denis-Courmont
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 02/16] configure, avutil: add support for HorizonOS averne
2024-05-30 20:37   ` Rémi Denis-Courmont
2024-05-31 21:06     ` averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 03/16] avutil: add ioctl definitions for tegra devices averne
2024-05-30 20:42   ` Rémi Denis-Courmont
2024-05-31 21:06     ` averne
2024-05-31 21:16       ` Timo Rothenpieler
2024-06-02 18:37         ` averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 04/16] avutil: add hardware definitions for NVDEC, NVJPG and VIC averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 05/16] avutil: add common code for nvtegra averne
2024-05-31  8:32   ` Rémi Denis-Courmont
2024-05-31 21:06     ` averne
2024-06-01  7:29       ` Rémi Denis-Courmont
2024-06-05 20:29   ` Mark Thompson
2024-06-29 19:35     ` averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 06/16] avutil: add nvtegra hwcontext averne
2024-06-05 20:47   ` Mark Thompson
2024-06-29 19:35     ` averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 07/16] hwcontext_nvtegra: add dynamic frequency scaling routines averne
2024-06-05 20:50   ` Mark Thompson
2024-06-29 19:35     ` averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 08/16] nvtegra: add common hardware decoding code averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 09/16] nvtegra: add mpeg1/2 hardware decoding averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 10/16] nvtegra: add mpeg4 " averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 11/16] nvtegra: add vc1 " averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 12/16] nvtegra: add h264 " averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 13/16] nvtegra: add hevc " averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 14/16] nvtegra: add vp8 " averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 15/16] nvtegra: add vp9 " averne
2024-05-30 19:43 ` [FFmpeg-devel] [PATCH 16/16] nvtegra: add mjpeg " averne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240531214419.GP2821752@pb2 \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git