mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Maheshwar Ajja <majja@codeaurora.org>,
	mchehab@kernel.org, ezequiel@collabora.com,
	p.zabel@pengutronix.de, paul.kocialkowski@bootlin.com,
	jonas@kwiboo.se, posciak@chromium.org,
	boris.brezillon@collabora.com, ribalda@kernel.org,
	tglx@linutronix.de, sumitg@nvidia.com,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: v4l2-ctrls: add encoder skip frames control
Date: Tue, 19 May 2020 08:53:09 +0200	[thread overview]
Message-ID: <ba650d43-2d1d-bba7-383a-db55e9ce4f8a@xs4all.nl> (raw)
In-Reply-To: <1589853951-27948-1-git-send-email-majja@codeaurora.org>

On 19/05/2020 04:05, Maheshwar Ajja wrote:
> If V4L2_CID_MPEG_VIDEO_ENC_SKIP_FRAMES control is enabled
> encoder can drop frames, if required, to achieve target bitrate
> instead of modifying the quantization parameter which lowers
> the encoded frame quality.
> 
> Reference: 4.3.8.1 OMX_Video_ControlRateConstantSkipFrames
> https://www.khronos.org/registry/OpenMAX-IL/specs/OpenMAX_IL_1_1_2_Specification.pdf
> 
> Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
> ---
>  Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 7 +++++++
>  drivers/media/v4l2-core/v4l2-ctrls.c                      | 2 ++
>  include/uapi/linux/v4l2-controls.h                        | 1 +
>  3 files changed, 10 insertions(+)
> 
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index d0d506a..bc9265d 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -1081,6 +1081,13 @@ enum v4l2_mpeg_video_h264_entropy_mode -
>      Macroblock level rate control enable. Applicable to the MPEG4 and
>      H264 encoders.
>  
> +``V4L2_CID_MPEG_VIDEO_ENC_SKIP_FRAMES (boolean)``
> +    Encoder skip frames enable. This control is applicable only if
> +    ``V4L2_CID_MPEG_VIDEO_BITRATE_MODE`` control is set. If this control
> +    is enabled encoder can drop frames, if required, to achieve target
> +    bitrate instead of modifying the quantization parameter which lowers
> +    the encoded frame quality.

It's a bit unclear for which bitrate modes this control is valid: only for
MODE_CBR, or also for the constant quality bitrate mode? Or both?

The phrase 'control is set' is meaningless for a menu control: it really is
always 'set'. So that needs to be reworked so it is more explicit.

Also note that there is an Exynos MFC control that appears to do something
similar: V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE.

To what extent does that overlap with the functionality proposed here?

It looks like this proposed control is basically the equivalent of setting
V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE to V4L2_MPEG_MFC51_FRAME_SKIP_MODE_LEVEL_LIMIT.

So perhaps this MFC control should be promoted to a standard MPEG control instead
of inventing a new control?

Regards,

	Hans

> +
>  ``V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (boolean)``
>      Quarter pixel motion estimation for MPEG4. Applicable to the MPEG4
>      encoder.
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 1c617b4..d2cb766 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -914,6 +914,7 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_MPEG_VIDEO_FWHT_PARAMS:			return "FWHT Stateless Parameters";
>  	case V4L2_CID_FWHT_I_FRAME_QP:				return "FWHT I-Frame QP Value";
>  	case V4L2_CID_FWHT_P_FRAME_QP:				return "FWHT P-Frame QP Value";
> +	case V4L2_CID_MPEG_VIDEO_ENC_SKIP_FRAMES:		return "Encoder Skip Frames";
>  
>  	/* VPX controls */
>  	case V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS:		return "VPX Number of Partitions";
> @@ -1180,6 +1181,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_ENC_SKIP_FRAMES:
>  	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 0ba1005..d3bc015 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -742,6 +742,7 @@ enum v4l2_cid_mpeg_video_hevc_size_of_length_field {
>  #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BR	(V4L2_CID_MPEG_BASE + 642)
>  #define V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES	(V4L2_CID_MPEG_BASE + 643)
>  #define V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR	(V4L2_CID_MPEG_BASE + 644)
> +#define V4L2_CID_MPEG_VIDEO_ENC_SKIP_FRAMES		(V4L2_CID_MPEG_BASE + 645)
>  
>  /*  MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
>  #define V4L2_CID_MPEG_CX2341X_BASE				(V4L2_CTRL_CLASS_MPEG | 0x1000)
> 


      reply	other threads:[~2020-05-19  6:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  2:05 Maheshwar Ajja
2020-05-19  6:53 ` Hans Verkuil [this message]

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=ba650d43-2d1d-bba7-383a-db55e9ce4f8a@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=boris.brezillon@collabora.com \
    --cc=ezequiel@collabora.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=majja@codeaurora.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=posciak@chromium.org \
    --cc=ribalda@kernel.org \
    --cc=sumitg@nvidia.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®