From: Fish Lin <linfish@google.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
Keiichi Watanabe <keiichiw@chromium.org>,
Will Deacon <will.deacon@arm.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Tomasz Figa <tfiga@chromium.org>,
Smitha T Murthy <smitha.t@samsung.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Fish Lin <linfish@google.com>
Subject: [PATCH] media: v4l-ctrl: add control for variable frame rate
Date: Wed, 20 Mar 2019 11:10:22 +0800 [thread overview]
Message-ID: <20190320031022.174052-1-linfish@google.com> (raw)
These flag are added
* V4L2_CID_MPEG_VIDEO_VFR_ENABLE
* V4L2_CID_MPEG_VIDEO_VFR_MIN_FRAMERATE
One is to set variable frame rate enable or not, another is to control
minimal frame rate that video encoder should keep per second.
Signed-off-by: Fish Lin <linfish@google.com>
---
Documentation/media/uapi/v4l/ext-ctrls-codec.rst | 9 +++++++++
drivers/media/v4l2-core/v4l2-ctrls.c | 3 +++
include/uapi/linux/v4l2-controls.h | 3 +++
3 files changed, 15 insertions(+)
diff --git a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
index c97fb7923be5..4bc013d71b67 100644
--- a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
+++ b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
@@ -620,7 +620,16 @@ enum v4l2_mpeg_video_bitrate_mode -
* - Bit 24:31
- Must be zero.
+.. _v4l2-mpeg-video-variable-framerate:
+``V4L2_CID_MPEG_VIDEO_VFR_ENABLE (boolean)``
+ Set variable framerate enable or not. When enabled, video encoder is able
+ to drop frames based on some mechanism, like frame similarity or bitrate
+ control (default disable).
+
+``V4L2_CID_MPEG_VIDEO_VFR_MIN_FRAMERATE (integer)``
+ Minimal kept frame per second when variable framerate is enabled (default
+ is input framerate).
.. _v4l2-mpeg-video-dec-pts:
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index b79d3bbd8350..566c6552c9a0 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -786,6 +786,8 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: return "H264 MB Level Rate Control";
case V4L2_CID_MPEG_VIDEO_HEADER_MODE: return "Sequence Header Mode";
case V4L2_CID_MPEG_VIDEO_MAX_REF_PIC: return "Max Number of Reference Pics";
+ case V4L2_CID_MPEG_VIDEO_VFR_ENABLE: return "Variable Frame Rate Enable";
+ case V4L2_CID_MPEG_VIDEO_VFR_MIN_FRAMERATE: return "VFR Minimal Frame Rate";
case V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP: return "H263 I-Frame QP Value";
case V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP: return "H263 P-Frame QP Value";
case V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP: return "H263 B-Frame QP Value";
@@ -1108,6 +1110,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE:
case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE:
case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE:
+ case V4L2_CID_MPEG_VIDEO_VFR_ENABLE:
case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 06479f2fb3ae..f1bf52eb0152 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -404,6 +404,9 @@ enum v4l2_mpeg_video_multi_slice_mode {
#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228)
#define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229)
+#define V4L2_CID_MPEG_VIDEO_VFR_ENABLE (V4L2_CID_MPEG_BASE + 250)
+#define V4L2_CID_MPEG_VIDEO_VFR_MIN_FRAMERATE (V4L2_CID_MPEG_BASE + 251)
+
#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
--
2.21.0.225.g810b269d1ac-goog
next reply other threads:[~2019-03-20 3:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-20 3:10 Fish Lin [this message]
2019-03-28 14:57 ` [PATCH] media: v4l-ctrl: add control for variable frame rate Hans Verkuil
2019-03-29 2:46 ` Fish Lin
2019-06-29 8:54 ` Paul Kocialkowski
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=20190320031022.174052-1-linfish@google.com \
--to=linfish@google.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=keiichiw@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=paul.kocialkowski@bootlin.com \
--cc=sakari.ailus@linux.intel.com \
--cc=smitha.t@samsung.com \
--cc=tfiga@chromium.org \
--cc=will.deacon@arm.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox