Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avutil/frame: use the maximum compile time supported alignment for strides
@ 2024-07-31 12:55 James Almer
  2024-08-02 19:07 ` James Almer
  2024-08-03  6:34 ` Rémi Denis-Courmont
  0 siblings, 2 replies; 4+ messages in thread
From: James Almer @ 2024-07-31 12:55 UTC (permalink / raw)
  To: ffmpeg-devel

This puts lavu frame buffer allocator helpers in sync with lavc's decoder frame
buffer allocator's STRIDE_ALIGN define.

Remove the comment about av_cpu_max_align() while at it as using it is not
ideal when CPU flags can be changed mid process.

Should fix ticket #11116.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/frame.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 673a9afb3b..5cbfc6a48b 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -166,6 +166,8 @@ void av_frame_free(AVFrame **frame)
     av_freep(frame);
 }
 
+#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : 32)
+
 static int get_video_buffer(AVFrame *frame, int align)
 {
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
@@ -182,7 +184,7 @@ static int get_video_buffer(AVFrame *frame, int align)
 
     if (!frame->linesize[0]) {
         if (align <= 0)
-            align = 32; /* STRIDE_ALIGN. Should be av_cpu_max_align() */
+            align = ALIGN;
 
         for (int i = 1; i <= align; i += i) {
             ret = av_image_fill_linesizes(frame->linesize, frame->format,
-- 
2.45.2

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avutil/frame: use the maximum compile time supported alignment for strides
  2024-07-31 12:55 [FFmpeg-devel] [PATCH] avutil/frame: use the maximum compile time supported alignment for strides James Almer
@ 2024-08-02 19:07 ` James Almer
  2024-08-03  6:34 ` Rémi Denis-Courmont
  1 sibling, 0 replies; 4+ messages in thread
From: James Almer @ 2024-08-02 19:07 UTC (permalink / raw)
  To: ffmpeg-devel

On 7/31/2024 9:55 AM, James Almer wrote:
> This puts lavu frame buffer allocator helpers in sync with lavc's decoder frame
> buffer allocator's STRIDE_ALIGN define.
> 
> Remove the comment about av_cpu_max_align() while at it as using it is not
> ideal when CPU flags can be changed mid process.
> 
> Should fix ticket #11116.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavutil/frame.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index 673a9afb3b..5cbfc6a48b 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -166,6 +166,8 @@ void av_frame_free(AVFrame **frame)
>       av_freep(frame);
>   }
>   
> +#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : 32)
> +
>   static int get_video_buffer(AVFrame *frame, int align)
>   {
>       const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
> @@ -182,7 +184,7 @@ static int get_video_buffer(AVFrame *frame, int align)
>   
>       if (!frame->linesize[0]) {
>           if (align <= 0)
> -            align = 32; /* STRIDE_ALIGN. Should be av_cpu_max_align() */
> +            align = ALIGN;
>   
>           for (int i = 1; i <= align; i += i) {
>               ret = av_image_fill_linesizes(frame->linesize, frame->format,

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avutil/frame: use the maximum compile time supported alignment for strides
  2024-07-31 12:55 [FFmpeg-devel] [PATCH] avutil/frame: use the maximum compile time supported alignment for strides James Almer
  2024-08-02 19:07 ` James Almer
@ 2024-08-03  6:34 ` Rémi Denis-Courmont
  2024-08-03 11:47   ` James Almer
  1 sibling, 1 reply; 4+ messages in thread
From: Rémi Denis-Courmont @ 2024-08-03  6:34 UTC (permalink / raw)
  To: ffmpeg-devel

Le keskiviikkona 31. heinäkuuta 2024, 15.55.23 EEST James Almer a écrit :
> This puts lavu frame buffer allocator helpers in sync with lavc's decoder
> frame buffer allocator's STRIDE_ALIGN define.

STRIDE_ALIGN can go down to 16 or even 8 bytes though. What is the reason for 
capping at 32 bytes here?

(Alternatively, cache line size is probably 64 bytes almost everywhere.)

-- 
レミ・デニ-クールモン
http://www.remlab.net/



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avutil/frame: use the maximum compile time supported alignment for strides
  2024-08-03  6:34 ` Rémi Denis-Courmont
@ 2024-08-03 11:47   ` James Almer
  0 siblings, 0 replies; 4+ messages in thread
From: James Almer @ 2024-08-03 11:47 UTC (permalink / raw)
  To: ffmpeg-devel

On 8/3/2024 3:34 AM, Rémi Denis-Courmont wrote:
> Le keskiviikkona 31. heinäkuuta 2024, 15.55.23 EEST James Almer a écrit :
>> This puts lavu frame buffer allocator helpers in sync with lavc's decoder
>> frame buffer allocator's STRIDE_ALIGN define.
> 
> STRIDE_ALIGN can go down to 16 or even 8 bytes though. What is the reason for
> capping at 32 bytes here?

I'd rather not reduce the alignment, but no strong feelings about it anyway.

> 
> (Alternatively, cache line size is probably 64 bytes almost everywhere.)
> 
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-03 11:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-31 12:55 [FFmpeg-devel] [PATCH] avutil/frame: use the maximum compile time supported alignment for strides James Almer
2024-08-02 19:07 ` James Almer
2024-08-03  6:34 ` Rémi Denis-Courmont
2024-08-03 11:47   ` James Almer

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