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@oss.qualcomm.com>
---
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.
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)
--
2.34.1
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@oss.qualcomm.com>
> ---
> 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)
On 2/14/2026 12:59 AM, Nicolas Dufresne wrote:
> 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@oss.qualcomm.com>
>> ---
>> 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
Hi Nicolas, sorry for the late reply — we were aligning internally on
the exact behavior and naming. This is Qualcomm defined Rate control.
This is mainly useful for very low bitrate / high temporal-correlation
content (e.g., static camera).
If the consensus is that this is not generic enough across vendors, we
can instead expose it as a driver-specific control rather than a new
global V4L2 bitrate mode.
Thanks,
Sachin
>
>>
>>
>>
>> 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)
Hi Sachin, kernel test robot noticed the following build errors: [auto build test ERROR on c824345288d11e269ce41b36c105715bc2286050] url: https://github.com/intel-lab-lkp/linux/commits/Sachin-Kumar-Garg/media-v4l2-ctrls-add-encoder-maximum-bitrate-control/20260213-180753 base: c824345288d11e269ce41b36c105715bc2286050 patch link: https://lore.kernel.org/r/20260213-b4-add_sc7280_mbr-v1-1-e8d95b4e4809%40oss.qualcomm.com patch subject: [PATCH 1/2] media: v4l2-ctrls: add encoder maximum bitrate control compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) docutils: docutils (Docutils 0.21.2, Python 3.13.5, on linux) reproduce: (https://download.01.org/0day-ci/archive/20260213/202602131921.PUY3mqyw-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202602131921.PUY3mqyw-lkp@intel.com/ All error/warnings (new ones prefixed by >>): The parent of level 2 sections cannot be reached. The parser is at section level 2 but the current node has only 0 parent section(s). One reason may be a high level section used in a directive that parses its content into a base node not attached to the document (up to Docutils 0.21, these sections were silently dropped). [docutils] WARNING: ./net/bridge/br_private.h:267 struct member 'tunnel_hash' not described in 'net_bridge_vlan_group' >> Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst:581: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] >> Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst:570: ERROR: Error parsing content block for the "flat-table" directive: two-level bullet list expected, but row 4 does not contain a second-level bullet list. vim +570 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 561 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 562 ``V4L2_CID_MPEG_VIDEO_BITRATE_MODE`` 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 563 (enum) 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 564 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 565 enum v4l2_mpeg_video_bitrate_mode - 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 566 Video bitrate mode. Possible values are: 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 567 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 568 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 569 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 @570 .. flat-table:: 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 571 :header-rows: 0 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 572 :stub-columns: 0 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 573 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 574 * - ``V4L2_MPEG_VIDEO_BITRATE_MODE_VBR`` 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 575 - Variable bitrate 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 576 * - ``V4L2_MPEG_VIDEO_BITRATE_MODE_CBR`` 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 577 - Constant bitrate 4ad1b0d410c88c Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Maheshwar Ajja 2020-05-23 578 * - ``V4L2_MPEG_VIDEO_BITRATE_MODE_CQ`` 4ad1b0d410c88c Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Maheshwar Ajja 2020-05-23 579 - Constant quality 9e046466b28d68 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Sachin Kumar Garg 2026-02-13 580 * - ``V4L2_MPEG_VIDEO_BITRATE_MODE_MBR`` 9e046466b28d68 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Sachin Kumar Garg 2026-02-13 @581 MBR Rate Control is a VBR Rate Control mode optimized for 9e046466b28d68 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Sachin Kumar Garg 2026-02-13 582 surveillance video contents which has high temporal correlation 9e046466b28d68 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Sachin Kumar Garg 2026-02-13 583 due to static camera positions. This Rate Control smartly identifies 9e046466b28d68 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Sachin Kumar Garg 2026-02-13 584 key-frames in the scene, and allocates more bits to them to improve 9e046466b28d68 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Sachin Kumar Garg 2026-02-13 585 the coding efficiency by taking advantage of high temporal 9e046466b28d68 Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst Sachin Kumar Garg 2026-02-13 586 correlation in surveillance videos. 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 587 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 588 4f14e3272f1ca1 Documentation/media/uapi/v4l/ext-ctrls-codec.rst Hans Verkuil 2019-02-08 589 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.