From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] hevc: If hwccel avoid creation/use of s/w only arrays
Date: Wed, 01 Jun 2022 12:29:10 +0200
Message-ID: <165407935077.13099.15492448313774204226@lain> (raw)
In-Reply-To: <cil19htkrmsdp69rlil4f5a3cvkob5eqoa@4ax.com>
Quoting John Cox (2022-05-27 15:51:17)
> Hwaccel doesn't use any of the block strength, pcm, slice address, etc.
> arrays which can be >100k each for 4k video. Patch to avoid initial
> allocation and zeroing at the start of every frame. On a Pi4 the memsets
> can use 10% CPU on 4k 60Hz decode, this fixes that.
>
> Signed-off-by: John Cox <jc@kynesim.co.uk>
> ---
> libavcodec/hevc_refs.c | 35 +++++++++++++++++++++--------------
> libavcodec/hevcdec.c | 42 +++++++++++++++++++++++++++++-------------
> 2 files changed, 50 insertions(+), 27 deletions(-)
>
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index f782ea6394..48b059ce45 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -504,6 +504,16 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps,
> if (!sps)
> return 0;
>
> + // If hwaccel then we don't need all the s/w decode helper arrays
> + if (s->avctx->hwaccel) {
> + export_stream_params(s, sps);
> +
> + s->avctx->pix_fmt = pix_fmt;
> + s->ps.sps = sps;
> + s->ps.vps = (HEVCVPS*) s->ps.vps_list[s->ps.sps->vps_id]->data;
This duplication is ugly. This code should be commutative, so you can
either move it all above pic_arrays_init() and add an early return
after, or move it all to the end and jump to it with goto.
Otherwise looks reasonable.
--
Anton Khirnov
_______________________________________________
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".
prev parent reply other threads:[~2022-06-01 10:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 13:51 John Cox
2022-06-01 10:29 ` Anton Khirnov [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=165407935077.13099.15492448313774204226@lain \
--to=anton@khirnov.net \
--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