[FFmpeg-devel] PATCH: Force vaapi image formats to NV12-only
Zhao Zhili
quinkblack at foxmail.com
Fri Aug 9 06:49:54 EEST 2024
> vaapi drivers often lack proper image converesions and not all
> situations allow vagetimage or vaputimage with the image formats
> reported by the api. nv12 seems allowed in all circumstances.
>
> with this change now one can use the hwaccel directly without
> explicit conversions to nv12 for frame downloading to work.
>
> gstreamer adopted a similar approach:
> https://bugzilla.gnome.org/show_bug.cgi?id=752958
> ---
> libavutil/hwcontext_vaapi.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 12bc95119a..d678e58d07 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -418,7 +418,12 @@ static int vaapi_device_init(avhwdevicecontext *hwdev)
> for (i = 0; i < image_count; i++) {
> fourcc = image_list[i].fourcc;
> pix_fmt = vaapi_pix_fmt_from_fourcc(fourcc);
> - if (pix_fmt == av_pix_fmt_none) {
> + if (pix_fmt != av_pix_fmt_nv12) {
> + av_log(hwdev, av_log_debug, "format %#x -> ignored.\n",
> + fourcc);
> + continue;
> + }
> + else if (pix_fmt == av_pix_fmt_none) {
> av_log(hwdev, av_log_debug, "format %#x -> unknown.\n",
> fourcc);
> } else {
> --
> 2.44.1
Isn’t it break all pixel formats with bit depth > 8?
I think we already have hwcontext API to select sw_format, this isn’t a bug
inside ffmpeg.
> On Aug 9, 2024, at 02:37, Lluís Batlle i Rossell <viric at viric.name> wrote:
>
> attached
> <0001-Force-vaapi-image-formats-to-NV12-only.patch>_______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list