From: Mark Thompson <sw@jkqxz.net>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v3 2/3] lavc/decode: Add internal surface re-allocate method for hwaccel
Date: Wed, 7 Sep 2022 22:56:37 +0100
Message-ID: <9599a3fb-8cd4-b2df-366d-bf6257ea63e4@jkqxz.net> (raw)
In-Reply-To: <20220823081929.413947-2-fei.w.wang@intel.com>
On 23/08/2022 09:19, Fei Wang wrote:
> From: Linjie Fu <linjie.fu@intel.com>
>
> Add HWACCEL_CAP_INTERNAL_ALLOC flag to indicate hwaccels are able to
> re-allocate surface internally through ff_decode_get_hw_frames_ctx.
> So that hwaccels don't need to reinitialize all hw related configs
> when decode resolution change, just need to re-allocate new surface
> by using new resolution.
>
> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> libavcodec/decode.c | 36 ++++++++++++++++++++++++++++++++++++
> libavcodec/hwconfig.h | 1 +
> 2 files changed, 37 insertions(+)
You can't just not call the user get_format callback and allocate your own surfaces - this breaks direct rendering and other cases where the user wanted to manage the surfaces.
This is also missing any check that the hardware decoder supports the stream post-transition - if the decoder does not support the new size (or any other property of the new stream) then this will try to blindly decode it anyway and fail, where previously it would have correctly fallen back to software decoding.
None of these patches say what the aim is, but from reading them and seeing that VP9 is the intended target then I am guessing that this is intended to support the case where the stream resizes while still using previous reference frames - is that right?
If my guess is correct, I think you should (a) mention that fact in the patches, and (b) target the support at specifically that case, and not try to mess with any other reinit cases.
Something like: if you know you are in that case (the decoder itself has this information and could pass it to ff_get_format somehow) and the context supports it (I am still unclear how this support can be determined - the libva documentation is very clear that a context is tied to a particular height/width), then remember the context across the user get_format call and if things match up then re-use it.
If for some reason you are in that case but it can't work (e.g. because the new size isn't supported by the hardware), then you need a better error message - the stream is actually broken because most frames are not decodable until you reach another recovery point (since the reference frames are in hardware surfaces so the software decoder can't use them).
- Mark
_______________________________________________
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".
next prev parent reply other threads:[~2022-09-07 21:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 8:19 [FFmpeg-devel] [PATCH v3 1/3] lavc/decode: Warp get_hw_config function Fei Wang
2022-08-23 8:19 ` [FFmpeg-devel] [PATCH v3 2/3] lavc/decode: Add internal surface re-allocate method for hwaccel Fei Wang
2022-09-07 21:56 ` Mark Thompson [this message]
2022-09-19 6:09 ` Wang, Fei W
2022-11-08 11:58 ` Wang, Fei W
2022-08-23 8:19 ` [FFmpeg-devel] [PATCH v3 3/3] lavc/vaapi_vp9: add surface internal re-allocation capability Fei Wang
2022-08-31 1:20 ` [FFmpeg-devel] [PATCH v3 1/3] lavc/decode: Warp get_hw_config function Wang, Fei W
2022-09-07 8:47 ` Xiang, Haihao
2022-09-07 22:13 ` Mark Thompson
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=9599a3fb-8cd4-b2df-366d-bf6257ea63e4@jkqxz.net \
--to=sw@jkqxz.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