2348 lines
76 KiB
Diff
2348 lines
76 KiB
Diff
diff -ruN old/config/bellagio/gstomx.conf new/config/bellagio/gstomx.conf
|
|
--- old/config/bellagio/gstomx.conf 2024-03-01 06:08:33.008164305 +0300
|
|
+++ new/config/bellagio/gstomx.conf 2024-04-04 22:45:14.427943010 +0300
|
|
@@ -1,60 +1,17 @@
|
|
-[omxmpeg4videodec]
|
|
-type-name=GstOMXMPEG4VideoDec
|
|
-core-name=/usr/local/lib/libomxil-bellagio.so.0
|
|
-component-name=OMX.st.video_decoder.mpeg4
|
|
-rank=257
|
|
+[omxvp9dec]
|
|
+type-name=GstOMXVP9Dec
|
|
+core-name=/usr/lib/libomxil-bellagio.so
|
|
+component-name=OMX.hantro.G2.video.decoder.vp9
|
|
+rank=260
|
|
in-port-index=0
|
|
out-port-index=1
|
|
-hacks=event-port-settings-changed-ndata-parameter-swap;event-port-settings-changed-port-0-to-1
|
|
+hacks=no-disable-outport
|
|
|
|
-[omxh264dec]
|
|
-type-name=GstOMXH264Dec
|
|
-core-name=/usr/local/lib/libomxil-bellagio.so.0
|
|
-component-name=OMX.st.video_decoder.avc
|
|
-rank=257
|
|
-in-port-index=0
|
|
-out-port-index=1
|
|
-hacks=event-port-settings-changed-ndata-parameter-swap;event-port-settings-changed-port-0-to-1
|
|
-
|
|
-[omxmpeg4videoenc]
|
|
-type-name=GstOMXMPEG4VideoEnc
|
|
-core-name=/usr/local/lib/libomxil-bellagio.so.0
|
|
-component-name=OMX.st.video_encoder.mpeg4
|
|
-rank=0
|
|
-in-port-index=0
|
|
-out-port-index=1
|
|
-hacks=event-port-settings-changed-ndata-parameter-swap;video-framerate-integer;syncframe-flag-not-used
|
|
-
|
|
-[omxaacenc]
|
|
-type-name=GstOMXAACEnc
|
|
-core-name=/usr/local/lib/libomxil-bellagio.so.0
|
|
-component-name=OMX.st.audio_encoder.aac
|
|
-rank=0
|
|
-in-port-index=0
|
|
-out-port-index=1
|
|
-hacks=event-port-settings-changed-ndata-parameter-swap
|
|
-
|
|
-[omxmp3dec]
|
|
-type-name=GstOMXMP3Dec
|
|
-core-name=/usr/lib/libomxil-bellagio.so.0
|
|
-component-name=OMX.st.audio_decoder.mp3.mad
|
|
-rank=0
|
|
-in-port-index=0
|
|
-out-port-index=1
|
|
-hacks=event-port-settings-changed-ndata-parameter-swap;no-component-role;no-disable-outport;drain-may-not-return
|
|
-
|
|
-[omxh264dec]
|
|
-type-name=GstOMXH264Dec
|
|
-core-name=/usr/lib/libomxil-bellagio.so.0
|
|
-component-name=OMX.mesa.video_decoder.avc
|
|
-rank=0
|
|
-in-port-index=0
|
|
-out-port-index=1
|
|
-
|
|
-[omxmpeg2dec]
|
|
-type-name=GstOMXMPEG2VideoDec
|
|
-core-name=/usr/lib/libomxil-bellagio.so.0
|
|
-component-name=OMX.mesa.video_decoder.mpeg2
|
|
-rank=0
|
|
+[omxvp9enc]
|
|
+type-name=GstOMXVP9Enc
|
|
+core-name=/usr/lib/libomxil-bellagio.so
|
|
+component-name=OMX.hantro.g2.video.encoder.vp9
|
|
+rank=260
|
|
in-port-index=0
|
|
out-port-index=1
|
|
+hacks=no-disable-outport
|
|
diff -ruN old/meson.build new/meson.build
|
|
--- old/meson.build 2024-03-01 06:08:33.032164304 +0300
|
|
+++ new/meson.build 2024-04-04 23:18:13.099874211 +0300
|
|
@@ -310,7 +310,7 @@
|
|
endif
|
|
|
|
have_omx_hevc = cc.has_header_symbol(
|
|
- 'OMX_Video.h',
|
|
+ 'OMX_VideoExt.h',
|
|
'OMX_VIDEO_CodingHEVC',
|
|
prefix : extra_video_headers,
|
|
args : gst_omx_args,
|
|
diff -ruN old/omx/gstomx.c new/omx/gstomx.c
|
|
--- old/omx/gstomx.c 2024-03-01 06:08:33.036164304 +0300
|
|
+++ new/omx/gstomx.c 2024-03-01 07:24:36.432005632 +0300
|
|
@@ -36,6 +36,8 @@
|
|
#include "gstomxh263dec.h"
|
|
#include "gstomxh265dec.h"
|
|
#include "gstomxvp8dec.h"
|
|
+#include "gstomxvp9dec.h"
|
|
+#include "gstomxvp9enc.h"
|
|
#include "gstomxtheoradec.h"
|
|
#include "gstomxwmvdec.h"
|
|
#include "gstomxmpeg4videoenc.h"
|
|
@@ -1979,6 +1981,23 @@
|
|
}
|
|
|
|
OMX_ERRORTYPE
|
|
+gst_omx_component_get_index (GstOMXComponent * comp, gpointer str,
|
|
+ OMX_INDEXTYPE * index)
|
|
+{
|
|
+ OMX_ERRORTYPE err;
|
|
+ g_return_val_if_fail (comp != NULL, OMX_ErrorUndefined);
|
|
+ g_return_val_if_fail (index != NULL, OMX_ErrorUndefined);
|
|
+
|
|
+ GST_DEBUG_OBJECT (comp->parent, "Getting %s Extension index for %s",
|
|
+ comp->name, (char *) str);
|
|
+ err = OMX_GetExtensionIndex (comp->handle, str, index);
|
|
+ GST_DEBUG_OBJECT (comp->parent, "Got %s Extension index for %s: %s "
|
|
+ "(0x%08x)", comp->name, (char *) str, gst_omx_error_to_string (err), err);
|
|
+
|
|
+ return err;
|
|
+}
|
|
+
|
|
+OMX_ERRORTYPE
|
|
gst_omx_setup_tunnel (GstOMXPort * port1, GstOMXPort * port2)
|
|
{
|
|
GstOMXComponent *comp1;
|
|
@@ -3527,6 +3546,7 @@
|
|
#ifdef HAVE_VP8
|
|
, gst_omx_vp8_dec_get_type
|
|
#endif
|
|
+ , gst_omx_vp9_dec_get_type, gst_omx_vp9_enc_get_type
|
|
#ifdef HAVE_THEORA
|
|
, gst_omx_theora_dec_get_type
|
|
#endif
|
|
diff -ruN old/omx/gstomxvideo.c new/omx/gstomxvideo.c
|
|
--- old/omx/gstomxvideo.c 2024-03-01 06:08:33.092164302 +0300
|
|
+++ new/omx/gstomxvideo.c 2024-03-01 06:42:49.384092804 +0300
|
|
@@ -27,6 +27,7 @@
|
|
#endif
|
|
|
|
#include "gstomxvideo.h"
|
|
+#include "gstomxvp9enc.h"
|
|
|
|
#include <math.h>
|
|
|
|
@@ -51,6 +52,9 @@
|
|
case OMX_COLOR_FormatYUV420PackedSemiPlanar:
|
|
format = GST_VIDEO_FORMAT_NV12;
|
|
break;
|
|
+ case OMX_COLOR_FormatYVU420SemiPlanar:
|
|
+ format = GST_VIDEO_FORMAT_NV21;
|
|
+ break;
|
|
case OMX_COLOR_FormatYUV422SemiPlanar:
|
|
format = GST_VIDEO_FORMAT_NV16;
|
|
break;
|
|
@@ -70,8 +74,10 @@
|
|
format = GST_VIDEO_FORMAT_ABGR;
|
|
break;
|
|
case OMX_COLOR_Format32bitBGRA8888:
|
|
- /* Same issue as OMX_COLOR_Format32bitARGB8888 */
|
|
- format = GST_VIDEO_FORMAT_ARGB;
|
|
+ format = GST_VIDEO_FORMAT_BGRA;
|
|
+ break;
|
|
+ case OMX_COLOR_Format32bitRGBA8888:
|
|
+ format = GST_VIDEO_FORMAT_RGBA;
|
|
break;
|
|
case OMX_COLOR_Format16bitRGB565:
|
|
format = GST_VIDEO_FORMAT_RGB16;
|
|
diff -ruN old/omx/gstomxvideo.h new/omx/gstomxvideo.h
|
|
--- old/omx/gstomxvideo.h 2024-03-01 06:08:33.092164302 +0300
|
|
+++ new/omx/gstomxvideo.h 2024-03-01 06:30:47.104117918 +0300
|
|
@@ -38,8 +38,8 @@
|
|
#define GST_OMX_VIDEO_DEC_SUPPORTED_FORMATS "{ NV16_10LE32, NV12_10LE32, " \
|
|
"NV16, YUY2, YVYU, UYVY, NV12, I420, RGB16, BGR16, ABGR, ARGB, GRAY8 }"
|
|
|
|
-#define GST_OMX_VIDEO_ENC_SUPPORTED_FORMATS "{ NV16_10LE32, NV12_10LE32, " \
|
|
- "NV16, NV12, I420, GRAY8 }"
|
|
+#define GST_OMX_VIDEO_ENC_SUPPORTED_FORMATS "{ RGBA, BGRA, NV16_10LE32, " \
|
|
+ "NV12_10LE32, NV16, YUY2, UYVY, NV12, NV21, I420, GRAY8 }"
|
|
|
|
typedef struct
|
|
{
|
|
diff -ruN old/omx/gstomxvideoenc.c new/omx/gstomxvideoenc.c
|
|
--- old/omx/gstomxvideoenc.c 2024-03-01 06:08:33.088164302 +0300
|
|
+++ new/omx/gstomxvideoenc.c 2024-03-01 06:36:59.548104968 +0300
|
|
@@ -31,6 +31,7 @@
|
|
#include "gstomxbufferpool.h"
|
|
#include "gstomxvideo.h"
|
|
#include "gstomxvideoenc.h"
|
|
+#include "gstomxvp9enc.h"
|
|
|
|
#ifdef USE_OMX_TARGET_RPI
|
|
#include <OMX_Broadcom.h>
|
|
@@ -1391,6 +1392,7 @@
|
|
break;
|
|
case GST_VIDEO_FORMAT_I420:
|
|
case GST_VIDEO_FORMAT_NV12:
|
|
+ case GST_VIDEO_FORMAT_NV21:
|
|
*chroma_format = "4:2:0";
|
|
*bit_depth_luma = *bit_depth_chroma = 8;
|
|
break;
|
|
@@ -1474,6 +1476,9 @@
|
|
gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps,
|
|
self->input_state);
|
|
state->codec_data = codec_data;
|
|
+ GstVideoInfo *info = &state->info;
|
|
+ info->width = port->port_def.format.video.nFrameWidth;
|
|
+ info->height = port->port_def.format.video.nFrameWidth;
|
|
gst_video_codec_state_unref (state);
|
|
if (!gst_video_encoder_negotiate (GST_VIDEO_ENCODER (self))) {
|
|
gst_video_codec_frame_unref (frame);
|
|
@@ -1518,7 +1523,12 @@
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
}
|
|
|
|
- if (frame) {
|
|
+ gboolean invisible = (buf->omx_buf->nFlags & OMX_BUFFERFLAG_DECODEONLY) != 0;
|
|
+
|
|
+ if (invisible) {
|
|
+ GST_DEBUG_OBJECT (self, "Handling invisible frame");
|
|
+ flow_ret = gst_pad_push (GST_VIDEO_ENCODER_SRC_PAD (self), outbuf);
|
|
+ } else if (frame) {
|
|
frame->output_buffer = outbuf;
|
|
if ((buf->omx_buf->nFlags & OMX_BUFFERFLAG_ENDOFFRAME)
|
|
|| !gst_omx_port_get_subframe (self->enc_out_port)) {
|
|
@@ -1653,6 +1663,9 @@
|
|
state =
|
|
gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps,
|
|
self->input_state);
|
|
+ GstVideoInfo *info = &state->info;
|
|
+ info->width = port->port_def.format.video.nFrameWidth;
|
|
+ info->height = port->port_def.format.video.nFrameHeight;
|
|
gst_video_codec_state_unref (state);
|
|
|
|
if (!gst_video_encoder_negotiate (GST_VIDEO_ENCODER (self))) {
|
|
@@ -2045,6 +2058,7 @@
|
|
|
|
case OMX_COLOR_FormatYUV420PackedSemiPlanar:
|
|
case OMX_COLOR_FormatYUV420SemiPlanar:
|
|
+ case OMX_COLOR_FormatYVU420SemiPlanar:
|
|
port_def.nBufferSize =
|
|
(port_def.format.video.nStride * port_def.format.video.nFrameHeight) +
|
|
(port_def.format.video.nStride *
|
|
@@ -2052,6 +2066,10 @@
|
|
break;
|
|
|
|
case OMX_COLOR_FormatL8:
|
|
+ case OMX_COLOR_Format32bitBGRA8888:
|
|
+ case OMX_COLOR_Format32bitRGBA8888:
|
|
+ case OMX_COLOR_FormatYCbYCr:
|
|
+ case OMX_COLOR_FormatCbYCrY:
|
|
port_def.nBufferSize =
|
|
port_def.format.video.nStride * port_def.format.video.nFrameHeight;
|
|
break;
|
|
@@ -2525,15 +2543,27 @@
|
|
case GST_VIDEO_FORMAT_NV12:
|
|
port_def.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
|
|
break;
|
|
+ case GST_VIDEO_FORMAT_NV21:
|
|
+ port_def.format.video.eColorFormat = OMX_COLOR_FormatYVU420SemiPlanar;
|
|
+ break;
|
|
case GST_VIDEO_FORMAT_NV16:
|
|
port_def.format.video.eColorFormat = OMX_COLOR_FormatYUV422SemiPlanar;
|
|
break;
|
|
+ case GST_VIDEO_FORMAT_YUY2:
|
|
+ port_def.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr;
|
|
+ break;
|
|
+ case GST_VIDEO_FORMAT_UYVY:
|
|
+ port_def.format.video.eColorFormat = OMX_COLOR_FormatCbYCrY;
|
|
+ break;
|
|
case GST_VIDEO_FORMAT_ABGR:
|
|
port_def.format.video.eColorFormat = OMX_COLOR_Format32bitARGB8888;
|
|
break;
|
|
- case GST_VIDEO_FORMAT_ARGB:
|
|
+ case GST_VIDEO_FORMAT_BGRA:
|
|
port_def.format.video.eColorFormat = OMX_COLOR_Format32bitBGRA8888;
|
|
break;
|
|
+ case GST_VIDEO_FORMAT_RGBA:
|
|
+ port_def.format.video.eColorFormat = OMX_COLOR_Format32bitRGBA8888;
|
|
+ break;
|
|
default:
|
|
GST_ERROR_OBJECT (self, "Unsupported format %s",
|
|
gst_video_format_to_string (info->finfo->format));
|
|
@@ -2574,6 +2604,16 @@
|
|
&port_def) != OMX_ErrorNone)
|
|
return FALSE;
|
|
|
|
+ gst_omx_port_get_port_definition (self->enc_out_port, &port_def);
|
|
+
|
|
+ port_def.format.video.nFrameWidth = info->width;
|
|
+ port_def.format.video.nFrameHeight = GST_VIDEO_INFO_FIELD_HEIGHT (info);
|
|
+
|
|
+ GST_DEBUG_OBJECT (self, "Setting outport port definition");
|
|
+ if (gst_omx_port_update_port_definition (self->enc_out_port,
|
|
+ &port_def) != OMX_ErrorNone)
|
|
+ return FALSE;
|
|
+
|
|
#ifdef USE_OMX_TARGET_RPI
|
|
/* aspect ratio */
|
|
{
|
|
@@ -2827,7 +2867,7 @@
|
|
}
|
|
|
|
/* Same strides and everything */
|
|
- if ((gst_buffer_get_size (inbuf) ==
|
|
+ if ((gst_buffer_get_size (inbuf) <=
|
|
outbuf->omx_buf->nAllocLen - outbuf->omx_buf->nOffset) &&
|
|
(stride == port_def->format.video.nStride)) {
|
|
outbuf->omx_buf->nFilledLen = gst_buffer_get_size (inbuf);
|
|
@@ -2914,6 +2954,7 @@
|
|
break;
|
|
}
|
|
case GST_VIDEO_FORMAT_NV12:
|
|
+ case GST_VIDEO_FORMAT_NV21:
|
|
case GST_VIDEO_FORMAT_NV16:
|
|
case GST_VIDEO_FORMAT_NV12_10LE32:
|
|
case GST_VIDEO_FORMAT_NV16_10LE32:
|
|
@@ -2921,6 +2962,19 @@
|
|
gst_omx_video_enc_semi_planar_manual_copy (self, inbuf, outbuf,
|
|
info->finfo);
|
|
break;
|
|
+ case GST_VIDEO_FORMAT_YUY2:
|
|
+ case GST_VIDEO_FORMAT_UYVY:
|
|
+ case GST_VIDEO_FORMAT_BGRA:
|
|
+ case GST_VIDEO_FORMAT_RGBA:
|
|
+ {
|
|
+ outbuf->omx_buf->nFilledLen = gst_buffer_get_size (inbuf);
|
|
+
|
|
+ gst_buffer_extract (inbuf, 0,
|
|
+ outbuf->omx_buf->pBuffer + outbuf->omx_buf->nOffset,
|
|
+ outbuf->omx_buf->nFilledLen);
|
|
+ ret = TRUE;
|
|
+ }
|
|
+ break;
|
|
case GST_VIDEO_FORMAT_GRAY8:
|
|
{
|
|
if (!gst_video_frame_map (&frame, info, inbuf, GST_MAP_READ)) {
|
|
@@ -3544,10 +3598,15 @@
|
|
switch (nmap->format) {
|
|
case GST_VIDEO_FORMAT_I420:
|
|
case GST_VIDEO_FORMAT_NV12:
|
|
+ case GST_VIDEO_FORMAT_NV21:
|
|
case GST_VIDEO_FORMAT_NV12_10LE32:
|
|
case GST_VIDEO_FORMAT_NV16:
|
|
case GST_VIDEO_FORMAT_NV16_10LE32:
|
|
+ case GST_VIDEO_FORMAT_YUY2:
|
|
+ case GST_VIDEO_FORMAT_UYVY:
|
|
case GST_VIDEO_FORMAT_GRAY8:
|
|
+ case GST_VIDEO_FORMAT_BGRA:
|
|
+ case GST_VIDEO_FORMAT_RGBA:
|
|
cur = g_list_next (cur);
|
|
continue;
|
|
default:
|
|
diff -ruN old/omx/gstomxvp9dec.c new/omx/gstomxvp9dec.c
|
|
--- old/omx/gstomxvp9dec.c 1970-01-01 03:00:00.000000000 +0300
|
|
+++ new/omx/gstomxvp9dec.c 2024-03-01 06:33:40.944111873 +0300
|
|
@@ -0,0 +1,78 @@
|
|
+#ifdef HAVE_CONFIG_H
|
|
+#include "config.h"
|
|
+#endif
|
|
+
|
|
+#include <gst/gst.h>
|
|
+
|
|
+#include "gstomxvp9dec.h"
|
|
+
|
|
+GST_DEBUG_CATEGORY_STATIC (gst_omx_vp9_dec_debug_category);
|
|
+#define GST_CAT_DEFAULT gst_omx_vp9_dec_debug_category
|
|
+
|
|
+/* prototypes */
|
|
+static gboolean gst_omx_vp9_dec_is_format_change (GstOMXVideoDec * dec,
|
|
+ GstOMXPort * port, GstVideoCodecState * state);
|
|
+static gboolean gst_omx_vp9_dec_set_format (GstOMXVideoDec * dec,
|
|
+ GstOMXPort * port, GstVideoCodecState * state);
|
|
+
|
|
+enum
|
|
+{
|
|
+ PROP_0
|
|
+};
|
|
+
|
|
+/* class initialization */
|
|
+
|
|
+#define DEBUG_INIT \
|
|
+ GST_DEBUG_CATEGORY_INIT (gst_omx_vp9_dec_debug_category, "omxvp9dec", 0, \
|
|
+ "debug category for gst-omx video decoder base class");
|
|
+
|
|
+G_DEFINE_TYPE_WITH_CODE (GstOMXVP9Dec, gst_omx_vp9_dec,
|
|
+ GST_TYPE_OMX_VIDEO_DEC, DEBUG_INIT);
|
|
+
|
|
+static void
|
|
+gst_omx_vp9_dec_class_init (GstOMXVP9DecClass * klass)
|
|
+{
|
|
+ GstOMXVideoDecClass *videodec_class = GST_OMX_VIDEO_DEC_CLASS (klass);
|
|
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
+
|
|
+ videodec_class->is_format_change =
|
|
+ GST_DEBUG_FUNCPTR (gst_omx_vp9_dec_is_format_change);
|
|
+ videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_vp9_dec_set_format);
|
|
+
|
|
+ videodec_class->cdata.default_sink_template_caps = "video/x-vp9, "
|
|
+ "width=(int) [180,4096], " "height=(int) [180,2304]";
|
|
+
|
|
+ gst_element_class_set_static_metadata (element_class,
|
|
+ "OpenMAX VP9 Video Decoder",
|
|
+ "Codec/Decoder/Video",
|
|
+ "Decode VP9 video streams",
|
|
+ "MCST");
|
|
+
|
|
+ gst_omx_set_default_role (&videodec_class->cdata, "video_decoder.vp9");
|
|
+}
|
|
+
|
|
+static void
|
|
+gst_omx_vp9_dec_init (GstOMXVP9Dec * self)
|
|
+{
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+gst_omx_vp9_dec_is_format_change (GstOMXVideoDec * dec,
|
|
+ GstOMXPort * port, GstVideoCodecState * state)
|
|
+{
|
|
+ return FALSE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+gst_omx_vp9_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port,
|
|
+ GstVideoCodecState * state)
|
|
+{
|
|
+ gboolean ret;
|
|
+ OMX_PARAM_PORTDEFINITIONTYPE port_def;
|
|
+
|
|
+ gst_omx_port_get_port_definition (port, &port_def);
|
|
+ port_def.format.video.eCompressionFormat = OMX_VIDEO_CodingVP9;
|
|
+ ret = gst_omx_port_update_port_definition (port, &port_def) == OMX_ErrorNone;
|
|
+
|
|
+ return ret;
|
|
+}
|
|
diff -ruN old/omx/gstomxvp9dec.h new/omx/gstomxvp9dec.h
|
|
--- old/omx/gstomxvp9dec.h 1970-01-01 03:00:00.000000000 +0300
|
|
+++ new/omx/gstomxvp9dec.h 2024-03-01 06:33:40.944111873 +0300
|
|
@@ -0,0 +1,36 @@
|
|
+#ifndef __GST_OMX_VP9_DEC_H__
|
|
+#define __GST_OMX_VP9_DEC_H__
|
|
+
|
|
+#include <gst/gst.h>
|
|
+#include "gstomxvideodec.h"
|
|
+
|
|
+G_BEGIN_DECLS
|
|
+#define GST_TYPE_OMX_VP9_DEC \
|
|
+ (gst_omx_vp9_dec_get_type())
|
|
+#define GST_OMX_VP9_DEC(obj) \
|
|
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_VP9_DEC,GstOMXVP9Dec))
|
|
+#define GST_OMX_VP9_DEC_CLASS(klass) \
|
|
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_VP9_DEC,GstOMXVP9DecClass))
|
|
+#define GST_OMX_VP9_DEC_GET_CLASS(obj) \
|
|
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_VP9_DEC,GstOMXVP9DecClass))
|
|
+#define GST_IS_OMX_VP9_DEC(obj) \
|
|
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_VP9_DEC))
|
|
+#define GST_IS_OMX_VP9_DEC_CLASS(obj) \
|
|
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_VP9_DEC))
|
|
+typedef struct _GstOMXVP9Dec GstOMXVP9Dec;
|
|
+typedef struct _GstOMXVP9DecClass GstOMXVP9DecClass;
|
|
+
|
|
+struct _GstOMXVP9Dec
|
|
+{
|
|
+ GstOMXVideoDec parent;
|
|
+};
|
|
+
|
|
+struct _GstOMXVP9DecClass
|
|
+{
|
|
+ GstOMXVideoDecClass parent_class;
|
|
+};
|
|
+
|
|
+GType gst_omx_vp9_dec_get_type (void);
|
|
+
|
|
+G_END_DECLS
|
|
+#endif /* __GST_OMX_VP9_DEC_H__ */
|
|
diff -ruN old/omx/gstomxvp9enc.c new/omx/gstomxvp9enc.c
|
|
--- old/omx/gstomxvp9enc.c 1970-01-01 03:00:00.000000000 +0300
|
|
+++ new/omx/gstomxvp9enc.c 2024-03-01 06:33:40.944111873 +0300
|
|
@@ -0,0 +1,1568 @@
|
|
+#ifdef HAVE_CONFIG_H
|
|
+#include "config.h"
|
|
+#endif
|
|
+
|
|
+#include <gst/gst.h>
|
|
+#include <OMX_IndexExt.h>
|
|
+#include "gstomxvp9enc.h"
|
|
+
|
|
+GST_DEBUG_CATEGORY_STATIC (gst_omx_vp9_enc_debug_category);
|
|
+#define GST_CAT_DEFAULT gst_omx_vp9_enc_debug_category
|
|
+
|
|
+/* prototypes */
|
|
+static gboolean gst_omx_vp9_enc_set_format (GstOMXVideoEnc * enc,
|
|
+ GstOMXPort * port, GstVideoCodecState * state);
|
|
+static GstCaps *gst_omx_vp9_enc_get_caps (GstOMXVideoEnc * enc,
|
|
+ GstOMXPort * port, GstVideoCodecState * state);
|
|
+static void gst_omx_vp9_enc_set_property (GObject * object, guint prop_id,
|
|
+ const GValue * value, GParamSpec * pspec);
|
|
+static void gst_omx_vp9_enc_get_property (GObject * object, guint prop_id,
|
|
+ GValue * value, GParamSpec * pspec);
|
|
+
|
|
+enum
|
|
+{
|
|
+ PROP_0,
|
|
+
|
|
+ PROP_SKIP_MODE,
|
|
+ PROP_QP_HDR,
|
|
+ PROP_QP_MIN,
|
|
+ PROP_QP_MAX,
|
|
+ PROP_GOP_LENGTH,
|
|
+ PROP_INTRA_QP_DELTA,
|
|
+ PROP_FIXED_INTRA_QP,
|
|
+
|
|
+
|
|
+ PROP_INTRA_PIC_RATE,
|
|
+ PROP_GOLDEN_PICTURE_RATE,
|
|
+ PROP_ADAPTIVE_GOLDEN_UPDATE,
|
|
+ PROP_ADAPTIVE_GOLDEN_BOOST,
|
|
+
|
|
+ PROP_MODE,
|
|
+ PROP_EFFORT,
|
|
+ PROP_PASSES,
|
|
+ PROP_PASS,
|
|
+
|
|
+ PROP_INTERPOLATION_FILTER,
|
|
+
|
|
+ PROP_FILTER_LEVEL,
|
|
+ PROP_FILTER_SHARPNESS,
|
|
+
|
|
+ PROP_ERROR_RESILIENT,
|
|
+ PROP_FRAME_PARALLEL,
|
|
+
|
|
+ PROP_QUALITY_METRIC,
|
|
+ PROP_QP_DELTA_YDC,
|
|
+ PROP_QP_DELTA_CH_DC,
|
|
+ PROP_QP_DELTA_CH_AC,
|
|
+ PROP_HIGH_PREC_MV_ENABLE,
|
|
+ PROP_ME_CHROMA_WEIGHT,
|
|
+ PROP_LOSSLESS,
|
|
+ PROP_LOOKAHEAD_COUNT,
|
|
+ PROP_REF_FRAME_SCHEME,
|
|
+
|
|
+ PROP_ARF_TEMPORAL_FILTER_ENABLED,
|
|
+ PROP_ARF_TEMPORAL_FILTER_STRENGTH,
|
|
+ PROP_ARF_TEMPORAL_FILTER_LENGTH,
|
|
+ PROP_ARF_TEMPORAL_FILTER_THRESHOLD,
|
|
+
|
|
+ PROP_CQ_LEVEL,
|
|
+
|
|
+ PROP_MIN_ARF_PERIOD,
|
|
+ PROP_MAX_ARF_PERIOD,
|
|
+
|
|
+ PROP_ROTATION,
|
|
+ PROP_FLIP,
|
|
+ PROP_SCALE,
|
|
+ PROP_CROP,
|
|
+ PROP_COLOR_CONVERSION,
|
|
+ PROP_FIRSTPASS_SCALE,
|
|
+ PROP_SCALE_METHOD
|
|
+};
|
|
+
|
|
+
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_SKIP_MODE_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_QP_HDR_DEFAULT (-1)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_QP_MIN_DEFAULT (10)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_QP_MAX_DEFAULT (255)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_GOP_LENGTH_DEFAULT (150)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_INTRA_QP_DELTA_DEFAULT (-20)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_FIXED_INTRA_QP_DEFAULT (0x0)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_INTRA_PIC_RATE_DEFAULT (150)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_GOLDEN_PICTURE_RATE_DEFAULT (10)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_ADAPTIVE_GOLDEN_UPDATE_DEFAULT (1)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_ADAPTIVE_GOLDEN_BOOST_DEFAULT (40)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_EFFORT_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_PASSES_DEFAULT (1)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_PASS_DEFAULT (0)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_INTERPOLATION_FILTER_DEFAULT (4)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_FILTER_LEVEL_DEFAULT (64)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_FILTER_SHARPNESS_DEFAULT (8)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_QP_DELTA_YDC_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_QP_DELTA_CH_DC_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_QP_DELTA_CH_AC_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_HIGH_PREC_MV_ENABLE_DEFAULT (1)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_ME_CHROMA_WEIGHT_DEFAULT (2)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_LOOKAHEAD_COUNT_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_REF_FRAME_SCHEME_DEFAULT (0)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_STRENGTH_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_LENGTH_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_THRESHOLD_DEFAULT (0)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_CQ_LEVEL_DEFAULT (0)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_MIN_ARF_PERIOD_DEFAULT (4)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_MAX_ARF_PERIOD_DEFAULT (14)
|
|
+
|
|
+#define GST_OMX_VP9_VIDEO_ENC_ROTATION_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_COLOR_CONVERSION_DEFAULT (0)
|
|
+#define GST_OMX_VP9_VIDEO_ENC_FIRSTPASS_SCALE_DEFAULT (100)
|
|
+/* class initialization */
|
|
+
|
|
+#define GST_MIRRORTYPE (gst_omx_mirror_get_type ())
|
|
+static GType
|
|
+gst_omx_mirror_get_type (void)
|
|
+{
|
|
+ static GType mirror_type = 0;
|
|
+
|
|
+ if (!mirror_type) {
|
|
+ static GEnumValue mirror_types[] = {
|
|
+ { OMX_MirrorNone, "No flip", "none" },
|
|
+ { OMX_MirrorVertical, "Vertical flip", "vert" },
|
|
+ { 0, NULL, NULL },
|
|
+ };
|
|
+
|
|
+ mirror_type =
|
|
+ g_enum_register_static ("GstMirrorPattern",
|
|
+ mirror_types);
|
|
+ }
|
|
+
|
|
+ return mirror_type;
|
|
+}
|
|
+
|
|
+#define GST_MODETYPE (gst_omx_mode_get_type ())
|
|
+static GType
|
|
+gst_omx_mode_get_type (void)
|
|
+{
|
|
+ static GType mode_type = 0;
|
|
+
|
|
+ if (!mode_type) {
|
|
+ static GEnumValue mode_types[] = {
|
|
+ { OMX_VIDEO_VP9ModeLowLatency, "Low Latency mode", "lowlatency" },
|
|
+ { OMX_VIDEO_VP9ModeRealtime, "Realtime mode", "realtime" },
|
|
+ { OMX_VIDEO_VP9ModeLagged, "Lagged mode", "lagged" },
|
|
+ { OMX_VIDEO_VP9ModeOffline, "Offline mode", "offline" },
|
|
+ { OMX_VIDEO_VP9ModeNone, "Don't use mode preset", "none" },
|
|
+ { 0, NULL, NULL },
|
|
+ };
|
|
+
|
|
+ mode_type =
|
|
+ g_enum_register_static ("GstModePattern",
|
|
+ mode_types);
|
|
+ }
|
|
+
|
|
+ return mode_type;
|
|
+}
|
|
+
|
|
+#define GST_METRICTYPE (gst_omx_metric_get_type ())
|
|
+static GType
|
|
+gst_omx_metric_get_type (void)
|
|
+{
|
|
+ static GType metric_type = 0;
|
|
+
|
|
+ if (!metric_type) {
|
|
+ static GEnumValue metric_types[] = {
|
|
+ { OMX_VIDEO_VP9MetricPSNR, "Use psnr metric", "psnr" },
|
|
+ { OMX_VIDEO_VP9MetricSSIM, "Use ssim metric", "ssim" },
|
|
+ { 0, NULL, NULL },
|
|
+ };
|
|
+
|
|
+ metric_type =
|
|
+ g_enum_register_static ("GstMetricPattern",
|
|
+ metric_types);
|
|
+ }
|
|
+
|
|
+ return metric_type;
|
|
+}
|
|
+
|
|
+#define GST_FIRSTPASSTYPE (gst_omx_scale_method_get_type ())
|
|
+static GType
|
|
+gst_omx_scale_method_get_type (void)
|
|
+{
|
|
+ static GType scale_method_type = 0;
|
|
+
|
|
+ if (!scale_method_type) {
|
|
+ static GEnumValue scale_method_types[] = {
|
|
+ { OMX_VIDEO_VP9FirstpassScale, "Scale image for first pass", "scale" },
|
|
+ { OMX_VIDEO_VP9FirstpassCrop, "Crop image for first pass", "crop" },
|
|
+ { 0, NULL, NULL },
|
|
+ };
|
|
+
|
|
+ scale_method_type =
|
|
+ g_enum_register_static ("GstScaleMethodPattern",
|
|
+ scale_method_types);
|
|
+ }
|
|
+
|
|
+ return scale_method_type;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+gst_omx_video_enc_parse_crop_range (GstOMXVP9Enc * self, const gchar * arr)
|
|
+{
|
|
+ gchar *str;
|
|
+ self->crop_left = atoi (arr);
|
|
+ str = g_strstr_len (arr, -1, ",");
|
|
+ self->crop_width = atoi (str + 1);
|
|
+ str = g_strstr_len (str, -1, ":");
|
|
+ self->crop_top = atoi (str + 1);
|
|
+ str = g_strstr_len (str, -1, ",");
|
|
+ self->crop_height = atoi (str + 1);
|
|
+
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+gst_omx_video_enc_parse_scale_range (GstOMXVP9Enc * self, const gchar * arr)
|
|
+{
|
|
+ gchar *str;
|
|
+ self->scaled_width = atoi (arr);
|
|
+ str = g_strstr_len (arr, -1, "x");
|
|
+ self->scaled_height = atoi (str + 1);
|
|
+
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+#define DEBUG_INIT \
|
|
+ GST_DEBUG_CATEGORY_INIT (gst_omx_vp9_enc_debug_category, "omxvp9enc", 0, \
|
|
+ "debug category for gst-omx video encoder base class");
|
|
+
|
|
+G_DEFINE_TYPE_WITH_CODE (GstOMXVP9Enc, gst_omx_vp9_enc,
|
|
+ GST_TYPE_OMX_VIDEO_ENC, DEBUG_INIT);
|
|
+
|
|
+static void
|
|
+gst_omx_vp9_enc_class_init (GstOMXVP9EncClass * klass)
|
|
+{
|
|
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
+ GstOMXVideoEncClass *videoenc_class = GST_OMX_VIDEO_ENC_CLASS (klass);
|
|
+
|
|
+ videoenc_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_vp9_enc_set_format);
|
|
+ videoenc_class->get_caps = GST_DEBUG_FUNCPTR (gst_omx_vp9_enc_get_caps);
|
|
+
|
|
+ gobject_class->set_property = gst_omx_vp9_enc_set_property;
|
|
+ gobject_class->get_property = gst_omx_vp9_enc_get_property;
|
|
+
|
|
+ /*************************************************/
|
|
+ /*--------------* Bitrate control *--------------*/
|
|
+ /*************************************************/
|
|
+
|
|
+ /*----------------* QP Control *-----------------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_SKIP_MODE,
|
|
+ g_param_spec_uint ("skip-mode",
|
|
+ "Mode of skipping frames.",
|
|
+ "0..4, Mode of skipping frames. [0]\n"
|
|
+ "\t\t\t0 = auto\n"
|
|
+ "\t\t\t1 = drop 1 in 5 frames\n"
|
|
+ "\t\t\t2 = drop 1 in 3 frames\n"
|
|
+ "\t\t\t3 = drop 1 in 2 frames\n"
|
|
+ "\t\t\t4 = drop 2 in 3 frames",
|
|
+ 0,
|
|
+ 4,
|
|
+ GST_OMX_VP9_VIDEO_ENC_SKIP_MODE_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_QP_HDR,
|
|
+ g_param_spec_int ("qp-hdr",
|
|
+ "Default or initial QP.",
|
|
+ "-1..255, Default QP for encoding or initial QP. [-1]\n"
|
|
+ "\t\t\t-1 = Encoder calculates qp-hdr.",
|
|
+ -1,
|
|
+ 255,
|
|
+ GST_OMX_VP9_VIDEO_ENC_QP_HDR_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_QP_MIN,
|
|
+ g_param_spec_uint ("qp-min",
|
|
+ "Minimum frame header QP.",
|
|
+ "0..255, Minimum frame header QP. [10]",
|
|
+ 0,
|
|
+ 255,
|
|
+ GST_OMX_VP9_VIDEO_ENC_QP_MIN_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_QP_MAX,
|
|
+ g_param_spec_uint ("qp-max",
|
|
+ "Maximum frame header QP.",
|
|
+ "0..255, Maximum frame header QP. [255]",
|
|
+ 0,
|
|
+ 255,
|
|
+ GST_OMX_VP9_VIDEO_ENC_QP_MAX_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_GOP_LENGTH,
|
|
+ g_param_spec_uint ("gop-length",
|
|
+ "Group Of Pictures length in frames.",
|
|
+ "1..300, Group Of Pictures length in frames.\n"
|
|
+ "\t\t\tRate control allocates bits for one GOP and tries to\n"
|
|
+ "\t\t\tmatch the target bitrate at the end of each GOP.\n"
|
|
+ "\t\t\tTypically GOP begins with an intra frame, but\n"
|
|
+ "\t\t\tthis is not mandatory.",
|
|
+ 0,
|
|
+ 10000,
|
|
+ GST_OMX_VP9_VIDEO_ENC_GOP_LENGTH_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_INTRA_QP_DELTA,
|
|
+ g_param_spec_int ("intra-qp-delta",
|
|
+ "Intra QP delta.",
|
|
+ "-127..127, Intra QP delta. [-20]\n"
|
|
+ "\t\t\tQP difference between target QP and intra frame QP.",
|
|
+ -127,
|
|
+ 127,
|
|
+ GST_OMX_VP9_VIDEO_ENC_INTRA_QP_DELTA_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_FIXED_INTRA_QP,
|
|
+ g_param_spec_uint ("fixed-intra-qp",
|
|
+ "Fixed Intra QP.",
|
|
+ "0..255, Fixed Intra QP, 0 = disabled. [0]\n"
|
|
+ "\t\t\tUse fixed QP value for every intra frame in stream.",
|
|
+ 0,
|
|
+ 255,
|
|
+ GST_OMX_VP9_VIDEO_ENC_FIXED_INTRA_QP_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*-----------* Rate & Boost Control *------------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_INTRA_PIC_RATE,
|
|
+ g_param_spec_uint ("intra-picture-rate",
|
|
+ "Intra picture rate in frames.",
|
|
+ "Intra picture rate in frames. [0]\n"
|
|
+ "\t\t\tForces every Nth frame to be encoded as intra frame.",
|
|
+ 0,
|
|
+ 0xFFFFFFFF,
|
|
+ GST_OMX_VP9_VIDEO_ENC_INTRA_PIC_RATE_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_GOLDEN_PICTURE_RATE,
|
|
+ g_param_spec_uint ("golden-picture-rate",
|
|
+ "Golden picture rate in frames.",
|
|
+ "Golden picture rate in frames. [10]",
|
|
+ 0,
|
|
+ 10000,
|
|
+ GST_OMX_VP9_VIDEO_ENC_GOLDEN_PICTURE_RATE_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ADAPTIVE_GOLDEN_UPDATE,
|
|
+ g_param_spec_uint ("adaptive-golden-update",
|
|
+ "Enable adaptive golden update.",
|
|
+ "Enable adaptive golden update. [1]",
|
|
+ 0,
|
|
+ 0x1,
|
|
+ GST_OMX_VP9_VIDEO_ENC_ADAPTIVE_GOLDEN_UPDATE_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ADAPTIVE_GOLDEN_BOOST,
|
|
+ g_param_spec_uint ("adaptive-golden-boost",
|
|
+ "Adaptive golden picture quality boost.",
|
|
+ "Adaptive golden picture quality boost. 0..100 0=disable [40]",
|
|
+ 0,
|
|
+ 100,
|
|
+ GST_OMX_VP9_VIDEO_ENC_ADAPTIVE_GOLDEN_BOOST_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*************************************************/
|
|
+ /*------------* Encoding parameters *------------*/
|
|
+ /*************************************************/
|
|
+
|
|
+ /*----------------* Encoder Mode *---------------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_MODE,
|
|
+ g_param_spec_enum ("mode",
|
|
+ "Encoding mode",
|
|
+ "Encoding mode: lowlatency, realtime, lagged, offline [lowlatency]",
|
|
+ GST_MODETYPE, OMX_VIDEO_VP9ModeLowLatency,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_EFFORT,
|
|
+ g_param_spec_uint ("effort",
|
|
+ "Encoder effort level.",
|
|
+ "Encoder effort level, 0=fastest, 5=best quality [0]",
|
|
+ 0,
|
|
+ 0x5,
|
|
+ GST_OMX_VP9_VIDEO_ENC_EFFORT_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_PASSES,
|
|
+ g_param_spec_uint ("passes",
|
|
+ "Number of passes.",
|
|
+ "Number of passes (1/2). [1]",
|
|
+ 0,
|
|
+ 0x2,
|
|
+ GST_OMX_VP9_VIDEO_ENC_PASSES_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_PASS,
|
|
+ g_param_spec_uint ("pass-number",
|
|
+ "Pass to execute.",
|
|
+ "Pass to execute (1/2), 0 for both. [0]",
|
|
+ 0,
|
|
+ 0x2,
|
|
+ GST_OMX_VP9_VIDEO_ENC_PASS_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*------------* Interpolation filter *-----------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_INTERPOLATION_FILTER,
|
|
+ g_param_spec_uint ("interpolation-filter",
|
|
+ "Interpolation filter mode.",
|
|
+ "Interpolation filter mode. 0=smooth, 1=normal, 2=sharp, 3=bilinear, 4=switchable. [4]",
|
|
+ 0,
|
|
+ 4,
|
|
+ GST_OMX_VP9_VIDEO_ENC_INTERPOLATION_FILTER_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*-------------* Deblocking filter *-------------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_FILTER_LEVEL,
|
|
+ g_param_spec_uint ("filter-level",
|
|
+ "Filter strength level for deblocking.",
|
|
+ "0..64, 64=auto, Filter strength level for deblocking. [64]",
|
|
+ 0,
|
|
+ 64,
|
|
+ GST_OMX_VP9_VIDEO_ENC_FILTER_LEVEL_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_FILTER_SHARPNESS,
|
|
+ g_param_spec_uint ("filter-sharpness",
|
|
+ "Filter sharpness for deblocking.",
|
|
+ "0..8, 8=auto, Filter sharpness for deblocking. [8]",
|
|
+ 0,
|
|
+ 8,
|
|
+ GST_OMX_VP9_VIDEO_ENC_FILTER_SHARPNESS_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*--------------* Bitstream coding *-------------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ERROR_RESILIENT,
|
|
+ g_param_spec_boolean ("error-resilient",
|
|
+ "Enable error resilient stream mode.",
|
|
+ "Enable error resilient stream mode. [0]",
|
|
+ FALSE,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_FRAME_PARALLEL,
|
|
+ g_param_spec_boolean ("frame-parallel",
|
|
+ "Enable frame parallel decodability features.",
|
|
+ "Enable frame parallel decodability features. [0]",
|
|
+ FALSE,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*-----------* Additional parameters *-----------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_QUALITY_METRIC,
|
|
+ g_param_spec_enum ("quality-metric",
|
|
+ "Tune encoder towards specified quality metric.",
|
|
+ "Tune encoder towards specified quality metric. Valid values: psnr, ssim. [psnr]",
|
|
+ GST_METRICTYPE, OMX_VIDEO_VP9MetricPSNR,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_QP_DELTA_YDC,
|
|
+ g_param_spec_int ("qp-delta-ydc",
|
|
+ "QP Delta for luma DC.",
|
|
+ "-15..16 QP Delta for luma DC. 16=adaptive [0]",
|
|
+ -15,
|
|
+ 16,
|
|
+ GST_OMX_VP9_VIDEO_ENC_QP_DELTA_YDC_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_QP_DELTA_CH_DC,
|
|
+ g_param_spec_int ("qp-delta-ch-dc",
|
|
+ "QP Delta for chroma DC.",
|
|
+ "-15..16 QP Delta for chroma DC. 16=adaptive [0]",
|
|
+ -15,
|
|
+ 16,
|
|
+ GST_OMX_VP9_VIDEO_ENC_QP_DELTA_CH_DC_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_QP_DELTA_CH_AC,
|
|
+ g_param_spec_int ("qp-delta-ch-ac",
|
|
+ "QP Delta for chroma AC.",
|
|
+ "-15..16 QP Delta for chroma AC. 16=adaptive [0]",
|
|
+ -15,
|
|
+ 16,
|
|
+ GST_OMX_VP9_VIDEO_ENC_QP_DELTA_CH_AC_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_HIGH_PREC_MV_ENABLE,
|
|
+ g_param_spec_uint ("high-prec-mv-enable",
|
|
+ "Use 1/8 pixel MVs.",
|
|
+ "0=OFF, 1=ON Use 1/8 pixel MVs. [1]",
|
|
+ 0,
|
|
+ 0x1,
|
|
+ GST_OMX_VP9_VIDEO_ENC_HIGH_PREC_MV_ENABLE_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ME_CHROMA_WEIGHT,
|
|
+ g_param_spec_uint ("me-chroma-weight",
|
|
+ "0=1X, 1=2X, 2=4X, 3=8X. [2]",
|
|
+ "0=1X, 1=2X, 2=4X, 3=8X. [2]",
|
|
+ 0,
|
|
+ 3,
|
|
+ GST_OMX_VP9_VIDEO_ENC_ME_CHROMA_WEIGHT_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_LOSSLESS,
|
|
+ g_param_spec_boolean ("lossless",
|
|
+ "Enable lossless encoding.",
|
|
+ "Enable lossless encoding. Forces all quant and filter params to zero. [0]",
|
|
+ FALSE,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_LOOKAHEAD_COUNT,
|
|
+ g_param_spec_uint ("lookahead-count",
|
|
+ "Number of frames to lag.",
|
|
+ "Number of frames to lag. Up to 25. [0]", 0,
|
|
+ 25,
|
|
+ GST_OMX_VP9_VIDEO_ENC_LOOKAHEAD_COUNT_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_REF_FRAME_SCHEME,
|
|
+ g_param_spec_uint ("ref-frame-scheme",
|
|
+ "Reference frame update scheme.",
|
|
+ "Reference frame update scheme. [4]\n"
|
|
+ "\t\t\t0 = auto\n"
|
|
+ "\t\t\t1 = last three\n"
|
|
+ "\t\t\t2 = static golden altref 2nd last\n"
|
|
+ "\t\t\t3 = static golden static altref\n"
|
|
+ "\t\t\t4 = twoway\n"
|
|
+ "\t\t\t5 = static golden smart altref",
|
|
+ 0,
|
|
+ 5,
|
|
+ GST_OMX_VP9_VIDEO_ENC_REF_FRAME_SCHEME_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*-------* AltRef Frames Filter control *--------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ARF_TEMPORAL_FILTER_ENABLED,
|
|
+ g_param_spec_boolean ("arf-temporal-filter-enabled",
|
|
+ "ARF temporal filter enable/disable.",
|
|
+ "ARF temporal filter enable/disable. [false]",
|
|
+ FALSE,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ARF_TEMPORAL_FILTER_STRENGTH,
|
|
+ g_param_spec_uint ("arf-temporal-filter-strength",
|
|
+ "ARF temporal filter strength.",
|
|
+ "ARF temporal filter strength. Up to 15. [0]",
|
|
+ 0,
|
|
+ 15,
|
|
+ GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_STRENGTH_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ARF_TEMPORAL_FILTER_LENGTH,
|
|
+ g_param_spec_uint ("arf-temporal-filter-length",
|
|
+ "ARF temporal filter length.",
|
|
+ "ARF temporal filter length. (0 three frames, 1 six frames). [0]",
|
|
+ 0,
|
|
+ 0x1,
|
|
+ GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_LENGTH_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ARF_TEMPORAL_FILTER_THRESHOLD,
|
|
+ g_param_spec_uint ("arf-temporal-filter-threshold",
|
|
+ "ARF temporal filter threshold.",
|
|
+ "ARF temporal filter threshold. Valid range 0...64K. [0]",
|
|
+ 0,
|
|
+ 64000,
|
|
+ GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_THRESHOLD_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*--------------* Quality control *--------------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_CQ_LEVEL,
|
|
+ g_param_spec_uint ("cq-level",
|
|
+ "Constrained quality level, ~minimum qp for regular frames. [0]",
|
|
+ "Constrained quality level, ~minimum qp for regular frames. [0]\n"
|
|
+ "\t\t\tCalculates new target QP for every frame.",
|
|
+ 0,
|
|
+ 255,
|
|
+ GST_OMX_VP9_VIDEO_ENC_CQ_LEVEL_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /*--------* AltRef Frames Period control *-------*/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_MIN_ARF_PERIOD,
|
|
+ g_param_spec_uint ("min-arf-period",
|
|
+ "Min alt-ref frame period.",
|
|
+ "Min alt-ref frame period. Max value (lag - 2). [4]",
|
|
+ 0,
|
|
+ 10000,
|
|
+ GST_OMX_VP9_VIDEO_ENC_MIN_ARF_PERIOD_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_MAX_ARF_PERIOD,
|
|
+ g_param_spec_uint ("max-arf-period",
|
|
+ "Max alt-ref frame period.",
|
|
+ "Max alt-ref frame period. [14]",
|
|
+ 0,
|
|
+ 10000,
|
|
+ GST_OMX_VP9_VIDEO_ENC_MAX_ARF_PERIOD_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ /**************************************************/
|
|
+ /*------------* Preprocessor control *------------*/
|
|
+ /**************************************************/
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_ROTATION,
|
|
+ g_param_spec_uint ("rotation",
|
|
+ "Rotate input image.",
|
|
+ "Rotate input image. [0]\n"
|
|
+ "\t\t\t0 - disabled\n"
|
|
+ "\t\t\t90 - 90 degrees right\n"
|
|
+ "\t\t\t270 - 90 degrees left\n"
|
|
+ "\t\t\t180 - 180 degrees",
|
|
+ 0,
|
|
+ 360,
|
|
+ GST_OMX_VP9_VIDEO_ENC_ROTATION_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_FLIP,
|
|
+ g_param_spec_enum ("flip",
|
|
+ "Flip image.",
|
|
+ "Flip image. [none]\n"
|
|
+ "\t\t\tnone - No flip\n"
|
|
+ "\t\t\tvert Flip vertically",
|
|
+ GST_MIRRORTYPE, OMX_MirrorNone,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class, PROP_SCALE,
|
|
+ g_param_spec_string ("scale",
|
|
+ "Image scaling.\n",
|
|
+ "Image scaling. [0x0]\n"
|
|
+ "\t\t\tScaled Width x Scaled Height",
|
|
+ "0x0", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class, PROP_CROP,
|
|
+ g_param_spec_string ("crop",
|
|
+ "Image crop.\n",
|
|
+ "Image crop. [-1,-1;-1,-1]\n"
|
|
+ "\t\t\tx offset,width;y offset,height",
|
|
+ "-1,-1:-1,-1", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_COLOR_CONVERSION,
|
|
+ g_param_spec_uint ("color-conversion",
|
|
+ "RGB to YCbCr color conversion type.",
|
|
+ "RGB to YCbCr color conversion type. [0]\n"
|
|
+ "\t\t\t0 - BT.601, studio swing [16..235]\n"
|
|
+ "\t\t\t1 - BT.709, studio swing [16..235]\n"
|
|
+ "\t\t\t2 - BT.601, full swing [0..255]\n"
|
|
+ "\t\t\t3 - BT.709, full swing [0..255]",
|
|
+ 0,
|
|
+ 3,
|
|
+ GST_OMX_VP9_VIDEO_ENC_COLOR_CONVERSION_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_FIRSTPASS_SCALE,
|
|
+ g_param_spec_uint ("firstpass-scale",
|
|
+ "Percent of original picture to process in first pass.",
|
|
+ "Percent of original picture to process in first pass. [100]",
|
|
+ 0,
|
|
+ 100,
|
|
+ GST_OMX_VP9_VIDEO_ENC_FIRSTPASS_SCALE_DEFAULT,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ g_object_class_install_property (gobject_class,
|
|
+ PROP_SCALE_METHOD,
|
|
+ g_param_spec_enum ("scale-method",
|
|
+ "Firstpass scale method.",
|
|
+ "Firstpass scale method: scale, crop. [scale]",
|
|
+ GST_FIRSTPASSTYPE, OMX_VIDEO_VP9FirstpassScale,
|
|
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
|
+ GST_PARAM_MUTABLE_READY));
|
|
+
|
|
+ videoenc_class->cdata.default_src_template_caps = "video/x-vp9, "
|
|
+ "width=(int) [ 136, 4096 ], " "height=(int) [ 96, 2304 ]";
|
|
+
|
|
+ gst_element_class_set_static_metadata (element_class,
|
|
+ "OpenMAX VP9 Video Encoder",
|
|
+ "Codec/Encoder/Video",
|
|
+ "Encode VP9 video streams", "MCST");
|
|
+
|
|
+ gst_omx_set_default_role (&videoenc_class->cdata, "video_encoder.vp9");
|
|
+}
|
|
+
|
|
+static void
|
|
+gst_omx_vp9_enc_set_property (GObject * object, guint prop_id,
|
|
+ const GValue * value, GParamSpec * pspec)
|
|
+{
|
|
+ GstOMXVP9Enc *self = GST_OMX_VP9_ENC (object);
|
|
+
|
|
+ switch (prop_id) {
|
|
+ case PROP_SKIP_MODE:
|
|
+ self->skip_mode = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_QP_HDR:
|
|
+ self->qp_hdr = g_value_get_int (value);
|
|
+ break;
|
|
+ case PROP_QP_MIN:
|
|
+ self->qp_min = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_QP_MAX:
|
|
+ self->qp_max = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_GOP_LENGTH:
|
|
+ self->gop_length = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_INTRA_QP_DELTA:
|
|
+ self->intra_qp_delta = g_value_get_int (value);
|
|
+ break;
|
|
+ case PROP_FIXED_INTRA_QP:
|
|
+ self->fixed_intra_qp = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_INTRA_PIC_RATE:
|
|
+ self->intra_picture_rate = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_GOLDEN_PICTURE_RATE:
|
|
+ self->golden_picture_rate = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_ADAPTIVE_GOLDEN_UPDATE:
|
|
+ self->adaptive_golden_update = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_ADAPTIVE_GOLDEN_BOOST:
|
|
+ self->adaptive_golden_boost = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_MODE:
|
|
+ self->mode = g_value_get_enum (value);
|
|
+ break;
|
|
+ case PROP_EFFORT:
|
|
+ self->effort = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_PASSES:
|
|
+ self->passes = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_PASS:
|
|
+ self->pass = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_INTERPOLATION_FILTER:
|
|
+ self->interpolation_filter = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_FILTER_LEVEL:
|
|
+ self->filter_level = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_FILTER_SHARPNESS:
|
|
+ self->filter_sharpness = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_ERROR_RESILIENT:
|
|
+ self->error_resilient = g_value_get_boolean (value);
|
|
+ break;
|
|
+ case PROP_FRAME_PARALLEL:
|
|
+ self->frame_parallel = g_value_get_boolean (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_QUALITY_METRIC:
|
|
+ self->quality_metric = g_value_get_enum (value);
|
|
+ break;
|
|
+ case PROP_QP_DELTA_YDC:
|
|
+ self->qp_delta_ydc = g_value_get_int (value);
|
|
+ break;
|
|
+ case PROP_QP_DELTA_CH_DC:
|
|
+ self->qp_delta_ch_dc = g_value_get_int (value);
|
|
+ break;
|
|
+ case PROP_QP_DELTA_CH_AC:
|
|
+ self->qp_delta_ch_ac = g_value_get_int (value);
|
|
+ break;
|
|
+ case PROP_HIGH_PREC_MV_ENABLE:
|
|
+ self->high_prec_mv_enable = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_ME_CHROMA_WEIGHT:
|
|
+ self->me_chroma_weight = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_LOSSLESS:
|
|
+ self->lossless = g_value_get_boolean (value);
|
|
+ break;
|
|
+ case PROP_LOOKAHEAD_COUNT:
|
|
+ self->lookahead_count = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_REF_FRAME_SCHEME:
|
|
+ self->ref_frame_scheme = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_ARF_TEMPORAL_FILTER_ENABLED:
|
|
+ self->arf_temporal_filter_enabled = g_value_get_boolean (value);
|
|
+ break;
|
|
+ case PROP_ARF_TEMPORAL_FILTER_STRENGTH:
|
|
+ self->arf_temporal_filter_strength = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_ARF_TEMPORAL_FILTER_LENGTH:
|
|
+ self->arf_temporal_filter_length = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_ARF_TEMPORAL_FILTER_THRESHOLD:
|
|
+ self->arf_temporal_filter_threshold = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_CQ_LEVEL:
|
|
+ self->cq_level = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_MIN_ARF_PERIOD:
|
|
+ self->min_arf_period = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_MAX_ARF_PERIOD:
|
|
+ self->max_arf_period = g_value_get_uint (value);
|
|
+ break;
|
|
+
|
|
+ case PROP_ROTATION:
|
|
+ self->rotation = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_FLIP:
|
|
+ self->flip = g_value_get_enum (value);
|
|
+ break;
|
|
+ case PROP_SCALE:
|
|
+ gst_omx_video_enc_parse_scale_range (self, g_value_get_string (value));
|
|
+ self->set_scale = TRUE;
|
|
+ break;
|
|
+ case PROP_CROP:
|
|
+ gst_omx_video_enc_parse_crop_range (self, g_value_get_string (value));
|
|
+ self->set_crop = TRUE;
|
|
+ break;
|
|
+ case PROP_COLOR_CONVERSION:
|
|
+ self->color_conversion = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_FIRSTPASS_SCALE:
|
|
+ self->firstpass_scale = g_value_get_uint (value);
|
|
+ break;
|
|
+ case PROP_SCALE_METHOD:
|
|
+ self->scale_method = g_value_get_enum (value);
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
+ break;
|
|
+ }
|
|
+}
|
|
+
|
|
+static void
|
|
+gst_omx_vp9_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
|
+ GParamSpec * pspec)
|
|
+{
|
|
+ GstOMXVP9Enc *self = GST_OMX_VP9_ENC (object);
|
|
+
|
|
+ switch (prop_id) {
|
|
+ case PROP_SKIP_MODE:
|
|
+ g_value_set_uint (value, self->skip_mode);
|
|
+ break;
|
|
+ case PROP_QP_HDR:
|
|
+ g_value_set_int (value, self->qp_hdr);
|
|
+ break;
|
|
+ case PROP_QP_MIN:
|
|
+ g_value_set_uint (value, self->qp_min);
|
|
+ break;
|
|
+ case PROP_QP_MAX:
|
|
+ g_value_set_uint (value, self->qp_max);
|
|
+ break;
|
|
+ case PROP_GOP_LENGTH:
|
|
+ g_value_set_uint(value, self->gop_length);
|
|
+ break;
|
|
+ case PROP_INTRA_QP_DELTA:
|
|
+ g_value_set_int(value, self->intra_qp_delta);
|
|
+ break;
|
|
+ case PROP_FIXED_INTRA_QP:
|
|
+ g_value_set_uint(value, self->fixed_intra_qp);
|
|
+ break;
|
|
+
|
|
+ case PROP_INTRA_PIC_RATE:
|
|
+ g_value_set_uint (value, self->intra_picture_rate);
|
|
+ break;
|
|
+ case PROP_GOLDEN_PICTURE_RATE:
|
|
+ g_value_set_uint(value, self->golden_picture_rate);
|
|
+ break;
|
|
+ case PROP_ADAPTIVE_GOLDEN_UPDATE:
|
|
+ g_value_set_uint(value, self->adaptive_golden_update);
|
|
+ break;
|
|
+ case PROP_ADAPTIVE_GOLDEN_BOOST:
|
|
+ g_value_set_uint(value, self->adaptive_golden_boost);
|
|
+ break;
|
|
+
|
|
+ case PROP_MODE:
|
|
+ g_value_set_uint (value, self->mode);
|
|
+ break;
|
|
+ case PROP_EFFORT:
|
|
+ g_value_set_uint (value, self->effort);
|
|
+ break;
|
|
+ case PROP_PASSES:
|
|
+ g_value_set_uint (value, self->passes);
|
|
+ break;
|
|
+ case PROP_PASS:
|
|
+ g_value_set_uint (value, self->pass);
|
|
+ break;
|
|
+
|
|
+ case PROP_INTERPOLATION_FILTER:
|
|
+ g_value_set_uint(value, self->interpolation_filter);
|
|
+ break;
|
|
+
|
|
+ case PROP_FILTER_LEVEL:
|
|
+ g_value_set_uint(value, self->filter_level);
|
|
+ break;
|
|
+ case PROP_FILTER_SHARPNESS:
|
|
+ g_value_set_uint(value, self->filter_sharpness);
|
|
+ break;
|
|
+
|
|
+ case PROP_ERROR_RESILIENT:
|
|
+ g_value_set_boolean (value, self->error_resilient);
|
|
+ break;
|
|
+ case PROP_FRAME_PARALLEL:
|
|
+ g_value_set_boolean (value, self->frame_parallel);
|
|
+ break;
|
|
+
|
|
+ case PROP_QUALITY_METRIC:
|
|
+ g_value_set_enum(value, self->quality_metric);
|
|
+ break;
|
|
+ case PROP_QP_DELTA_YDC:
|
|
+ g_value_set_int(value, self->qp_delta_ydc);
|
|
+ break;
|
|
+ case PROP_QP_DELTA_CH_DC:
|
|
+ g_value_set_int(value, self->qp_delta_ch_dc);
|
|
+ break;
|
|
+ case PROP_QP_DELTA_CH_AC:
|
|
+ g_value_set_int(value, self->qp_delta_ch_ac);
|
|
+ break;
|
|
+ case PROP_HIGH_PREC_MV_ENABLE:
|
|
+ g_value_set_uint(value, self->high_prec_mv_enable);
|
|
+ break;
|
|
+ case PROP_ME_CHROMA_WEIGHT:
|
|
+ g_value_set_uint(value, self->me_chroma_weight);
|
|
+ break;
|
|
+ case PROP_LOSSLESS:
|
|
+ g_value_set_boolean (value, self->lossless);
|
|
+ break;
|
|
+ case PROP_LOOKAHEAD_COUNT:
|
|
+ g_value_set_uint (value, self->lookahead_count);
|
|
+ break;
|
|
+ case PROP_REF_FRAME_SCHEME:
|
|
+ g_value_set_uint (value, self->ref_frame_scheme);
|
|
+ break;
|
|
+
|
|
+ case PROP_ARF_TEMPORAL_FILTER_ENABLED:
|
|
+ g_value_set_boolean (value, self->arf_temporal_filter_enabled);
|
|
+ break;
|
|
+ case PROP_ARF_TEMPORAL_FILTER_STRENGTH:
|
|
+ g_value_set_uint(value, self->arf_temporal_filter_strength);
|
|
+ break;
|
|
+ case PROP_ARF_TEMPORAL_FILTER_LENGTH:
|
|
+ g_value_set_uint(value, self->arf_temporal_filter_length);
|
|
+ break;
|
|
+ case PROP_ARF_TEMPORAL_FILTER_THRESHOLD:
|
|
+ g_value_set_uint(value, self->arf_temporal_filter_threshold);
|
|
+ break;
|
|
+
|
|
+ case PROP_CQ_LEVEL:
|
|
+ g_value_set_uint(value, self->cq_level);
|
|
+ break;
|
|
+
|
|
+ case PROP_MIN_ARF_PERIOD:
|
|
+ g_value_set_uint(value, self->min_arf_period);
|
|
+ break;
|
|
+ case PROP_MAX_ARF_PERIOD:
|
|
+ g_value_set_uint(value, self->max_arf_period);
|
|
+ break;
|
|
+
|
|
+ case PROP_ROTATION:
|
|
+ g_value_set_uint (value, self->rotation);
|
|
+ break;
|
|
+ case PROP_FLIP:
|
|
+ g_value_set_enum(value, self->flip);
|
|
+ break;
|
|
+ case PROP_SCALE:
|
|
+ gchar arr_scale[100];
|
|
+ sprintf (arr_scale, "%dx%d", self->scaled_width, self->scaled_height);
|
|
+ g_value_set_string (value, arr_scale);
|
|
+ break;
|
|
+ case PROP_CROP:
|
|
+ gchar arr_crop[100];
|
|
+ sprintf (arr_crop, "%d,%d:%d,%d", self->crop_left, self->crop_width, self->crop_top, self->crop_height);
|
|
+ g_value_set_string (value, arr_crop);
|
|
+ break;
|
|
+ case PROP_COLOR_CONVERSION:
|
|
+ g_value_set_uint(value, self->color_conversion);
|
|
+ break;
|
|
+ case PROP_FIRSTPASS_SCALE:
|
|
+ g_value_set_uint(value, self->firstpass_scale);
|
|
+ break;
|
|
+ case PROP_SCALE_METHOD:
|
|
+ g_value_set_enum(value, self->scale_method);
|
|
+ break;
|
|
+
|
|
+ default:
|
|
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
+ break;
|
|
+ }
|
|
+}
|
|
+
|
|
+static void
|
|
+gst_omx_vp9_enc_init (GstOMXVP9Enc * self)
|
|
+{
|
|
+ self->skip_mode = GST_OMX_VP9_VIDEO_ENC_SKIP_MODE_DEFAULT;
|
|
+ self->qp_hdr = GST_OMX_VP9_VIDEO_ENC_QP_HDR_DEFAULT;
|
|
+ self->qp_min = GST_OMX_VP9_VIDEO_ENC_QP_MIN_DEFAULT;
|
|
+ self->qp_max = GST_OMX_VP9_VIDEO_ENC_QP_MAX_DEFAULT;
|
|
+ self->gop_length = GST_OMX_VP9_VIDEO_ENC_GOP_LENGTH_DEFAULT;
|
|
+ self->intra_qp_delta = GST_OMX_VP9_VIDEO_ENC_INTRA_QP_DELTA_DEFAULT;
|
|
+ self->fixed_intra_qp = GST_OMX_VP9_VIDEO_ENC_FIXED_INTRA_QP_DEFAULT;
|
|
+
|
|
+ self->intra_picture_rate = GST_OMX_VP9_VIDEO_ENC_INTRA_PIC_RATE_DEFAULT;
|
|
+ self->golden_picture_rate = GST_OMX_VP9_VIDEO_ENC_GOLDEN_PICTURE_RATE_DEFAULT;
|
|
+ self->adaptive_golden_update = GST_OMX_VP9_VIDEO_ENC_ADAPTIVE_GOLDEN_UPDATE_DEFAULT;
|
|
+ self->adaptive_golden_boost = GST_OMX_VP9_VIDEO_ENC_ADAPTIVE_GOLDEN_BOOST_DEFAULT;
|
|
+
|
|
+ self->mode = OMX_VIDEO_VP9ModeLowLatency;
|
|
+ self->effort = GST_OMX_VP9_VIDEO_ENC_EFFORT_DEFAULT;
|
|
+ self->passes = GST_OMX_VP9_VIDEO_ENC_PASSES_DEFAULT;
|
|
+ self->pass = GST_OMX_VP9_VIDEO_ENC_PASS_DEFAULT;
|
|
+
|
|
+ self->interpolation_filter = GST_OMX_VP9_VIDEO_ENC_INTERPOLATION_FILTER_DEFAULT;
|
|
+
|
|
+ self->filter_level = GST_OMX_VP9_VIDEO_ENC_FILTER_LEVEL_DEFAULT;
|
|
+ self->filter_sharpness = GST_OMX_VP9_VIDEO_ENC_FILTER_SHARPNESS_DEFAULT;
|
|
+
|
|
+ self->error_resilient = FALSE;
|
|
+ self->frame_parallel = FALSE;
|
|
+
|
|
+ self->quality_metric = OMX_VIDEO_VP9MetricPSNR;
|
|
+ self->qp_delta_ydc = GST_OMX_VP9_VIDEO_ENC_QP_DELTA_YDC_DEFAULT;
|
|
+ self->qp_delta_ch_dc = GST_OMX_VP9_VIDEO_ENC_QP_DELTA_CH_DC_DEFAULT;
|
|
+ self->qp_delta_ch_ac = GST_OMX_VP9_VIDEO_ENC_QP_DELTA_CH_AC_DEFAULT;
|
|
+ self->high_prec_mv_enable = GST_OMX_VP9_VIDEO_ENC_HIGH_PREC_MV_ENABLE_DEFAULT;
|
|
+ self->me_chroma_weight = GST_OMX_VP9_VIDEO_ENC_ME_CHROMA_WEIGHT_DEFAULT;
|
|
+ self->lossless = FALSE;
|
|
+ self->lookahead_count = GST_OMX_VP9_VIDEO_ENC_LOOKAHEAD_COUNT_DEFAULT;
|
|
+ self->ref_frame_scheme = GST_OMX_VP9_VIDEO_ENC_REF_FRAME_SCHEME_DEFAULT;
|
|
+
|
|
+ self->arf_temporal_filter_enabled = FALSE;
|
|
+ self->arf_temporal_filter_strength = GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_STRENGTH_DEFAULT;
|
|
+ self->arf_temporal_filter_length = GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_LENGTH_DEFAULT;
|
|
+ self->arf_temporal_filter_threshold = GST_OMX_VP9_VIDEO_ENC_ARF_TEMPORAL_FILTER_THRESHOLD_DEFAULT;
|
|
+
|
|
+ self->cq_level = GST_OMX_VP9_VIDEO_ENC_CQ_LEVEL_DEFAULT;
|
|
+
|
|
+ self->min_arf_period = GST_OMX_VP9_VIDEO_ENC_MIN_ARF_PERIOD_DEFAULT;
|
|
+ self->max_arf_period = GST_OMX_VP9_VIDEO_ENC_MAX_ARF_PERIOD_DEFAULT;
|
|
+
|
|
+ self->rotation = GST_OMX_VP9_VIDEO_ENC_ROTATION_DEFAULT;
|
|
+ self->flip = OMX_MirrorNone;
|
|
+ self->set_scale = FALSE;
|
|
+ self->scaled_width = 0;
|
|
+ self->scaled_height = 0;
|
|
+ self->set_crop = FALSE;
|
|
+ self->crop_left = -1;
|
|
+ self->crop_top = -1;
|
|
+ self->crop_width = -1;
|
|
+ self->crop_height = -1;
|
|
+ self->color_conversion = GST_OMX_VP9_VIDEO_ENC_COLOR_CONVERSION_DEFAULT;
|
|
+ self->firstpass_scale = GST_OMX_VP9_VIDEO_ENC_FIRSTPASS_SCALE_DEFAULT;
|
|
+ self->scale_method = OMX_VIDEO_VP9FirstpassScale;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+update_mode_vp9 (GstOMXVP9Enc * self)
|
|
+{
|
|
+ OMX_CONFIG_MODETYPE config;
|
|
+ OMX_ERRORTYPE err;
|
|
+
|
|
+ GST_OMX_INIT_STRUCT (&config);
|
|
+ config.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_in_port->index;
|
|
+ config.eMode = self->mode;
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_set_config (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ (OMX_INDEXTYPE) OMX_IndexConfigVideoVp9Mode, &config);
|
|
+
|
|
+ if (err == OMX_ErrorUnsupportedIndex) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Setting OMX_IndexConfigVideoVp9Mode not supported by component");
|
|
+ return TRUE;
|
|
+ } else if (err != OMX_ErrorNone) {
|
|
+ GST_ERROR_OBJECT (self,
|
|
+ "Error setting VP9 mode %u: %s (0x%08x)",
|
|
+ (guint) config.eMode, gst_omx_error_to_string (err), err);
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+update_param_vp9 (GstOMXVP9Enc * self)
|
|
+{
|
|
+ OMX_VIDEO_PARAM_VP9TYPE param;
|
|
+ OMX_ERRORTYPE err;
|
|
+
|
|
+ GST_OMX_INIT_STRUCT (¶m);
|
|
+ param.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_out_port->index;
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ OMX_IndexParamVideoVp9, ¶m);
|
|
+ if (err != OMX_ErrorNone) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Getting OMX_IndexParamVideoVp9 not supported by component");
|
|
+ return TRUE;
|
|
+ }
|
|
+
|
|
+ param.nSkipMode = self->skip_mode;
|
|
+ param.nQpHdr = self->qp_hdr;
|
|
+ param.nQpMin = self->qp_min;
|
|
+ param.nQpMax = self->qp_max;
|
|
+ param.nGopLength = self->gop_length;
|
|
+ param.nIntraQpDelta = self->intra_qp_delta;
|
|
+ param.nFixedIntraQp = self->fixed_intra_qp;
|
|
+
|
|
+ param.nPFrames = self->intra_picture_rate;
|
|
+ param.nGoldenPictureRate = self->golden_picture_rate;
|
|
+ param.nAdaptiveGoldenUpdate = self->adaptive_golden_update;
|
|
+ param.nAdaptiveGoldenBoost = self->adaptive_golden_boost;
|
|
+
|
|
+ param.nEffort = self->effort;
|
|
+ param.nPasses = self->passes;
|
|
+ param.nPass = self->pass;
|
|
+
|
|
+ param.nInterpolationFilter = self->interpolation_filter;
|
|
+
|
|
+ param.nFilterLevel = self->filter_level;
|
|
+ param.nFilterSharpness = self->filter_sharpness;
|
|
+
|
|
+ param.bErrorResilientMode = self->error_resilient == TRUE ? OMX_TRUE : OMX_FALSE;
|
|
+ param.bFrameParallel = self->frame_parallel == TRUE ? OMX_TRUE : OMX_FALSE;
|
|
+
|
|
+ param.eQualityMetric = self->quality_metric;
|
|
+ param.nQpDeltaYDc = self->qp_delta_ydc;
|
|
+ param.nQpDeltaChDc = self->qp_delta_ch_dc;
|
|
+ param.nQpDeltaChAc = self->qp_delta_ch_ac;
|
|
+ param.nHighPrecMvEnable = self->high_prec_mv_enable;
|
|
+ param.nMeChromaWeight = self->me_chroma_weight;
|
|
+ param.bLossless = self->lossless == TRUE ? OMX_TRUE : OMX_FALSE;
|
|
+ param.nLookaheadCount = self->lookahead_count;
|
|
+ param.nRefFrameScheme = self->ref_frame_scheme;
|
|
+
|
|
+ param.bArfTemporalFilterEnabled = self->arf_temporal_filter_enabled == TRUE ? OMX_TRUE : OMX_FALSE;
|
|
+ param.nArfTemporalFilterStrength = self->arf_temporal_filter_strength;
|
|
+ param.nArfTemporalFilterLength = self->arf_temporal_filter_length;
|
|
+ param.nArfTemporalFilterThreshold = self->arf_temporal_filter_threshold;
|
|
+
|
|
+ param.nCqLevel = self->cq_level;
|
|
+
|
|
+ param.nMinArfPeriod = self->min_arf_period;
|
|
+ param.nMaxArfPeriod = self->max_arf_period;
|
|
+
|
|
+ param.nColorConversion = self->color_conversion;
|
|
+ param.nFirstpassScale = self->firstpass_scale;
|
|
+ param.nFirstpassScaleMethod = self->scale_method == OMX_VIDEO_VP9FirstpassScale ? 0 : 1;
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ OMX_IndexParamVideoVp9, ¶m);
|
|
+ if (err == OMX_ErrorUnsupportedIndex) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Setting OMX_IndexParamVideoVp9 not supported by component");
|
|
+ return TRUE;
|
|
+ } else if (err != OMX_ErrorNone) {
|
|
+ GST_ERROR_OBJECT (self,
|
|
+ "Error setting VP9 settings: %s (0x%08x)",
|
|
+ gst_omx_error_to_string (err), err);
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+update_rotation_vp9 (GstOMXVP9Enc * self)
|
|
+{
|
|
+ OMX_CONFIG_ROTATIONTYPE config;
|
|
+ OMX_ERRORTYPE err;
|
|
+
|
|
+ GST_OMX_INIT_STRUCT (&config);
|
|
+ config.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_in_port->index;
|
|
+ config.nRotation = self->rotation;
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_set_config (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ (OMX_INDEXTYPE) OMX_IndexConfigCommonRotate, &config);
|
|
+
|
|
+ if (err == OMX_ErrorUnsupportedIndex) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Setting OMX_IndexConfigCommonRotate not supported by component");
|
|
+ return TRUE;
|
|
+ } else if (err != OMX_ErrorNone) {
|
|
+ GST_ERROR_OBJECT (self,
|
|
+ "Error setting VP9 rotation %u: %s (0x%08x)",
|
|
+ (guint) config.nRotation, gst_omx_error_to_string (err), err);
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+update_flip_vp9 (GstOMXVP9Enc * self)
|
|
+{
|
|
+ OMX_CONFIG_MIRRORTYPE config;
|
|
+ OMX_ERRORTYPE err;
|
|
+
|
|
+ GST_OMX_INIT_STRUCT (&config);
|
|
+ config.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_in_port->index;
|
|
+ config.eMirror = self->flip;
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_set_config (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ (OMX_INDEXTYPE) OMX_IndexConfigCommonMirror, &config);
|
|
+
|
|
+ if (err == OMX_ErrorUnsupportedIndex) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Setting OMX_IndexConfigCommonMirror not supported by component");
|
|
+ return TRUE;
|
|
+ } else if (err != OMX_ErrorNone) {
|
|
+ GST_ERROR_OBJECT (self,
|
|
+ "Error setting VP9 flip %u: %s (0x%08x)",
|
|
+ (guint) config.eMirror, gst_omx_error_to_string (err), err);
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+update_scale_vp9 (GstOMXVP9Enc * self)
|
|
+{
|
|
+ OMX_CONFIG_SCALETYPE config;
|
|
+ OMX_ERRORTYPE err;
|
|
+
|
|
+ GST_OMX_INIT_STRUCT (&config);
|
|
+ config.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_in_port->index;
|
|
+ config.nScaledWidth = self->scaled_width;
|
|
+ config.nScaledHeight = self->scaled_height;
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_set_config (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ (OMX_INDEXTYPE) OMX_IndexConfigVideoVp9Scale, &config);
|
|
+
|
|
+ if (err == OMX_ErrorUnsupportedIndex) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Setting OMX_IndexConfigVideoVp9Scale not supported by component");
|
|
+ return TRUE;
|
|
+ } else if (err != OMX_ErrorNone) {
|
|
+ GST_ERROR_OBJECT (self,
|
|
+ "Error setting VP9 scale %ux%u: %s (0x%08x)",
|
|
+ (guint) config.nScaledWidth, (guint) config.nScaledHeight, gst_omx_error_to_string (err), err);
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ self->set_scale = FALSE;
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+update_crop_vp9 (GstOMXVP9Enc * self)
|
|
+{
|
|
+ OMX_CONFIG_RECTTYPE config;
|
|
+ OMX_ERRORTYPE err;
|
|
+
|
|
+ GST_OMX_INIT_STRUCT (&config);
|
|
+ config.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_in_port->index;
|
|
+ config.nLeft = self->crop_left;
|
|
+ config.nTop = self->crop_top;
|
|
+ config.nWidth = self->crop_width;
|
|
+ config.nHeight = self->crop_height;
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_set_config (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ (OMX_INDEXTYPE) OMX_IndexConfigCommonInputCrop, &config);
|
|
+
|
|
+ if (err == OMX_ErrorUnsupportedIndex) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Setting OMX_IndexConfigCommonInputCrop not supported by component");
|
|
+ return TRUE;
|
|
+ } else if (err != OMX_ErrorNone) {
|
|
+ GST_ERROR_OBJECT (self,
|
|
+ "Error setting VP9 crop %u,%u:%u,%u: %s (0x%08x)",
|
|
+ (guint) config.nLeft, (guint) config.nWidth, (guint) config.nTop, (guint) config.nHeight, gst_omx_error_to_string (err), err);
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ self->set_crop = FALSE;
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+gst_omx_vp9_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|
+ GstVideoCodecState * state)
|
|
+{
|
|
+ GstOMXVP9Enc *self = GST_OMX_VP9_ENC (enc);
|
|
+ GstCaps *peercaps, *intersection;
|
|
+ OMX_PARAM_PORTDEFINITIONTYPE port_def;
|
|
+ OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
|
+ OMX_ERRORTYPE err;
|
|
+ const gchar *profile_string;
|
|
+
|
|
+ gst_omx_port_get_port_definition (GST_OMX_VIDEO_ENC (self)->enc_out_port,
|
|
+ &port_def);
|
|
+ port_def.format.video.eCompressionFormat = OMX_VIDEO_CodingVP9;
|
|
+ err =
|
|
+ gst_omx_port_update_port_definition (GST_OMX_VIDEO_ENC
|
|
+ (self)->enc_out_port, &port_def);
|
|
+ if (err != OMX_ErrorNone)
|
|
+ return FALSE;
|
|
+
|
|
+ if(!update_param_vp9(self))
|
|
+ return FALSE;
|
|
+
|
|
+ GST_OMX_INIT_STRUCT (¶m);
|
|
+ param.nPortIndex = GST_OMX_VIDEO_ENC (self)->enc_out_port->index;
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
|
+ if (err != OMX_ErrorNone) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Getting profile/level not supported by component");
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ peercaps = gst_pad_peer_query_caps (GST_VIDEO_ENCODER_SRC_PAD (enc), NULL);
|
|
+ if (peercaps) {
|
|
+ GstStructure *s;
|
|
+
|
|
+ intersection =
|
|
+ gst_caps_intersect (peercaps,
|
|
+ gst_pad_get_pad_template_caps (GST_VIDEO_ENCODER_SRC_PAD (enc)));
|
|
+
|
|
+ gst_caps_unref (peercaps);
|
|
+ if (gst_caps_is_empty (intersection)) {
|
|
+ gst_caps_unref (intersection);
|
|
+ GST_ERROR_OBJECT (self, "Empty caps");
|
|
+ return FALSE;
|
|
+ }
|
|
+
|
|
+ s = gst_caps_get_structure (intersection, 0);
|
|
+ profile_string = gst_structure_get_string (s, "profile");
|
|
+ if (profile_string) {
|
|
+ if (g_str_equal (profile_string, "0")) {
|
|
+ param.eProfile = OMX_VIDEO_VP9Profile0;
|
|
+ } else if (g_str_equal (profile_string, "2")) {
|
|
+ param.eProfile = OMX_VIDEO_VP9Profile2;
|
|
+ } else {
|
|
+ goto unsupported_profile;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ gst_caps_unref (intersection);
|
|
+ }
|
|
+
|
|
+ err =
|
|
+ gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->enc,
|
|
+ OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
|
+ if (err == OMX_ErrorUnsupportedIndex) {
|
|
+ GST_WARNING_OBJECT (self,
|
|
+ "Setting profile/level not supported by component");
|
|
+ } else if (err != OMX_ErrorNone) {
|
|
+ GST_ERROR_OBJECT (self,
|
|
+ "Error setting profile %u and level %u: %s (0x%08x)",
|
|
+ (guint) param.eProfile, (guint) param.eLevel,
|
|
+ gst_omx_error_to_string (err), err);
|
|
+ return FALSE;
|
|
+
|
|
+ }
|
|
+
|
|
+ if(!update_mode_vp9(self))
|
|
+ return FALSE;
|
|
+
|
|
+ if(!update_rotation_vp9(self))
|
|
+ return FALSE;
|
|
+
|
|
+ if(!update_flip_vp9(self))
|
|
+ return FALSE;
|
|
+
|
|
+ if(self->set_scale)
|
|
+ if(!update_scale_vp9(self))
|
|
+ return FALSE;
|
|
+
|
|
+ if(self->set_crop)
|
|
+ if(!update_crop_vp9(self))
|
|
+ return FALSE;
|
|
+
|
|
+ gst_omx_port_get_port_definition (GST_OMX_VIDEO_ENC (self)->enc_out_port,
|
|
+ &port_def);
|
|
+
|
|
+ return TRUE;
|
|
+
|
|
+unsupported_profile:
|
|
+ GST_ERROR_OBJECT (self, "Unsupported profile %s", profile_string);
|
|
+ gst_caps_unref (intersection);
|
|
+ return FALSE;
|
|
+
|
|
+/*unsupported_level:
|
|
+ GST_ERROR_OBJECT (self, "Unsupported level %s", level_string);
|
|
+ gst_caps_unref (intersection);
|
|
+ return FALSE;*/
|
|
+}
|
|
+
|
|
+static GstCaps *
|
|
+gst_omx_vp9_enc_get_caps (GstOMXVideoEnc * self, GstOMXPort * port,
|
|
+ GstVideoCodecState * state)
|
|
+{
|
|
+ GstCaps *caps;
|
|
+ OMX_ERRORTYPE err;
|
|
+ OMX_VIDEO_PARAM_VP9TYPE param;
|
|
+ gint profile = 0;
|
|
+ //const gchar *level;
|
|
+
|
|
+ caps = gst_caps_new_empty_simple ("video/x-vp9");
|
|
+ GST_OMX_INIT_STRUCT (¶m);
|
|
+ param.nPortIndex = self->enc_out_port->index;
|
|
+
|
|
+ if (err == OMX_ErrorNone) {
|
|
+ err = gst_omx_component_get_parameter (self->enc, OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
|
+ if (err != OMX_ErrorNone && err != OMX_ErrorUnsupportedIndex
|
|
+ && err != OMX_ErrorNotImplemented)
|
|
+ GST_WARNING_OBJECT (self, "Coudn't get VP9 encoder profile");
|
|
+
|
|
+ if (err == OMX_ErrorNone) {
|
|
+ switch (param.eProfile) {
|
|
+ case OMX_VIDEO_VP9Profile0:
|
|
+ profile = 0;
|
|
+ break;
|
|
+ case OMX_VIDEO_VP9Profile1:
|
|
+ profile = 1;
|
|
+ break;
|
|
+ case OMX_VIDEO_VP9Profile2:
|
|
+ profile = 2;
|
|
+ break;
|
|
+ case OMX_VIDEO_VP9Profile3:
|
|
+ profile = 3;
|
|
+ break;
|
|
+ default:
|
|
+ profile = 0;
|
|
+ break;
|
|
+ }
|
|
+
|
|
+/* switch (param.eLevel) {
|
|
+ case OMX_VIDEO_VP9Level0:
|
|
+ level = "0";
|
|
+ break;
|
|
+ case OMX_VIDEO_VP9Level1:
|
|
+ level = "1";
|
|
+ break;
|
|
+ case OMX_VIDEO_VP9Level2:
|
|
+ level = "2";
|
|
+ break;
|
|
+ case OMX_VIDEO_VP9Level3:
|
|
+ level = "3";
|
|
+ break;
|
|
+ default:
|
|
+ g_assert_not_reached ();
|
|
+ return NULL;
|
|
+ }*/
|
|
+ }
|
|
+
|
|
+ gst_caps_set_simple (caps, "profile", G_TYPE_INT, profile,
|
|
+ /*"level", G_TYPE_STRING, level,*/ NULL);
|
|
+ }
|
|
+ else
|
|
+ GST_WARNING_OBJECT (self, "Coudn't get extension index for OMX_IndexParamVideoProfileLevelCurrent");
|
|
+
|
|
+ return caps;
|
|
+}
|
|
diff -ruN old/omx/gstomxvp9enc.h new/omx/gstomxvp9enc.h
|
|
--- old/omx/gstomxvp9enc.h 1970-01-01 03:00:00.000000000 +0300
|
|
+++ new/omx/gstomxvp9enc.h 2024-03-01 06:33:40.944111873 +0300
|
|
@@ -0,0 +1,212 @@
|
|
+#ifndef __GST_OMX_VP9_ENC_H__
|
|
+#define __GST_OMX_VP9_ENC_H__
|
|
+
|
|
+#include <gst/gst.h>
|
|
+#include "gstomxvideoenc.h"
|
|
+
|
|
+/** VP9 profiles */
|
|
+typedef enum OMX_VIDEO_VP9PROFILETYPE {
|
|
+ OMX_VIDEO_VP9Profile0 = 0x01, /* 8-bit 4:2:0 */
|
|
+ OMX_VIDEO_VP9Profile1 = 0x02, /* 8-bit 4:2:2, 4:4:4, alpha channel */
|
|
+ OMX_VIDEO_VP9Profile2 = 0x04, /* 10-bit/12-bit 4:2:0, YouTube Premium Content Profile */
|
|
+ OMX_VIDEO_VP9Profile3 = 0x08, /* 10-bit/12-bit 4:2:2, 4:4:4, alpha channel */
|
|
+ OMX_VIDEO_VP9ProfileUnknown = 0x6EFFFFFF,
|
|
+ OMX_VIDEO_VP9ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
|
+ OMX_VIDEO_VP9ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
|
+ OMX_VIDEO_VP9ProfileMax = 0x7FFFFFFF
|
|
+} OMX_VIDEO_VP9PROFILETYPE;
|
|
+
|
|
+typedef struct OMX_CONFIG_SCALETYPE {
|
|
+ OMX_U32 nSize;
|
|
+ OMX_VERSIONTYPE nVersion;
|
|
+ OMX_U32 nPortIndex;
|
|
+ OMX_U32 nScaledWidth;
|
|
+ OMX_U32 nScaledHeight;
|
|
+} OMX_CONFIG_SCALETYPE;
|
|
+
|
|
+typedef enum OMX_VIDEO_METRICTYPE {
|
|
+ OMX_VIDEO_VP9MetricPSNR,
|
|
+ OMX_VIDEO_VP9MetricSSIM
|
|
+} OMX_VIDEO_METRICTYPE;
|
|
+
|
|
+typedef enum OMX_VIDEO_FIRSTPASSTYPE {
|
|
+ OMX_VIDEO_VP9FirstpassScale,
|
|
+ OMX_VIDEO_VP9FirstpassCrop
|
|
+} OMX_VIDEO_FIRSTPASSTYPE;
|
|
+
|
|
+/** VP9 Param */
|
|
+typedef struct OMX_VIDEO_PARAM_VP9TYPE {
|
|
+ OMX_U32 nSize;
|
|
+ OMX_VERSIONTYPE nVersion;
|
|
+ OMX_U32 nPortIndex;
|
|
+ OMX_VIDEO_VP9PROFILETYPE eProfile;
|
|
+ OMX_U32 nBitDepthLuma;
|
|
+ OMX_U32 nBitDepthChroma;
|
|
+ OMX_U32 nSkipMode;
|
|
+ OMX_S32 nQpHdr;
|
|
+ OMX_U32 nQpMin;
|
|
+ OMX_U32 nQpMax;
|
|
+ OMX_U32 nGopLength;
|
|
+ OMX_S32 nIntraQpDelta;
|
|
+ OMX_U32 nFixedIntraQp;
|
|
+ OMX_U32 nPFrames;
|
|
+ OMX_U32 nGoldenPictureRate;
|
|
+ OMX_U32 nAdaptiveGoldenUpdate;
|
|
+ OMX_U32 nAdaptiveGoldenBoost;
|
|
+ OMX_U32 nMode;
|
|
+ OMX_U32 nEffort;
|
|
+ OMX_U32 nPasses;
|
|
+ OMX_U32 nPass;
|
|
+ OMX_U32 nInterpolationFilter;
|
|
+ OMX_U32 nFilterLevel;
|
|
+ OMX_U32 nFilterSharpness;
|
|
+ OMX_BOOL bErrorResilientMode;
|
|
+ OMX_BOOL bFrameParallel;
|
|
+ OMX_VIDEO_METRICTYPE eQualityMetric;
|
|
+ OMX_S32 nQpDeltaYDc;
|
|
+ OMX_S32 nQpDeltaChDc;
|
|
+ OMX_S32 nQpDeltaChAc;
|
|
+ OMX_U32 nHighPrecMvEnable;
|
|
+ OMX_U32 nMeChromaWeight;
|
|
+ OMX_BOOL bLossless;
|
|
+ OMX_U32 nLookaheadCount;
|
|
+ OMX_U32 nRefFrameScheme;
|
|
+ OMX_BOOL bArfTemporalFilterEnabled;
|
|
+ OMX_U32 nArfTemporalFilterStrength;
|
|
+ OMX_U32 nArfTemporalFilterLength;
|
|
+ OMX_U32 nArfTemporalFilterThreshold;
|
|
+ OMX_U32 nCqLevel;
|
|
+ OMX_U32 nMinArfPeriod;
|
|
+ OMX_U32 nMaxArfPeriod;
|
|
+ OMX_U32 nColorConversion;
|
|
+ OMX_U32 nFirstpassScale;
|
|
+ OMX_U32 nFirstpassScaleMethod;
|
|
+} OMX_VIDEO_PARAM_VP9TYPE;
|
|
+
|
|
+typedef struct OMX_CONFIG_MODETYPE {
|
|
+ OMX_U32 nSize;
|
|
+ OMX_VERSIONTYPE nVersion;
|
|
+ OMX_U32 nPortIndex;
|
|
+ OMX_MIRRORTYPE eMode;
|
|
+} OMX_CONFIG_MODETYPE;
|
|
+
|
|
+typedef enum OMX_INDEXVSITYPE {
|
|
+ OMX_IndexVsiStartUnused = OMX_IndexVendorStartUnused + 0x00100000,
|
|
+ OMX_IndexParamVideoMvcStream,
|
|
+ OMX_IndexConfigVideoIntraArea,
|
|
+ OMX_IndexConfigVideoRoiArea,
|
|
+ OMX_IndexConfigVideoRoiDeltaQp,
|
|
+ OMX_IndexConfigVideoAdaptiveRoi,
|
|
+ OMX_IndexConfigVideoVp8TemporalLayers,
|
|
+ OMX_IndexParamVideoHevc, /**< reference: OMX_VIDEO_PARAM_HEVCTYPE */
|
|
+ OMX_IndexParamVideoVp9, /**< reference: OMX_VIDEO_PARAM_VP9TYPE */
|
|
+ OMX_IndexParamVideoG2Config,
|
|
+ OMX_IndexParamVideoG1Config,
|
|
+ OMX_IndexConfigVideoVp9Mode,
|
|
+ OMX_IndexConfigVideoVp9Scale
|
|
+} OMX_INDEXVSITYPE;
|
|
+
|
|
+typedef enum OMX_VIDEO_MODETYPE {
|
|
+ OMX_VIDEO_VP9ModeLowLatency,
|
|
+ OMX_VIDEO_VP9ModeRealtime,
|
|
+ OMX_VIDEO_VP9ModeLagged,
|
|
+ OMX_VIDEO_VP9ModeOffline,
|
|
+ OMX_VIDEO_VP9ModeNone
|
|
+} OMX_VIDEO_MODETYPE;
|
|
+
|
|
+G_BEGIN_DECLS
|
|
+#define GST_TYPE_OMX_VP9_ENC \
|
|
+ (gst_omx_vp9_enc_get_type())
|
|
+#define GST_OMX_VP9_ENC(obj) \
|
|
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_VP9_ENC,GstOMXVP9Enc))
|
|
+#define GST_OMX_VP9_ENC_CLASS(klass) \
|
|
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_VP9_ENC,GstOMXVP9EncClass))
|
|
+#define GST_OMX_VP9_ENC_GET_CLASS(obj) \
|
|
+ (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_VP9_ENC,GstOMXVP9EncClass))
|
|
+#define GST_IS_OMX_VP9_ENC(obj) \
|
|
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_VP9_ENC))
|
|
+#define GST_IS_OMX_VP9_ENC_CLASS(obj) \
|
|
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_VP9_ENC))
|
|
+typedef struct _GstOMXVP9Enc GstOMXVP9Enc;
|
|
+typedef struct _GstOMXVP9EncClass GstOMXVP9EncClass;
|
|
+
|
|
+struct _GstOMXVP9Enc
|
|
+{
|
|
+ GstOMXVideoEnc parent;
|
|
+
|
|
+ /* properties */
|
|
+ guint32 effort;
|
|
+ gboolean lossless;
|
|
+ guint32 intra_picture_rate;
|
|
+ gint32 qp_hdr;
|
|
+ guint32 qp_min;
|
|
+ guint32 qp_max;
|
|
+ guint32 rotation;
|
|
+ guint32 passes;
|
|
+ guint32 pass;
|
|
+ guint32 lookahead_count;
|
|
+ gboolean arf_temporal_filter_enabled;
|
|
+ guint32 ref_frame_scheme;
|
|
+ guint32 cq_level;
|
|
+ gint32 intra_qp_delta;
|
|
+ guint32 fixed_intra_qp;
|
|
+ guint32 gop_length;
|
|
+ guint32 min_arf_period;
|
|
+ guint32 max_arf_period;
|
|
+ guint32 arf_temporal_filter_length;
|
|
+ guint32 arf_temporal_filter_strength;
|
|
+ guint32 arf_temporal_filter_threshold;
|
|
+ guint32 golden_picture_rate;
|
|
+ guint32 adaptive_golden_boost;
|
|
+ guint32 adaptive_golden_update;
|
|
+ guint32 filter_level;
|
|
+ guint32 filter_sharpness;
|
|
+ gint32 qp_delta_ydc;
|
|
+ gint32 qp_delta_ch_dc;
|
|
+ gint32 qp_delta_ch_ac;
|
|
+ guint32 interpolation_filter;
|
|
+ guint32 high_prec_mv_enable;
|
|
+ guint32 me_chroma_weight;
|
|
+ guint32 quality_metric;
|
|
+ guint32 color_conversion;
|
|
+ guint32 firstpass_scale;
|
|
+ OMX_VIDEO_FIRSTPASSTYPE scale_method;
|
|
+ gboolean set_scale;
|
|
+ gint32 scaled_width;
|
|
+ gint32 scaled_height;
|
|
+ gboolean set_crop;
|
|
+ gint32 crop_left;
|
|
+ gint32 crop_top;
|
|
+ gint32 crop_width;
|
|
+ gint32 crop_height;
|
|
+ gboolean error_resilient;
|
|
+ gboolean frame_parallel;
|
|
+ OMX_VIDEO_MODETYPE mode;
|
|
+ OMX_MIRRORTYPE flip;
|
|
+ guint32 skip_mode;
|
|
+};
|
|
+
|
|
+typedef enum OMX_COLOR_FORMATVSITYPE {
|
|
+ OMX_COLOR_FormatVsiStartUnused = OMX_COLOR_FormatVendorStartUnused + 0x00100000,
|
|
+ OMX_COLOR_FormatYUV411SemiPlanar,
|
|
+ OMX_COLOR_FormatYUV411PackedSemiPlanar,
|
|
+ OMX_COLOR_FormatYUV440SemiPlanar,
|
|
+ OMX_COLOR_FormatYUV440PackedSemiPlanar,
|
|
+ OMX_COLOR_FormatYUV444SemiPlanar,
|
|
+ OMX_COLOR_FormatYUV444PackedSemiPlanar,
|
|
+ OMX_COLOR_FormatYUV420SemiPlanar4x4Tiled, /* G2 tiled format */
|
|
+ OMX_COLOR_FormatYUV420SemiPlanar8x4Tiled, /* G1 tiled format */
|
|
+ OMX_COLOR_FormatYUV420SemiPlanarP010, /* MS P010 format */
|
|
+ OMX_COLOR_FormatYVU420SemiPlanar, /* NV21 */
|
|
+ OMX_COLOR_Format32bitRGBA8888
|
|
+} OMX_COLOR_FORMATVSITYPE;
|
|
+
|
|
+struct _GstOMXVP9EncClass
|
|
+{
|
|
+ GstOMXVideoEncClass parent_class;
|
|
+};
|
|
+
|
|
+GType gst_omx_vp9_enc_get_type (void);
|
|
+
|
|
+G_END_DECLS
|
|
+#endif /* __GST_OMX_VP9_ENC_H__ */
|
|
diff -ruN old/omx/meson.build new/omx/meson.build
|
|
--- old/omx/meson.build 2024-03-01 06:08:33.108164301 +0300
|
|
+++ new/omx/meson.build 2024-03-01 06:32:32.180114264 +0300
|
|
@@ -18,6 +18,8 @@
|
|
'gstomxh264enc.c',
|
|
'gstomxh263enc.c',
|
|
'gstomxaacdec.c',
|
|
+ 'gstomxvp9dec.c',
|
|
+ 'gstomxvp9enc.c',
|
|
'gstomxmp3dec.c',
|
|
'gstomxaacenc.c',
|
|
'gstomxamrdec.c',
|
|
diff -ruN old/omx/openmax/OMX_Types.h new/omx/openmax/OMX_Types.h
|
|
--- old/omx/openmax/OMX_Types.h 2024-03-01 06:08:33.060164303 +0300
|
|
+++ new/omx/openmax/OMX_Types.h 2024-03-01 08:14:23.155901782 +0300
|
|
@@ -31,6 +31,8 @@
|
|
#ifndef OMX_Types_h
|
|
#define OMX_Types_h
|
|
|
|
+#include <stdint.h>
|
|
+
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
@@ -130,22 +132,22 @@
|
|
*/
|
|
|
|
/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
|
|
-typedef unsigned char OMX_U8;
|
|
+typedef uint8_t OMX_U8;
|
|
|
|
/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
|
|
-typedef signed char OMX_S8;
|
|
+typedef int8_t OMX_S8;
|
|
|
|
/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
|
|
-typedef unsigned short OMX_U16;
|
|
+typedef uint16_t OMX_U16;
|
|
|
|
/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
|
|
-typedef signed short OMX_S16;
|
|
+typedef int16_t OMX_S16;
|
|
|
|
/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
|
|
-typedef unsigned long OMX_U32;
|
|
+typedef uint32_t OMX_U32;
|
|
|
|
/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
|
|
-typedef signed long OMX_S32;
|
|
+typedef int32_t OMX_S32;
|
|
|
|
|
|
/* Users with compilers that cannot accept the "long long" designation should
|
|
@@ -173,10 +175,10 @@
|
|
#else /* WIN32 */
|
|
|
|
/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
|
|
-typedef unsigned long long OMX_U64;
|
|
+typedef uint64_t OMX_U64;
|
|
|
|
/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
|
|
-typedef signed long long OMX_S64;
|
|
+typedef int64_t OMX_S64;
|
|
|
|
#endif /* WIN32 */
|
|
#endif
|
|
diff -ruN old/omx/openmax/OMX_Video.h new/omx/openmax/OMX_Video.h
|
|
--- old/omx/openmax/OMX_Video.h 2024-03-01 06:08:33.060164303 +0300
|
|
+++ new/omx/openmax/OMX_Video.h 2024-03-01 06:33:24.376112449 +0300
|
|
@@ -73,6 +73,16 @@
|
|
OMX_VIDEO_CodingMax = 0x7FFFFFFF
|
|
} OMX_VIDEO_CODINGTYPE;
|
|
|
|
+typedef enum OMX_VIDEO_CODINGVSITYPE {
|
|
+ OMX_VIDEO_CodingVsiStartUnused = OMX_VIDEO_CodingVendorStartUnused + 0x00100000,
|
|
+ OMX_VIDEO_CodingSORENSON,
|
|
+ OMX_VIDEO_CodingDIVX,
|
|
+ OMX_VIDEO_CodingDIVX3,
|
|
+ OMX_VIDEO_CodingVP6,
|
|
+ OMX_VIDEO_CodingAVS,
|
|
+ OMX_VIDEO_CodingHEVC,
|
|
+ OMX_VIDEO_CodingVP9
|
|
+} OMX_VIDEO_CODINGVSITYPE;
|
|
|
|
/**
|
|
* Data structure used to define a video path. The number of Video paths for
|