Re: [PATCH 1/2] media: v4l2-ctrls: add encoder maximum bitrate control
From: Nicolas Dufresne
Date: Fri Feb 13 2026 - 14:29:11 EST
Le vendredi 13 février 2026 à 11:34 +0530, Sachin Kumar Garg a écrit :
> Introduce V4L2_MPEG_VIDEO_BITRATE_MODE_MBR rate control for Encoder.
> Encoder will choose appropriate quantization parameter and do the
> smart bit allocation to set the frame maximum bitrate level as per
> the Bitrate value configured.
>
> Signed-off-by: Sachin Kumar Garg <sachin.garg@xxxxxxxxxxxxxxxx>
> ---
> Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 7 +++++++
> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 +
> include/uapi/linux/v4l2-controls.h | 1 +
> 3 files changed, 9 insertions(+)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index c8890cb5e00a..6b2dfabfc4fd 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -577,6 +577,13 @@ enum v4l2_mpeg_video_bitrate_mode -
> - Constant bitrate
> * - ``V4L2_MPEG_VIDEO_BITRATE_MODE_CQ``
> - Constant quality
> + * - ``V4L2_MPEG_VIDEO_BITRATE_MODE_MBR``
> + MBR Rate Control is a VBR Rate Control mode optimized for
> + surveillance video contents which has high temporal correlation
> + due to static camera positions. This Rate Control smartly identifies
> + key-frames in the scene, and allocates more bits to them to improve
> + the coding efficiency by taking advantage of high temporal
> + correlation in surveillance videos.
This is a bit vague, and it sounds like how you'd describe a proprietary thing.
Are you sure this is a generic mode that other vendors will support ? If not,
perhaps it should be visible in the API ?
Nicolas
>
>
>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-
> core/v4l2-ctrls-defs.c
> index 551426c4cd01..b336171539a7 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> @@ -154,6 +154,7 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
> "Variable Bitrate",
> "Constant Bitrate",
> "Constant Quality",
> + "Maximum Bitrate",
> NULL
> };
> static const char * const mpeg_stream_type[] = {
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-
> controls.h
> index 68dd0c4e47b2..614fc2c4c81d 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -412,6 +412,7 @@ enum v4l2_mpeg_video_bitrate_mode {
> V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
> V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
> V4L2_MPEG_VIDEO_BITRATE_MODE_CQ = 2,
> + V4L2_MPEG_VIDEO_BITRATE_MODE_MBR = 3,
> };
> #define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_CODEC_BASE+207)
> #define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_CODEC_BASE+208)
Attachment:
signature.asc
Description: This is a digitally signed message part