Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] framepool width and potential patch for bug 9873
@ 2022-08-20 11:21 Brendan Hack
  2022-08-20 11:41 ` Timo Rothenpieler
  0 siblings, 1 reply; 4+ messages in thread
From: Brendan Hack @ 2022-08-20 11:21 UTC (permalink / raw)
  To: ffmpeg-devel

Hi,

I reported https://trac.ffmpeg.org/ticket/9873 last week and have since 
been digging into the code to see if I can get a patch together. I've 
found the underlying issue in ff_frame_pool_video_init at line 77 of 
libavfilter/framepool.c:

         ret = av_image_fill_linesizes(pool->linesize, pool->format,
                                       FFALIGN(pool->width, align));

When creating frames for frei0r filtering an align value of 16 gets 
passed in. This works fine for widths like 400 where FFALIGN just 
returns 400 since it's a multiple of 16. But for values like 1800 it 
pushes the width up to 1808 which then generates linesizes for that 
width which breaks the frei0r requirement that the stride matches width 
* 4 since width is now too large.

Initially I put together a patch that adds an extra parameter to 
ff_frame_pool_video_init that tells it just to use the width directly 
and not try to align it. This seemed a bit awkward though, especially 
when I tried to figure our why the code is even trying to make the width 
a multiple of the align value (which is effectively what it's doing) to 
start with. I can't make sense of why it's calling FFALIGN there at all 
and checking the commit history didn't provide any hints. If anything I 
would have thought that you would want to increase the width so that the 
final line size would be aligned, EG: FFALIGN(pool->width*4, align)/4, 
rather than the width itself.

In any case I have patches that work both ways, either an extra flag to 
not do the aligned width or the FFALIGN(pool->width*4, align)/4 fix. The 
former I'm confident of but am not so sure about the latter since I 
don't understand why it's there to start with, nor whether it may break 
other filters. The fate tests all pass with it though on my system. It 
will certainly work with frei0r though since it requires width to be a 
multiple of 8 which will always give a line size that's aligned to 16.

Any advice on which one I should submit would be great.

thanks

Brendan


_______________________________________________
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:[~2022-08-20 13:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-20 11:21 [FFmpeg-devel] framepool width and potential patch for bug 9873 Brendan Hack
2022-08-20 11:41 ` Timo Rothenpieler
     [not found]   ` <6d8d57d0-c53a-56fd-41ed-65d924d5394e@bendys.com>
2022-08-20 12:30     ` Timo Rothenpieler
2022-08-20 13:17       ` Paul B Mahol

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