v4l2codecs: vp9dec: Implement VP9 v4l2 decoder

Implement a v4l2 based vp9 decoder element based on the preexisting vp8
v4l2 decoder.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1012>
This commit is contained in:
Daniel Almeida 2021-03-30 13:30:46 -03:00 committed by GStreamer Marge Bot
parent c51d74ae3a
commit ccab90773f
6 changed files with 1171 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
/* GStreamer
* Copyright (C) 2021 Daniel Almeida <daniel.almeida@collabora.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 the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_V4L2_CODEC_VP9_DEC_H__
#define __GST_V4L2_CODEC_VP9_DEC_H__
#define GST_USE_UNSTABLE_API
#include <gst/codecs/gstvp9decoder.h>
#include "gstv4l2decoder.h"
G_BEGIN_DECLS
#define GST_TYPE_V4L2_CODEC_VP9_DEC (gst_v4l2_codec_vp9_dec_get_type())
#define GST_V4L2_CODEC_VP9_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_V4L2_CODEC_VP9_DEC,GstV4l2CodecVp9Dec))
#define GST_V4L2_CODEC_VP9_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_V4L2_CODEC_VP9_DEC,GstV4l2CodecVp9DecClass))
#define GST_V4L2_CODEC_VP9_DEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_V4L2_CODEC_VP9_DEC, GstV4l2CodecVp9DecClass))
#define GST_IS_V4L2_CODEC_VP9_DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_V4L2_CODEC_VP9_DEC))
#define GST_IS_V4L2_CODEC_VP9_DEC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_V4L2_CODEC_VP9_DEC))
typedef struct _GstV4l2CodecVp9Dec GstV4l2CodecVp9Dec;
typedef struct _GstV4l2CodecVp9DecClass GstV4l2CodecVp9DecClass;
struct _GstV4l2CodecVp9DecClass
{
GstVp9DecoderClass parent_class;
GstV4l2CodecDevice *device;
};
GType gst_v4l2_codec_vp9_dec_get_type (void);
void gst_v4l2_codec_vp9_dec_register (GstPlugin * plugin,
GstV4l2CodecDevice * device,
guint rank);
G_END_DECLS
#endif /* __GST_V4L2_CODEC_VP9_DEC_H__ */

View file

@ -35,6 +35,7 @@ static struct FormatEntry format_map[] = {
{V4L2_PIX_FMT_NV12, 1, GST_VIDEO_FORMAT_NV12, 8, 420},
{V4L2_PIX_FMT_YUYV, 1, GST_VIDEO_FORMAT_YUY2, 8, 422},
{V4L2_PIX_FMT_SUNXI_TILED_NV12, 1, GST_VIDEO_FORMAT_NV12_32L32, 8, 422},
{V4L2_PIX_FMT_NV12_4L4, 1, GST_VIDEO_FORMAT_NV12_4L4, 8, 420},
{0,}
};
@ -77,6 +78,7 @@ extrapolate_stride (const GstVideoFormatInfo * finfo, gint plane, gint stride)
switch (finfo->format) {
case GST_VIDEO_FORMAT_NV12:
case GST_VIDEO_FORMAT_NV12_4L4:
case GST_VIDEO_FORMAT_NV12_32L32:
case GST_VIDEO_FORMAT_NV12_64Z32:
case GST_VIDEO_FORMAT_NV16:

View file

@ -599,6 +599,7 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
#define V4L2_PIX_FMT_NV12_4L4 v4l2_fourcc('V', 'T', '1', '2') /* 8 YUV 4:2:0 4x4 macroblocks */
/* two non contiguous planes - one Y, one Cr + Cb interleaved */
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */

View file

@ -6,6 +6,7 @@ v4l2codecs_sources = [
'gstv4l2codecmpeg2dec.c',
'gstv4l2codecpool.c',
'gstv4l2codecvp8dec.c',
'gstv4l2codecvp9dec.c',
'gstv4l2decoder.c',
'gstv4l2format.c',
'gstv4l2codecalphadecodebin.c',

View file

@ -26,6 +26,7 @@
#include "gstv4l2codech264dec.h"
#include "gstv4l2codecmpeg2dec.h"
#include "gstv4l2codecvp8dec.h"
#include "gstv4l2codecvp9dec.h"
#include "gstv4l2decoder.h"
#include "linux/v4l2-controls.h"
#include "linux/media.h"
@ -65,6 +66,11 @@ register_video_decoder (GstPlugin * plugin, GstV4l2CodecDevice * device)
gst_v4l2_codec_mpeg2_dec_register (plugin, device,
GST_RANK_PRIMARY + 1);
break;
case V4L2_PIX_FMT_VP9_FRAME:
GST_INFO_OBJECT (decoder, "Registering %s as VP9 Decoder",
device->name);
gst_v4l2_codec_vp9_dec_register (plugin, device, GST_RANK_PRIMARY + 1);
break;
default:
GST_FIXME_OBJECT (decoder, "%" GST_FOURCC_FORMAT " is not supported.",