Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] AVFrame data alignment issues
@ 2022-01-16  0:59 Marton Balint
  2022-01-16  1:37 ` Ronald S. Bultje
  0 siblings, 1 reply; 2+ messages in thread
From: Marton Balint @ 2022-01-16  0:59 UTC (permalink / raw)
  To: ffmpeg-devel

Hi,

I wonder if there are strict requirements for alignment of AVFrame 
buffers. Yes, it is usually aligned by default, but there are filters, 
like crop or pad which tries to avoid copying data even at the cost of 
breaking the alignment. This unfortunately causes crashes for code which 
requires it, some examples:

- the zscale filter only checks input buffer alignment but not output
   buffer alignment, therefore might crash if a later pad filter provides
   an unaligned get_buffer callback for a filter chain.

- the blend/tblend filter has a similar problem, it's ASM code is using
   aligned movs for output. (not for input however).

- the dnxhd encoder depends on aligment of its input buffers.

How this should be fixed?

- Change pad/crop filters to only do "smart" pad/crop if alignment can be 
guaranteed? Maybe a user option should be added to enable "unsafe" mode?

- Add checks for aligment where it is actually required, e.g. in dnxhd 
encoder or blend/zscale filter?

- Change blend code to use unaligned movs even for output?

Thanks,
Marton
_______________________________________________
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] 2+ messages in thread

* Re: [FFmpeg-devel] AVFrame data alignment issues
  2022-01-16  0:59 [FFmpeg-devel] AVFrame data alignment issues Marton Balint
@ 2022-01-16  1:37 ` Ronald S. Bultje
  0 siblings, 0 replies; 2+ messages in thread
From: Ronald S. Bultje @ 2022-01-16  1:37 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Hi,

On Sat, Jan 15, 2022 at 7:59 PM Marton Balint <cus@passwd.hu> wrote:

> How this should be fixed?
>

The current state (I believe this is documented) is that libavfilter
buffers are not guaranteed to be aligned, but libavcodec buffers are. If a
libavfilter without alignment is input into avcodec without explicit copy
into a new, aligned buffer, that's invalid API usage.

Ronald
_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2022-01-16  1:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16  0:59 [FFmpeg-devel] AVFrame data alignment issues Marton Balint
2022-01-16  1:37 ` Ronald S. Bultje

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