VA: Add the vaav1dec element as the av1 decoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1636>
This commit is contained in:
He Junyan 2021-01-19 15:36:29 +08:00
parent a119a940e4
commit e15be4cf0f
6 changed files with 1062 additions and 2 deletions

1008
sys/va/gstvaav1dec.c Normal file

File diff suppressed because it is too large Load diff

33
sys/va/gstvaav1dec.h Normal file
View file

@ -0,0 +1,33 @@
/* GStreamer
* Copyright (C) 2020 Intel Corporation
* Author: He Junyan <junyan.he@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the0
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#pragma once
#include "gstvadevice.h"
G_BEGIN_DECLS
gboolean gst_va_av1_dec_register (GstPlugin * plugin,
GstVaDevice * device,
GstCaps * sink_caps,
GstCaps * src_caps,
guint rank);
G_END_DECLS

View file

@ -26,6 +26,7 @@
#include <gst/codecs/gstmpeg2decoder.h> #include <gst/codecs/gstmpeg2decoder.h>
#include <gst/codecs/gstvp8decoder.h> #include <gst/codecs/gstvp8decoder.h>
#include <gst/codecs/gstvp9decoder.h> #include <gst/codecs/gstvp9decoder.h>
#include <gst/codecs/gstav1decoder.h>
#include "gstvadevice.h" #include "gstvadevice.h"
#include "gstvadecoder.h" #include "gstvadecoder.h"
@ -50,6 +51,7 @@ struct _GstVaBaseDec
GstMpeg2Decoder mpeg2; GstMpeg2Decoder mpeg2;
GstVp8Decoder vp8; GstVp8Decoder vp8;
GstVp9Decoder vp9; GstVp9Decoder vp9;
GstAV1Decoder av1;
} parent; } parent;
GstDebugCategory *debug_category; GstDebugCategory *debug_category;
@ -83,6 +85,7 @@ struct _GstVaBaseDecClass
GstMpeg2DecoderClass mpeg2; GstMpeg2DecoderClass mpeg2;
GstVp8DecoderClass vp8; GstVp8DecoderClass vp8;
GstVp9DecoderClass vp9; GstVp9DecoderClass vp9;
GstAV1DecoderClass av1;
} parent_class; } parent_class;
GstVaCodecs codec; GstVaCodecs codec;

View file

@ -87,8 +87,8 @@ static const struct ProfileMap
P (HEVC, SccMain444, "video/x-h265", P (HEVC, SccMain444, "video/x-h265",
"profile = (string) screen-extended-main-444"), "profile = (string) screen-extended-main-444"),
#if VA_CHECK_VERSION(1,7,0) #if VA_CHECK_VERSION(1,7,0)
P (AV1, Profile0, "video/x-av1", NULL), P (AV1, Profile0, "video/x-av1", "profile = (string) 0"),
P (AV1, Profile1, "video/x-av1", NULL), P (AV1, Profile1, "video/x-av1", "profile = (string) 1"),
#endif #endif
#if VA_CHECK_VERSION(1, 8, 0) #if VA_CHECK_VERSION(1, 8, 0)
P (HEVC, SccMain444_10, "video/x-h265", P (HEVC, SccMain444_10, "video/x-h265",

View file

@ -35,6 +35,12 @@ libgudev_dep = dependency('gudev-1.0', required: va_option)
libdrm_dep = dependency('libdrm', required: false, libdrm_dep = dependency('libdrm', required: false,
fallback: ['libdrm', 'ext_libdrm']) fallback: ['libdrm', 'ext_libdrm'])
libva_av1_req = ['>= 1.8']
libva_av1_dep = dependency('libva', version: libva_av1_req, required: va_option)
if libva_av1_dep.found()
va_sources += 'gstvaav1dec.c'
endif
have_va = libva_dep.found() and libva_drm_dep.found() have_va = libva_dep.found() and libva_drm_dep.found()
if not (have_va and libgudev_dep.found()) if not (have_va and libgudev_dep.found())
if va_option.enabled() if va_option.enabled()

View file

@ -35,6 +35,7 @@
#include "gstvaprofile.h" #include "gstvaprofile.h"
#include "gstvavp8dec.h" #include "gstvavp8dec.h"
#include "gstvavp9dec.h" #include "gstvavp9dec.h"
#include "gstvaav1dec.h"
#include "gstvavpp.h" #include "gstvavpp.h"
#define GST_CAT_DEFAULT gstva_debug #define GST_CAT_DEFAULT gstva_debug
@ -128,6 +129,15 @@ plugin_register_decoders (GstPlugin * plugin, GstVaDevice * device,
device->render_device_path); device->render_device_path);
} }
break; break;
#if VA_CHECK_VERSION(1, 8, 0)
case AV1:
if (!gst_va_av1_dec_register (plugin, device, sinkcaps, srccaps,
GST_RANK_NONE)) {
GST_WARNING ("Failed to register AV1 decoder: %s",
device->render_device_path);
}
break;
#endif
default: default:
GST_DEBUG ("No decoder implementation for %" GST_FOURCC_FORMAT, GST_DEBUG ("No decoder implementation for %" GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec)); GST_FOURCC_ARGS (codec));