Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Niklas Haas via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Niklas Haas <ffmpeg@haasn.xyz>
Subject: [FFmpeg-devel] Re: [RFC] performance tuning, memcpy
Date: Tue, 11 Nov 2025 00:17:04 +0000
Message-ID: <176282022982.7.16932805960141624204.999720828@haasn.xyz> (raw)
In-Reply-To: <AS8PR05MB8741D752AC0AFA4C226655E8EAC5A@AS8PR05MB8741.eurprd05.prod.outlook.com>

On Monday, November 10th, 2025 at 3:09 PM, Thilo Schunck via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> wrote:

> 
> 
> Hi Team!
> 
> Apologies for maybe breaking submit rules but as of now I don't know better :-)
> 
> I figured out on arm "hwdownload" is quite slow.
> I turns out this is caused by imgutils.c image_copy_plane which does a memcpy loop
> 
> for (;height > 0; height--) {
> 
> 
> memcpy(dst, src, bytewidth);
> 
> dst += dst_linesize;
> src += src_linesize;
> }
> 
> As a POC, quick'n dirty I create 4 threads and split the copy. In my case this improved fps from about ~26 to 51
> 
> ./ffmpeg -hide_banner -hwaccel v4l2request -hwaccel_output_format drm_prime \
> -threads 4 \
> -i ../Big_Buck_Bunny_720_10s_10MB.mp4 \
> -filter_complex "[0:v]hwdownload,format=nv12[myOut]" -map "[myOut]" \
> -f null -
> 
> Maybe someone is interested in this improvement with cleaned code.
> My PoC uses hard coded 4 threads which is for sure bad ...

I could see `hwcontext_drm` specifically using an internal `AVSliceThread` for `RAM<->VRAM` transfers. We have to be careful about thread safety, though, as `av_hwframe_transfer_data` may be called from multiple threads. So in the worst case, we need to create and tear down the `AVSliceThread` per frame being transferred..

As a possible alternative, `vf_hwdownload` could become frame-threaded, though that would only improve throughput, not latency.

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

      reply	other threads:[~2025-11-11  0:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05  7:48 [FFmpeg-devel] " Thilo Schunck via ffmpeg-devel
2025-11-11  0:17 ` Niklas Haas via ffmpeg-devel [this message]

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=176282022982.7.16932805960141624204.999720828@haasn.xyz \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=ffmpeg@haasn.xyz \
    /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