mbox series

[RFC,0/6] Add video encoder ROI ctrls

Message ID 20241017091951.2160314-1-ming.qian@nxp.com
Headers show
Series Add video encoder ROI ctrls | expand

Message

Ming Qian Oct. 17, 2024, 9:19 a.m. UTC
Hi,
This patch set implements region of interest (ROI) ctrls for video
encoder.

One video encoder IP may support the following two ROI configurations or
one of them:
    1. configure ROI as a rectangular region, and set a QP offset parameter.
    2. configure ROI as a QP map as an array. Each value represents the QP
offset of a block in raster scan order. The block size is determined by
the specific IP.

To achieve this, I made the following change:
    1. Add a new ctrl type V4L2_CTRL_TYPE_REGION to describe rectangular ROI
    2. Define a ctrl V4L2_CID_MPEG_VIDEO_ROI_MODE to choose ROI
configuration
    3. Define 2 ctrl to configure ROI
    4. Define a ctrl V4L2_CID_MPEG_VIDEO_ROI_MAP_BLOCK_SIZE to query block
size

I referred the patchset "Implement UVC v1.5 ROI" (https://lwn.net/Articles/953532/)
and pick some patches from it.

Hans Verkuil (1):
  v4l2-ctrls: add support for V4L2_CTRL_WHICH_MIN/MAX_VAL

Ming Qian (3):
  media: v4l2-ctrls: Add V4L2_CTRL_TYPE_REGION
  media: v4l2-ctrls: Add video roi ctrls
  media: vivid: Add a video region ctrl

Yunke Cao (2):
  media: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT
  media: vivid: Add an rectangle control

 .../media/v4l/ext-ctrls-codec.rst             |  73 +++++++
 .../media/v4l/vidioc-g-ext-ctrls.rst          |  30 ++-
 .../media/v4l/vidioc-queryctrl.rst            |  26 +++
 .../media/videodev2.h.rst.exceptions          |   5 +
 drivers/media/i2c/imx214.c                    |   4 +-
 .../media/platform/qcom/venus/venc_ctrls.c    |   9 +-
 .../media/test-drivers/vivid/vivid-ctrls.c    |  62 ++++++
 drivers/media/v4l2-core/v4l2-ctrls-api.c      |  54 +++++-
 drivers/media/v4l2-core/v4l2-ctrls-core.c     | 179 +++++++++++++++---
 drivers/media/v4l2-core/v4l2-ctrls-defs.c     |  29 +++
 drivers/media/v4l2-core/v4l2-ioctl.c          |   4 +-
 include/media/v4l2-ctrls.h                    |  40 +++-
 include/uapi/linux/v4l2-controls.h            |  10 +
 include/uapi/linux/videodev2.h                |  13 ++
 14 files changed, 490 insertions(+), 48 deletions(-)