* [PATCH v0 0/3] Add encoder features
@ 2026-03-19 5:32 Jackson.lee
2026-03-19 5:32 ` [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection Jackson.lee
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Jackson.lee @ 2026-03-19 5:32 UTC (permalink / raw)
To: mchehab, hverkuil-cisco, nicolas.dufresne, bob.beckett
Cc: linux-media, linux-kernel, jackson.lee, lafley.kim, b-brnich,
hverkuil, nas.chung
From: Jackson Lee <jackson.lee@chipsnmedia.com>
This series adds several encoder-side enhancements for the Wave5 driver.
The following features are introduced:
- Background detection support via V4L2 controls
- CBP profile support
- Support for packed YUV422 formats
Background detection allows the encoder to differentiate between
foreground and background regions, potentially improving compression
efficiency depending on the use case.
CBP profile support extends compatibility with additional encoding
profiles.
Support for packed YUV422 formats enables handling of commonly used
input formats such as YUYV and YVYU.
The changes include updates to control definitions, documentation,
and driver implementation.
Tested on Wave5 encoder pipeline with GStreamer.
Jackson Lee (3):
media: chips-media: wave5: Add Support for Background Detection
media: chips-media: wave5: Support CBP profile
media: chips-media: wave5: Add Support for Packed YUV422 Formats
.../media/v4l/ext-ctrls-codec.rst | 5 ++
.../platform/chips-media/wave5/wave5-helper.h | 2 +-
.../platform/chips-media/wave5/wave5-hw.c | 7 ++-
.../chips-media/wave5/wave5-vpu-enc.c | 49 +++++++++++++++++--
.../platform/chips-media/wave5/wave5-vpuapi.h | 2 +
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 +
include/uapi/linux/v4l2-controls.h | 2 +
7 files changed, 64 insertions(+), 5 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection
2026-03-19 5:32 [PATCH v0 0/3] Add encoder features Jackson.lee
@ 2026-03-19 5:32 ` Jackson.lee
2026-03-19 21:17 ` Nicolas Dufresne
2026-03-20 6:37 ` jackson.lee
2026-03-19 5:32 ` [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile Jackson.lee
2026-03-19 5:32 ` [PATCH v0 3/3] media: chips-media: wave5: Add Support for Packed YUV422 Formats Jackson.lee
2 siblings, 2 replies; 14+ messages in thread
From: Jackson.lee @ 2026-03-19 5:32 UTC (permalink / raw)
To: mchehab, hverkuil-cisco, nicolas.dufresne, bob.beckett
Cc: linux-media, linux-kernel, jackson.lee, lafley.kim, b-brnich,
hverkuil, nas.chung
From: Jackson Lee <jackson.lee@chipsnmedia.com>
Wave5 encoder can be configured to detect a background region in a frame.
If a background region is detected, it will use less bits or skip mode to
encode that region. This can assist in lowering the video bitrate for a
given stream.
Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
---
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 5 +++++
drivers/media/platform/chips-media/wave5/wave5-hw.c | 4 +++-
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 7 +++++++
drivers/media/platform/chips-media/wave5/wave5-vpuapi.h | 1 +
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++
include/uapi/linux/v4l2-controls.h | 2 ++
6 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index c8890cb5e00a..b992a0d5c7bf 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -605,6 +605,11 @@ enum v4l2_mpeg_video_frame_skip_mode -
chosen data limit then the frame will be skipped. Possible values
are:
+``V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION (boolean)``
+ If enabled then, the encoder detect a background region in frame and
+ use low bits or skip mode to encode the background region.
+ If a lot of scenes are stationary or background, It may help to
+ reduce the video bitrate. Applicable to the encoder.
.. tabularcolumns:: |p{8.2cm}|p{9.3cm}|
diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c b/drivers/media/platform/chips-media/wave5/wave5-hw.c
index 687ce6ccf3ae..c516d125f553 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-hw.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c
@@ -49,6 +49,7 @@
#define FASTIO_ADDRESS_MASK GENMASK(15, 0)
#define SEQ_PARAM_PROFILE_MASK GENMASK(30, 24)
+#define SEQ_BG_PARAM_REG_DATA 0x3800410
static void _wave5_print_reg_err(struct vpu_device *vpu_dev, u32 reg_fail_reason,
const char *func);
@@ -1838,7 +1839,8 @@ int wave5_vpu_enc_init_seq(struct vpu_instance *inst)
vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_RC_BIT_RATIO_LAYER_4_7, 0);
vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_ROT_PARAM, rot_mir_mode);
- vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_BG_PARAM, 0);
+ vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_BG_PARAM,
+ SEQ_BG_PARAM_REG_DATA | p_param->bg_detection);
vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_CUSTOM_LAMBDA_ADDR, 0);
vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_CONF_WIN_TOP_BOT,
p_param->conf_win_bot << 16 | p_param->conf_win_top);
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
index 7613fcdbafed..6fe01217233f 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
@@ -780,6 +780,9 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_BITRATE:
inst->bit_rate = ctrl->val;
break;
+ case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION:
+ inst->enc_param.bg_detection = ctrl->val;
+ break;
case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
inst->enc_param.avc_idr_period = ctrl->val;
break;
@@ -1205,6 +1208,7 @@ static int wave5_set_enc_openparam(struct enc_open_param *open_param,
open_param->wave_param.beta_offset_div2 = input.beta_offset_div2;
open_param->wave_param.decoding_refresh_type = input.decoding_refresh_type;
open_param->wave_param.intra_period = input.intra_period;
+ open_param->wave_param.bg_detection = input.bg_detection;
if (inst->std == W_HEVC_ENC) {
if (input.intra_period == 0) {
open_param->wave_param.decoding_refresh_type = DEC_REFRESH_TYPE_IDR;
@@ -1700,6 +1704,9 @@ static int wave5_vpu_open_enc(struct file *filp)
v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
V4L2_CID_MPEG_VIDEO_AU_DELIMITER,
0, 1, 1, 1);
+ v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
+ V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION,
+ 0, 1, 1, 0);
v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
V4L2_CID_HFLIP,
0, 1, 1, 0);
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
index c64135769869..dc31689e0d27 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
@@ -570,6 +570,7 @@ struct enc_wave_param {
u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8 transform */
u32 mb_level_rc_enable: 1; /* enable MB-level rate control */
u32 forced_idr_header_enable: 1; /* enable header encoding before IDR frame */
+ u32 bg_detection: 1; /* enable background detection */
};
struct enc_open_param {
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index 551426c4cd01..e062f2088490 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -889,6 +889,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY: return "Display Delay";
case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE: return "Display Delay Enable";
case V4L2_CID_MPEG_VIDEO_AU_DELIMITER: return "Generate Access Unit Delimiters";
+ case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION: return "Background Detection";
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";
@@ -1296,6 +1297,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:
case V4L2_CID_MPEG_VIDEO_AU_DELIMITER:
+ case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION:
case V4L2_CID_WIDE_DYNAMIC_RANGE:
case V4L2_CID_IMAGE_STABILIZATION:
case V4L2_CID_RDS_RECEPTION:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 68dd0c4e47b2..939f796261c0 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -464,6 +464,8 @@ enum v4l2_mpeg_video_intra_refresh_period_type {
V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1,
};
+#define V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION (V4L2_CID_CODEC_BASE+238)
+
/* CIDs for the MPEG-2 Part 2 (H.262) codec */
#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270)
enum v4l2_mpeg_video_mpeg2_level {
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile
2026-03-19 5:32 [PATCH v0 0/3] Add encoder features Jackson.lee
2026-03-19 5:32 ` [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection Jackson.lee
@ 2026-03-19 5:32 ` Jackson.lee
2026-03-19 12:32 ` Nicolas Dufresne
2026-03-19 5:32 ` [PATCH v0 3/3] media: chips-media: wave5: Add Support for Packed YUV422 Formats Jackson.lee
2 siblings, 1 reply; 14+ messages in thread
From: Jackson.lee @ 2026-03-19 5:32 UTC (permalink / raw)
To: mchehab, hverkuil-cisco, nicolas.dufresne, bob.beckett
Cc: linux-media, linux-kernel, jackson.lee, lafley.kim, b-brnich,
hverkuil, nas.chung
From: Jackson Lee <jackson.lee@chipsnmedia.com>
Constrained Baseline Profile (CBP) and Baseline Profile (BP) have been
treated as the same.
Introduce the ability to differentiate between the two.
Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
---
drivers/media/platform/chips-media/wave5/wave5-hw.c | 3 +++
.../media/platform/chips-media/wave5/wave5-vpu-enc.c | 10 +++++++---
.../media/platform/chips-media/wave5/wave5-vpuapi.h | 1 +
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c b/drivers/media/platform/chips-media/wave5/wave5-hw.c
index c516d125f553..2392bce8d840 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-hw.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c
@@ -1763,6 +1763,9 @@ int wave5_vpu_enc_init_seq(struct vpu_instance *inst)
(p_param->skip_intra_trans << 25) |
(p_param->strong_intra_smooth_enable << 27) |
(p_param->en_still_picture << 30);
+ else if (inst->std == W_AVC_ENC)
+ reg_val |= (p_param->constraint_set1_flag << 29);
+
vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_SPS_PARAM, reg_val);
reg_val = (p_param->lossless_enable) |
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
index 6fe01217233f..f315ed7243a7 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
@@ -939,6 +939,8 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE:
inst->enc_param.profile = H264_PROFILE_BP;
inst->bit_depth = 8;
+ if (ctrl->val == V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE)
+ inst->enc_param.constraint_set1_flag = 1;
break;
case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN:
inst->enc_param.profile = H264_PROFILE_MP;
@@ -1214,9 +1216,11 @@ static int wave5_set_enc_openparam(struct enc_open_param *open_param,
open_param->wave_param.decoding_refresh_type = DEC_REFRESH_TYPE_IDR;
open_param->wave_param.intra_period = input.avc_idr_period;
}
- } else {
+ } else if (inst->std == W_AVC_ENC)
+ open_param->wave_param.constraint_set1_flag = input.constraint_set1_flag;
+ else
open_param->wave_param.avc_idr_period = input.avc_idr_period;
- }
+
open_param->wave_param.entropy_coding_mode = input.entropy_coding_mode;
open_param->wave_param.lossless_enable = input.lossless_enable;
open_param->wave_param.const_intra_pred_flag = input.const_intra_pred_flag;
@@ -1687,7 +1691,7 @@ static int wave5_vpu_open_enc(struct file *filp)
-6, 6, 1, 0);
v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM,
- 0, 1, 1, 1);
+ 0, 1, 1, 0);
v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION,
0, 1, 1, 0);
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
index dc31689e0d27..7b08fef58217 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
@@ -570,6 +570,7 @@ struct enc_wave_param {
u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8 transform */
u32 mb_level_rc_enable: 1; /* enable MB-level rate control */
u32 forced_idr_header_enable: 1; /* enable header encoding before IDR frame */
+ u32 constraint_set1_flag: 1; /* enable CBP */
u32 bg_detection: 1; /* enable background detection */
};
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v0 3/3] media: chips-media: wave5: Add Support for Packed YUV422 Formats
2026-03-19 5:32 [PATCH v0 0/3] Add encoder features Jackson.lee
2026-03-19 5:32 ` [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection Jackson.lee
2026-03-19 5:32 ` [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile Jackson.lee
@ 2026-03-19 5:32 ` Jackson.lee
2026-03-19 21:18 ` Nicolas Dufresne
2 siblings, 1 reply; 14+ messages in thread
From: Jackson.lee @ 2026-03-19 5:32 UTC (permalink / raw)
To: mchehab, hverkuil-cisco, nicolas.dufresne, bob.beckett
Cc: linux-media, linux-kernel, jackson.lee, lafley.kim, b-brnich,
hverkuil, nas.chung
From: Jackson Lee <jackson.lee@chipsnmedia.com>
Wave5 encoder is capable of reading in numerous raw pixel formats.
Expose these formats and properly configure encoder if selected.
Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
---
.../platform/chips-media/wave5/wave5-helper.h | 2 +-
.../chips-media/wave5/wave5-vpu-enc.c | 32 +++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.h b/drivers/media/platform/chips-media/wave5/wave5-helper.h
index d61fdbda359d..e6f241012c3b 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-helper.h
+++ b/drivers/media/platform/chips-media/wave5/wave5-helper.h
@@ -11,7 +11,7 @@
#include "wave5-vpu.h"
#define FMT_TYPES 2
-#define MAX_FMTS 12
+#define MAX_FMTS 16
const char *state_to_str(enum vpu_instance_state state);
void wave5_cleanup_instance(struct vpu_instance *inst, struct file *filp);
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
index f315ed7243a7..b24c65f174ea 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
@@ -90,6 +90,22 @@ static const struct vpu_format enc_fmt_list[FMT_TYPES][MAX_FMTS] = {
.v4l2_pix_fmt = V4L2_PIX_FMT_NV61M,
.v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
},
+ {
+ .v4l2_pix_fmt = V4L2_PIX_FMT_YUYV,
+ .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
+ },
+ {
+ .v4l2_pix_fmt = V4L2_PIX_FMT_YVYU,
+ .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
+ },
+ {
+ .v4l2_pix_fmt = V4L2_PIX_FMT_UYVY,
+ .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
+ },
+ {
+ .v4l2_pix_fmt = V4L2_PIX_FMT_VYUY,
+ .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
+ },
}
};
@@ -1161,6 +1177,22 @@ static int wave5_set_enc_openparam(struct enc_open_param *open_param,
else
open_param->src_format = FORMAT_420;
+ switch (info->format) {
+ case V4L2_PIX_FMT_YUYV:
+ open_param->packed_format = PACKED_YUYV;
+ break;
+ case V4L2_PIX_FMT_YVYU:
+ open_param->packed_format = PACKED_YVYU;
+ break;
+ case V4L2_PIX_FMT_UYVY:
+ open_param->packed_format = PACKED_UYVY;
+ break;
+ case V4L2_PIX_FMT_VYUY:
+ open_param->packed_format = PACKED_VYUY;
+ break;
+ default:
+ break;
+ }
open_param->wave_param.gop_preset_idx = PRESET_IDX_IPP_SINGLE;
open_param->wave_param.hvs_qp_scale = 2;
open_param->wave_param.hvs_max_delta_qp = 10;
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile
2026-03-19 5:32 ` [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile Jackson.lee
@ 2026-03-19 12:32 ` Nicolas Dufresne
2026-03-20 1:23 ` jackson.lee
0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 12:32 UTC (permalink / raw)
To: Jackson.lee, mchehab, hverkuil-cisco, bob.beckett
Cc: linux-media, linux-kernel, lafley.kim, b-brnich, hverkuil,
nas.chung
[-- Attachment #1: Type: text/plain, Size: 4412 bytes --]
Hi Jackson,
Le jeudi 19 mars 2026 à 14:32 +0900, Jackson.lee a écrit :
> From: Jackson Lee <jackson.lee@chipsnmedia.com>
>
> Constrained Baseline Profile (CBP) and Baseline Profile (BP) have been
> treated as the same.
> Introduce the ability to differentiate between the two.
>
> Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
> Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
Should we consider this one has a bug fix ? I suspect previously
constraint_set1_flag was never set in the bitstream, and now it is set
accordingly to the selected profile, which fixes a miss-match of user
expectation vs bitstream values. If you agree with this, a Fixes: tag would be
nice.
> ---
> drivers/media/platform/chips-media/wave5/wave5-hw.c | 3 +++
> .../media/platform/chips-media/wave5/wave5-vpu-enc.c | 10 +++++++---
> .../media/platform/chips-media/wave5/wave5-vpuapi.h | 1 +
> 3 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c b/drivers/media/platform/chips-media/wave5/wave5-hw.c
> index c516d125f553..2392bce8d840 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-hw.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c
> @@ -1763,6 +1763,9 @@ int wave5_vpu_enc_init_seq(struct vpu_instance *inst)
> (p_param->skip_intra_trans << 25) |
> (p_param->strong_intra_smooth_enable << 27) |
> (p_param->en_still_picture << 30);
> + else if (inst->std == W_AVC_ENC)
> + reg_val |= (p_param->constraint_set1_flag << 29);
> +
> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_SPS_PARAM, reg_val);
>
> reg_val = (p_param->lossless_enable) |
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> index 6fe01217233f..f315ed7243a7 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> @@ -939,6 +939,8 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl *ctrl)
> case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE:
> inst->enc_param.profile = H264_PROFILE_BP;
> inst->bit_depth = 8;
> + if (ctrl->val == V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE)
> + inst->enc_param.constraint_set1_flag = 1;
> break;
> case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN:
> inst->enc_param.profile = H264_PROFILE_MP;
> @@ -1214,9 +1216,11 @@ static int wave5_set_enc_openparam(struct enc_open_param *open_param,
> open_param->wave_param.decoding_refresh_type = DEC_REFRESH_TYPE_IDR;
> open_param->wave_param.intra_period = input.avc_idr_period;
> }
> - } else {
> + } else if (inst->std == W_AVC_ENC)
> + open_param->wave_param.constraint_set1_flag = input.constraint_set1_flag;
> + else
> open_param->wave_param.avc_idr_period = input.avc_idr_period;
> - }
nit: Just keep the bracket, so that all branches have brackets.
cheers,
Nicolas
> +
> open_param->wave_param.entropy_coding_mode = input.entropy_coding_mode;
> open_param->wave_param.lossless_enable = input.lossless_enable;
> open_param->wave_param.const_intra_pred_flag = input.const_intra_pred_flag;
> @@ -1687,7 +1691,7 @@ static int wave5_vpu_open_enc(struct file *filp)
> -6, 6, 1, 0);
> v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM,
> - 0, 1, 1, 1);
> + 0, 1, 1, 0);
> v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION,
> 0, 1, 1, 0);
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> index dc31689e0d27..7b08fef58217 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> @@ -570,6 +570,7 @@ struct enc_wave_param {
> u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8 transform */
> u32 mb_level_rc_enable: 1; /* enable MB-level rate control */
> u32 forced_idr_header_enable: 1; /* enable header encoding before IDR frame */
> + u32 constraint_set1_flag: 1; /* enable CBP */
> u32 bg_detection: 1; /* enable background detection */
> };
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection
2026-03-19 5:32 ` [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection Jackson.lee
@ 2026-03-19 21:17 ` Nicolas Dufresne
2026-03-20 1:34 ` jackson.lee
2026-03-20 6:37 ` jackson.lee
1 sibling, 1 reply; 14+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 21:17 UTC (permalink / raw)
To: Jackson.lee, mchehab, hverkuil-cisco, bob.beckett
Cc: linux-media, linux-kernel, lafley.kim, b-brnich, hverkuil,
nas.chung
[-- Attachment #1: Type: text/plain, Size: 8168 bytes --]
Le jeudi 19 mars 2026 à 14:32 +0900, Jackson.lee a écrit :
> From: Jackson Lee <jackson.lee@chipsnmedia.com>
>
> Wave5 encoder can be configured to detect a background region in a frame.
> If a background region is detected, it will use less bits or skip mode to
> encode that region. This can assist in lowering the video bitrate for a
> given stream.
Since you are adding a generic control (and I think the feature is pretty clear
an generic), you should make this clear in the text. So start saying you are
adding a generic control for the background detection feature and then quote
that this will be implemented by wave5. Its just a nit on wording, I have no
doubt this option would also exist on other IP and be compatible through the
provided description.
>
> Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
> Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
> ---
> Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 5 +++++
> drivers/media/platform/chips-media/wave5/wave5-hw.c | 4 +++-
> drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 7 +++++++
> drivers/media/platform/chips-media/wave5/wave5-vpuapi.h | 1 +
> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++
> include/uapi/linux/v4l2-controls.h | 2 ++
> 6 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index c8890cb5e00a..b992a0d5c7bf 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -605,6 +605,11 @@ enum v4l2_mpeg_video_frame_skip_mode -
> chosen data limit then the frame will be skipped. Possible values
> are:
>
> +``V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION (boolean)``
> + If enabled then, the encoder detect a background region in frame and
drop then
> + use low bits or skip mode to encode the background region.
> + If a lot of scenes are stationary or background, It may help to
> + reduce the video bitrate. Applicable to the encoder.
>
> .. tabularcolumns:: |p{8.2cm}|p{9.3cm}|
>
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c
> b/drivers/media/platform/chips-media/wave5/wave5-hw.c
> index 687ce6ccf3ae..c516d125f553 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-hw.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c
Please, split the API addition from the driver changes.
> @@ -49,6 +49,7 @@
>
> #define FASTIO_ADDRESS_MASK GENMASK(15, 0)
> #define SEQ_PARAM_PROFILE_MASK GENMASK(30, 24)
> +#define SEQ_BG_PARAM_REG_DATA 0x3800410
>
> static void _wave5_print_reg_err(struct vpu_device *vpu_dev, u32
> reg_fail_reason,
> const char *func);
> @@ -1838,7 +1839,8 @@ int wave5_vpu_enc_init_seq(struct vpu_instance *inst)
> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_RC_BIT_RATIO_LAYER_4_7, 0);
> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_ROT_PARAM, rot_mir_mode);
>
> - vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_BG_PARAM, 0);
> + vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_BG_PARAM,
> + SEQ_BG_PARAM_REG_DATA | p_param->bg_detection);
> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_CUSTOM_LAMBDA_ADDR, 0);
> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_CONF_WIN_TOP_BOT,
> p_param->conf_win_bot << 16 | p_param->conf_win_top);
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> index 7613fcdbafed..6fe01217233f 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> @@ -780,6 +780,9 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl *ctrl)
> case V4L2_CID_MPEG_VIDEO_BITRATE:
> inst->bit_rate = ctrl->val;
> break;
> + case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION:
> + inst->enc_param.bg_detection = ctrl->val;
> + break;
> case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
> inst->enc_param.avc_idr_period = ctrl->val;
> break;
> @@ -1205,6 +1208,7 @@ static int wave5_set_enc_openparam(struct enc_open_param
> *open_param,
> open_param->wave_param.beta_offset_div2 = input.beta_offset_div2;
> open_param->wave_param.decoding_refresh_type =
> input.decoding_refresh_type;
> open_param->wave_param.intra_period = input.intra_period;
> + open_param->wave_param.bg_detection = input.bg_detection;
> if (inst->std == W_HEVC_ENC) {
> if (input.intra_period == 0) {
> open_param->wave_param.decoding_refresh_type =
> DEC_REFRESH_TYPE_IDR;
> @@ -1700,6 +1704,9 @@ static int wave5_vpu_open_enc(struct file *filp)
> v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> V4L2_CID_MPEG_VIDEO_AU_DELIMITER,
> 0, 1, 1, 1);
> + v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> + V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION,
> + 0, 1, 1, 0);
The hard question, last parameter here is def, so I read this is disabled by
default. What's the side effect of having this enabled by default ? Did you
already considered that option ?
regards,
Nicolas
> v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> V4L2_CID_HFLIP,
> 0, 1, 1, 0);
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> index c64135769869..dc31689e0d27 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> @@ -570,6 +570,7 @@ struct enc_wave_param {
> u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8
> transform */
> u32 mb_level_rc_enable: 1; /* enable MB-level rate control */
> u32 forced_idr_header_enable: 1; /* enable header encoding before IDR
> frame */
> + u32 bg_detection: 1; /* enable background detection */
> };
>
> struct enc_open_param {
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-
> core/v4l2-ctrls-defs.c
> index 551426c4cd01..e062f2088490 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> @@ -889,6 +889,7 @@ const char *v4l2_ctrl_get_name(u32 id)
> case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY: return
> "Display Delay";
> case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE: return
> "Display Delay Enable";
> case V4L2_CID_MPEG_VIDEO_AU_DELIMITER: return
> "Generate Access Unit Delimiters";
> + case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION: return
> "Background Detection";
> 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";
> @@ -1296,6 +1297,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum
> v4l2_ctrl_type *type,
> case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
> case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:
> case V4L2_CID_MPEG_VIDEO_AU_DELIMITER:
> + case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION:
> case V4L2_CID_WIDE_DYNAMIC_RANGE:
> case V4L2_CID_IMAGE_STABILIZATION:
> case V4L2_CID_RDS_RECEPTION:
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-
> controls.h
> index 68dd0c4e47b2..939f796261c0 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -464,6 +464,8 @@ enum v4l2_mpeg_video_intra_refresh_period_type {
> V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1,
> };
>
> +#define
> V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION (V4L2_CID_CODEC_BASE+238)
> +
> /* CIDs for the MPEG-2 Part 2 (H.262) codec */
> #define
> V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270)
> enum v4l2_mpeg_video_mpeg2_level {
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v0 3/3] media: chips-media: wave5: Add Support for Packed YUV422 Formats
2026-03-19 5:32 ` [PATCH v0 3/3] media: chips-media: wave5: Add Support for Packed YUV422 Formats Jackson.lee
@ 2026-03-19 21:18 ` Nicolas Dufresne
0 siblings, 0 replies; 14+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 21:18 UTC (permalink / raw)
To: Jackson.lee, mchehab, hverkuil-cisco, bob.beckett
Cc: linux-media, linux-kernel, lafley.kim, b-brnich, hverkuil,
nas.chung
[-- Attachment #1: Type: text/plain, Size: 2962 bytes --]
Le jeudi 19 mars 2026 à 14:32 +0900, Jackson.lee a écrit :
> From: Jackson Lee <jackson.lee@chipsnmedia.com>
>
> Wave5 encoder is capable of reading in numerous raw pixel formats.
> Expose these formats and properly configure encoder if selected.
>
> Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
> Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> .../platform/chips-media/wave5/wave5-helper.h | 2 +-
> .../chips-media/wave5/wave5-vpu-enc.c | 32 +++++++++++++++++++
> 2 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.h b/drivers/media/platform/chips-media/wave5/wave5-helper.h
> index d61fdbda359d..e6f241012c3b 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-helper.h
> +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.h
> @@ -11,7 +11,7 @@
> #include "wave5-vpu.h"
>
> #define FMT_TYPES 2
> -#define MAX_FMTS 12
> +#define MAX_FMTS 16
>
> const char *state_to_str(enum vpu_instance_state state);
> void wave5_cleanup_instance(struct vpu_instance *inst, struct file *filp);
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> index f315ed7243a7..b24c65f174ea 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> @@ -90,6 +90,22 @@ static const struct vpu_format enc_fmt_list[FMT_TYPES][MAX_FMTS] = {
> .v4l2_pix_fmt = V4L2_PIX_FMT_NV61M,
> .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
> },
> + {
> + .v4l2_pix_fmt = V4L2_PIX_FMT_YUYV,
> + .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
> + },
> + {
> + .v4l2_pix_fmt = V4L2_PIX_FMT_YVYU,
> + .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
> + },
> + {
> + .v4l2_pix_fmt = V4L2_PIX_FMT_UYVY,
> + .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
> + },
> + {
> + .v4l2_pix_fmt = V4L2_PIX_FMT_VYUY,
> + .v4l2_frmsize = &enc_frmsize[VPU_FMT_TYPE_RAW],
> + },
> }
> };
>
> @@ -1161,6 +1177,22 @@ static int wave5_set_enc_openparam(struct enc_open_param *open_param,
> else
> open_param->src_format = FORMAT_420;
>
> + switch (info->format) {
> + case V4L2_PIX_FMT_YUYV:
> + open_param->packed_format = PACKED_YUYV;
> + break;
> + case V4L2_PIX_FMT_YVYU:
> + open_param->packed_format = PACKED_YVYU;
> + break;
> + case V4L2_PIX_FMT_UYVY:
> + open_param->packed_format = PACKED_UYVY;
> + break;
> + case V4L2_PIX_FMT_VYUY:
> + open_param->packed_format = PACKED_VYUY;
> + break;
> + default:
> + break;
> + }
> open_param->wave_param.gop_preset_idx = PRESET_IDX_IPP_SINGLE;
> open_param->wave_param.hvs_qp_scale = 2;
> open_param->wave_param.hvs_max_delta_qp = 10;
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile
2026-03-19 12:32 ` Nicolas Dufresne
@ 2026-03-20 1:23 ` jackson.lee
2026-03-23 17:06 ` Brandon Brnich
0 siblings, 1 reply; 14+ messages in thread
From: jackson.lee @ 2026-03-20 1:23 UTC (permalink / raw)
To: Nicolas Dufresne, mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
bob.beckett@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lafley.kim, b-brnich@ti.com, hverkuil@xs4all.nl, Nas Chung
Hi Nicolas
> -----Original Message-----
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> Sent: Thursday, March 19, 2026 9:33 PM
> To: jackson.lee <jackson.lee@chipsnmedia.com>; mchehab@kernel.org;
> hverkuil-cisco@xs4all.nl; bob.beckett@collabora.com
> Cc: linux-media@vger.kernel.org; linux-kernel@vger.kernel.org; lafley.kim
> <lafley.kim@chipsnmedia.com>; b-brnich@ti.com; hverkuil@xs4all.nl; Nas
> Chung <nas.chung@chipsnmedia.com>
> Subject: Re: [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile
>
> Hi Jackson,
>
> Le jeudi 19 mars 2026 à 14:32 +0900, Jackson.lee a écrit :
> > From: Jackson Lee <jackson.lee@chipsnmedia.com>
> >
> > Constrained Baseline Profile (CBP) and Baseline Profile (BP) have been
> > treated as the same.
> > Introduce the ability to differentiate between the two.
> >
> > Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
> > Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
>
> Should we consider this one has a bug fix ? I suspect previously
> constraint_set1_flag was never set in the bitstream, and now it is set
> accordingly to the selected profile, which fixes a miss-match of user
> expectation vs bitstream values. If you agree with this, a Fixes: tag
> would be nice.
>
I will add the "Fixes" tag.
Thanks for your review.
Jackson
> > ---
> > drivers/media/platform/chips-media/wave5/wave5-hw.c | 3 +++
> > .../media/platform/chips-media/wave5/wave5-vpu-enc.c | 10
> > +++++++---
> > .../media/platform/chips-media/wave5/wave5-vpuapi.h | 1 +
> > 3 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c
> > b/drivers/media/platform/chips-media/wave5/wave5-hw.c
> > index c516d125f553..2392bce8d840 100644
> > --- a/drivers/media/platform/chips-media/wave5/wave5-hw.c
> > +++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c
> > @@ -1763,6 +1763,9 @@ int wave5_vpu_enc_init_seq(struct vpu_instance
> *inst)
> > (p_param->skip_intra_trans << 25) |
> > (p_param->strong_intra_smooth_enable << 27) |
> > (p_param->en_still_picture << 30);
> > + else if (inst->std == W_AVC_ENC)
> > + reg_val |= (p_param->constraint_set1_flag << 29);
> > +
> > vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_SPS_PARAM, reg_val);
> >
> > reg_val = (p_param->lossless_enable) | diff --git
> > a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > index 6fe01217233f..f315ed7243a7 100644
> > --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > @@ -939,6 +939,8 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl
> *ctrl)
> > case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE:
> > inst->enc_param.profile = H264_PROFILE_BP;
> > inst->bit_depth = 8;
> > + if (ctrl->val ==
> V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE)
> > + inst->enc_param.constraint_set1_flag = 1;
> > break;
> > case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN:
> > inst->enc_param.profile = H264_PROFILE_MP; @@ -1214,9
> +1216,11 @@
> > static int wave5_set_enc_openparam(struct enc_open_param *open_param,
> > open_param->wave_param.decoding_refresh_type =
> DEC_REFRESH_TYPE_IDR;
> > open_param->wave_param.intra_period =
> input.avc_idr_period;
> > }
> > - } else {
> > + } else if (inst->std == W_AVC_ENC)
> > + open_param->wave_param.constraint_set1_flag =
> input.constraint_set1_flag;
> > + else
> > open_param->wave_param.avc_idr_period = input.avc_idr_period;
> > - }
>
> nit: Just keep the bracket, so that all branches have brackets.
>
> cheers,
> Nicolas
>
> > +
> > open_param->wave_param.entropy_coding_mode =
> input.entropy_coding_mode;
> > open_param->wave_param.lossless_enable = input.lossless_enable;
> > open_param->wave_param.const_intra_pred_flag =
> > input.const_intra_pred_flag; @@ -1687,7 +1691,7 @@ static int
> wave5_vpu_open_enc(struct file *filp)
> > -6, 6, 1, 0);
> > v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> > V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM,
> > - 0, 1, 1, 1);
> > + 0, 1, 1, 0);
> > v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> >
> V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION,
> > 0, 1, 1, 0);
> > diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> > b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> > index dc31689e0d27..7b08fef58217 100644
> > --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> > +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> > @@ -570,6 +570,7 @@ struct enc_wave_param {
> > u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8
> transform */
> > u32 mb_level_rc_enable: 1; /* enable MB-level rate control */
> > u32 forced_idr_header_enable: 1; /* enable header encoding before
> > IDR frame */
> > + u32 constraint_set1_flag: 1; /* enable CBP */
> > u32 bg_detection: 1; /* enable background detection */
> > };
> >
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection
2026-03-19 21:17 ` Nicolas Dufresne
@ 2026-03-20 1:34 ` jackson.lee
2026-03-20 17:00 ` Nicolas Dufresne
0 siblings, 1 reply; 14+ messages in thread
From: jackson.lee @ 2026-03-20 1:34 UTC (permalink / raw)
To: Nicolas Dufresne, mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
bob.beckett@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lafley.kim, b-brnich@ti.com, hverkuil@xs4all.nl, Nas Chung
Hi Nicolas
> -----Original Message-----
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> Sent: Friday, March 20, 2026 6:18 AM
> To: jackson.lee <jackson.lee@chipsnmedia.com>; mchehab@kernel.org;
> hverkuil-cisco@xs4all.nl; bob.beckett@collabora.com
> Cc: linux-media@vger.kernel.org; linux-kernel@vger.kernel.org; lafley.kim
> <lafley.kim@chipsnmedia.com>; b-brnich@ti.com; hverkuil@xs4all.nl; Nas
> Chung <nas.chung@chipsnmedia.com>
> Subject: Re: [PATCH v0 1/3] media: chips-media: wave5: Add Support for
> Background Detection
>
> Le jeudi 19 mars 2026 à 14:32 +0900, Jackson.lee a écrit :
> > From: Jackson Lee <jackson.lee@chipsnmedia.com>
> >
> > Wave5 encoder can be configured to detect a background region in a frame.
> > If a background region is detected, it will use less bits or skip mode
> > to encode that region. This can assist in lowering the video bitrate
> > for a given stream.
>
> Since you are adding a generic control (and I think the feature is pretty
> clear an generic), you should make this clear in the text. So start saying
> you are adding a generic control for the background detection feature and
> then quote that this will be implemented by wave5. Its just a nit on
> wording, I have no doubt this option would also exist on other IP and be
> compatible through the provided description.
>
> >
> > Signed-off-by: Jackson Lee <jackson.lee@chipsnmedia.com>
> > Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
> > ---
> > Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 5 +++++
> > drivers/media/platform/chips-media/wave5/wave5-hw.c | 4 +++-
> > drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 7 +++++++
> > drivers/media/platform/chips-media/wave5/wave5-vpuapi.h | 1 +
> > drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++
> > include/uapi/linux/v4l2-controls.h | 2 ++
> > 6 files changed, 20 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > index c8890cb5e00a..b992a0d5c7bf 100644
> > --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> > @@ -605,6 +605,11 @@ enum v4l2_mpeg_video_frame_skip_mode -
> > chosen data limit then the frame will be skipped. Possible values
> > are:
> >
> > +``V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION (boolean)``
> > + If enabled then, the encoder detect a background region in frame
> > +and
>
> drop then
>
> > + use low bits or skip mode to encode the background region.
> > + If a lot of scenes are stationary or background, It may help to
> > + reduce the video bitrate. Applicable to the encoder.
> >
> > .. tabularcolumns:: |p{8.2cm}|p{9.3cm}|
> >
> > diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c
> > b/drivers/media/platform/chips-media/wave5/wave5-hw.c
> > index 687ce6ccf3ae..c516d125f553 100644
> > --- a/drivers/media/platform/chips-media/wave5/wave5-hw.c
> > +++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c
>
> Please, split the API addition from the driver changes.
>
> > @@ -49,6 +49,7 @@
> >
> > #define FASTIO_ADDRESS_MASK GENMASK(15, 0)
> > #define SEQ_PARAM_PROFILE_MASK GENMASK(30, 24)
> > +#define SEQ_BG_PARAM_REG_DATA 0x3800410
> >
> > static void _wave5_print_reg_err(struct vpu_device *vpu_dev, u32
> > reg_fail_reason,
> > const char *func);
> > @@ -1838,7 +1839,8 @@ int wave5_vpu_enc_init_seq(struct vpu_instance
> *inst)
> > vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_RC_BIT_RATIO_LAYER_4_7, 0);
> > vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_ROT_PARAM, rot_mir_mode);
> >
> > - vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_BG_PARAM, 0);
> > + vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_BG_PARAM,
> > + SEQ_BG_PARAM_REG_DATA | p_param->bg_detection);
> > vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_CUSTOM_LAMBDA_ADDR, 0);
> > vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_CONF_WIN_TOP_BOT,
> > p_param->conf_win_bot << 16 | p_param->conf_win_top);
> diff
> > --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > index 7613fcdbafed..6fe01217233f 100644
> > --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> > @@ -780,6 +780,9 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl
> *ctrl)
> > case V4L2_CID_MPEG_VIDEO_BITRATE:
> > inst->bit_rate = ctrl->val;
> > break;
> > + case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION:
> > + inst->enc_param.bg_detection = ctrl->val;
> > + break;
> > case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
> > inst->enc_param.avc_idr_period = ctrl->val;
> > break;
> > @@ -1205,6 +1208,7 @@ static int wave5_set_enc_openparam(struct
> > enc_open_param *open_param,
> > open_param->wave_param.beta_offset_div2 = input.beta_offset_div2;
> > open_param->wave_param.decoding_refresh_type =
> > input.decoding_refresh_type;
> > open_param->wave_param.intra_period = input.intra_period;
> > + open_param->wave_param.bg_detection = input.bg_detection;
> > if (inst->std == W_HEVC_ENC) {
> > if (input.intra_period == 0) {
> > open_param->wave_param.decoding_refresh_type =
> > DEC_REFRESH_TYPE_IDR; @@ -1700,6 +1704,9 @@ static int
> > wave5_vpu_open_enc(struct file *filp)
> > v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> > V4L2_CID_MPEG_VIDEO_AU_DELIMITER,
> > 0, 1, 1, 1);
> > + v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> > + V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION,
> > + 0, 1, 1, 0);
>
> The hard question, last parameter here is def, so I read this is disabled
> by default. What's the side effect of having this enabled by default ? Did
> you already considered that option ?
>
Background detection is disabled by default because not all use cases benefit from this feature.
When enabled, detected background regions are encoded with fewer bits or skip mode,
which reduces bitrate but may not be desirable in every scenario.
We chose to let the user explicitly opt-in rather than enable it by default.
Thanks for your review.
Jackson
> regards,
> Nicolas
>
> > v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> > V4L2_CID_HFLIP,
> > 0, 1, 1, 0);
> > diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> > b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> > index c64135769869..dc31689e0d27 100644
> > --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> > +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> > @@ -570,6 +570,7 @@ struct enc_wave_param {
> > u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8
> > transform */
> > u32 mb_level_rc_enable: 1; /* enable MB-level rate control */
> > u32 forced_idr_header_enable: 1; /* enable header encoding before
> > IDR frame */
> > + u32 bg_detection: 1; /* enable background detection */
> > };
> >
> > struct enc_open_param {
> > diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > b/drivers/media/v4l2- core/v4l2-ctrls-defs.c index
> > 551426c4cd01..e062f2088490 100644
> > --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > @@ -889,6 +889,7 @@ const char *v4l2_ctrl_get_name(u32 id)
> > case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY: return
> > "Display Delay";
> > case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE: return
> > "Display Delay Enable";
> > case V4L2_CID_MPEG_VIDEO_AU_DELIMITER: return
> > "Generate Access Unit Delimiters";
> > + case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION: return
> > "Background Detection";
> > 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";
> > @@ -1296,6 +1297,7 @@ void v4l2_ctrl_fill(u32 id, const char **name,
> > enum v4l2_ctrl_type *type,
> > case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
> > case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:
> > case V4L2_CID_MPEG_VIDEO_AU_DELIMITER:
> > + case V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION:
> > case V4L2_CID_WIDE_DYNAMIC_RANGE:
> > case V4L2_CID_IMAGE_STABILIZATION:
> > case V4L2_CID_RDS_RECEPTION:
> > diff --git a/include/uapi/linux/v4l2-controls.h
> > b/include/uapi/linux/v4l2- controls.h index 68dd0c4e47b2..939f796261c0
> > 100644
> > --- a/include/uapi/linux/v4l2-controls.h
> > +++ b/include/uapi/linux/v4l2-controls.h
> > @@ -464,6 +464,8 @@ enum v4l2_mpeg_video_intra_refresh_period_type {
> > V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1,
> > };
> >
> > +#define
> > V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION (V4L2_CID_CODEC_BASE+238)
> > +
> > /* CIDs for the MPEG-2 Part 2 (H.262) codec */
> > #define
> > V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL
> (V4L2_CID_CODEC_BASE+270)
> > enum v4l2_mpeg_video_mpeg2_level {
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection
2026-03-19 5:32 ` [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection Jackson.lee
2026-03-19 21:17 ` Nicolas Dufresne
@ 2026-03-20 6:37 ` jackson.lee
2026-03-20 13:25 ` Nicolas Dufresne
1 sibling, 1 reply; 14+ messages in thread
From: jackson.lee @ 2026-03-20 6:37 UTC (permalink / raw)
To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
nicolas.dufresne@collabora.com, bob.beckett@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lafley.kim, b-brnich@ti.com, hverkuil@xs4all.nl, Nas Chung
Hi Nicolas
I got the message below from the CI robot.
But in v4l2-controls.h, none of the defined strings include spaces around "+".
Can I ignore this warning?
# Test checkpatch:./0001-media-chips-media-wave5-Add-Support-for-Background-D.patch checkpatch
CHECK: spaces preferred around that '+' (ctx:VxV)
#134: FILE: include/uapi/linux/v4l2-controls.h:467:
+#define
+V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION(V4L2_CID_CODEC_BASE+238)
^
total: 0 errors, 0 warnings, 1 checks, 81 lines checked
Please fix your series, and upload a new version. If you have a patchwork account, do not forget to mark the current series as Superseded.
For more details, check the full report at:
https://linux-media.pages.freedesktop.org/-/users/patchwork/-/jobs/95650311/artifacts/report.htm .
Best regards, and Happy Hacking!
Media CI robot on behalf of the linux-media community.
---
Check the latest rules for contributing your patches at:
https://docs.kernel.org/driver-api/media/maintainer-entry-profile.html
If you believe that the CI is wrong, kindly open an issue at https://gitlab.freedesktop.org/linux-media/media-ci/-/issues or reply-all to this message.
> +#define V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION
> (V4L2_CID_CODEC_BASE+238)
> +
Thanks
Jackson
> /* CIDs for the MPEG-2 Part 2 (H.262) codec */
> #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL
> (V4L2_CID_CODEC_BASE+270)
> enum v4l2_mpeg_video_mpeg2_level {
> --
> 2.43.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection
2026-03-20 6:37 ` jackson.lee
@ 2026-03-20 13:25 ` Nicolas Dufresne
0 siblings, 0 replies; 14+ messages in thread
From: Nicolas Dufresne @ 2026-03-20 13:25 UTC (permalink / raw)
To: jackson.lee, mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
bob.beckett@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lafley.kim, b-brnich@ti.com, hverkuil@xs4all.nl, Nas Chung
[-- Attachment #1: Type: text/plain, Size: 1972 bytes --]
Hi,
Le vendredi 20 mars 2026 à 06:37 +0000, jackson.lee a écrit :
> Hi Nicolas
>
> I got the message below from the CI robot.
> But in v4l2-controls.h, none of the defined strings include spaces around "+".
> Can I ignore this warning?
>
>
> # Test checkpatch:./0001-media-chips-media-wave5-Add-Support-for-Background-D.patch checkpatch
> CHECK: spaces preferred around that '+' (ctx:VxV)
> #134: FILE: include/uapi/linux/v4l2-controls.h:467:
> +#define
> +V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION(V4L2_CID_CODEC_BASE+238)
> ^
>
Actually, the older definitions don't, the newer definitions do. Please adopt
the CI suggestion, I'll add to my todo to fix them all in separate thread.
regards,
Nicolas
> total: 0 errors, 0 warnings, 1 checks, 81 lines checked
>
>
>
> Please fix your series, and upload a new version. If you have a patchwork account, do not forget to mark the current series as Superseded.
>
> For more details, check the full report at:
> https://linux-media.pages.freedesktop.org/-/users/patchwork/-/jobs/95650311/artifacts/report.htm .
>
>
>
> Best regards, and Happy Hacking!
> Media CI robot on behalf of the linux-media community.
>
> ---
> Check the latest rules for contributing your patches at:
> https://docs.kernel.org/driver-api/media/maintainer-entry-profile.html
>
> If you believe that the CI is wrong, kindly open an issue at https://gitlab.freedesktop.org/linux-media/media-ci/-/issues or reply-all to this message.
>
> > +#define V4L2_CID_MPEG_VIDEO_BACKGROUND_DETECTION
> > (V4L2_CID_CODEC_BASE+238)
> > +
>
> Thanks
> Jackson
>
> > /* CIDs for the MPEG-2 Part 2 (H.262) codec */
> > #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL
> > (V4L2_CID_CODEC_BASE+270)
> > enum v4l2_mpeg_video_mpeg2_level {
> > --
> > 2.43.0
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection
2026-03-20 1:34 ` jackson.lee
@ 2026-03-20 17:00 ` Nicolas Dufresne
0 siblings, 0 replies; 14+ messages in thread
From: Nicolas Dufresne @ 2026-03-20 17:00 UTC (permalink / raw)
To: jackson.lee, mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
bob.beckett@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lafley.kim, b-brnich@ti.com, hverkuil@xs4all.nl, Nas Chung
[-- Attachment #1: Type: text/plain, Size: 715 bytes --]
Le vendredi 20 mars 2026 à 01:34 +0000, jackson.lee a écrit :
> Hi Nicolas
> > >
[...]
> > >
> >
> > The hard question, last parameter here is def, so I read this is disabled
> > by default. What's the side effect of having this enabled by default ? Did
> > you already considered that option ?
> >
>
> Background detection is disabled by default because not all use cases benefit
> from this feature.
> When enabled, detected background regions are encoded with fewer bits or skip
> mode,
> which reduces bitrate but may not be desirable in every scenario.
> We chose to let the user explicitly opt-in rather than enable it by default.
Ack
>
> Thanks for your review.
> Jackson
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile
2026-03-20 1:23 ` jackson.lee
@ 2026-03-23 17:06 ` Brandon Brnich
2026-03-24 0:32 ` jackson.lee
0 siblings, 1 reply; 14+ messages in thread
From: Brandon Brnich @ 2026-03-23 17:06 UTC (permalink / raw)
To: jackson.lee, Nicolas Dufresne, mchehab@kernel.org,
hverkuil-cisco@xs4all.nl, bob.beckett@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lafley.kim, hverkuil@xs4all.nl, Nas Chung
Hi Jackson,
On 3/19/26 20:23, jackson.lee wrote:
> Hi Nicolas
>
[...]
>> *ctrl)
>>> case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE:
>>> inst->enc_param.profile = H264_PROFILE_BP;
>>> inst->bit_depth = 8;
>>> + if (ctrl->val ==
>> V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE)
>>> + inst->enc_param.constraint_set1_flag = 1;
>>> break;
>>> case V4L2_MPEG_VIDEO_H264_PROFILE_MAIN:
>>> inst->enc_param.profile = H264_PROFILE_MP; @@ -1214,9
>> +1216,11 @@
>>> static int wave5_set_enc_openparam(struct enc_open_param *open_param,
>>> open_param->wave_param.decoding_refresh_type =
>> DEC_REFRESH_TYPE_IDR;
>>> open_param->wave_param.intra_period =
>> input.avc_idr_period;
>>> }
>>> - } else {
>>> + } else if (inst->std == W_AVC_ENC)
>>> + open_param->wave_param.constraint_set1_flag =
>> input.constraint_set1_flag;
>>> + else
>>> open_param->wave_param.avc_idr_period = input.avc_idr_period;
>>> - }
The above code breaks setting GOP size for the AVC case. Any reason this
shouldn't remain just an if else where the else sets both constraint
flag and avc period?
Best,
Brandon
>>
>> nit: Just keep the bracket, so that all branches have brackets.
>>
>> cheers,
>> Nicolas
>>
>>> +
>>> open_param->wave_param.entropy_coding_mode =
>> input.entropy_coding_mode;
>>> open_param->wave_param.lossless_enable = input.lossless_enable;
>>> open_param->wave_param.const_intra_pred_flag =
>>> input.const_intra_pred_flag; @@ -1687,7 +1691,7 @@ static int
>> wave5_vpu_open_enc(struct file *filp)
>>> -6, 6, 1, 0);
>>> v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
>>> V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM,
>>> - 0, 1, 1, 1);
>>> + 0, 1, 1, 0);
>>> v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
>>>
>> V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION,
>>> 0, 1, 1, 0);
>>> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
>>> b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
>>> index dc31689e0d27..7b08fef58217 100644
>>> --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
>>> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
>>> @@ -570,6 +570,7 @@ struct enc_wave_param {
>>> u32 transform8x8_enable: 1; /* enable 8x8 intra prediction and 8x8
>> transform */
>>> u32 mb_level_rc_enable: 1; /* enable MB-level rate control */
>>> u32 forced_idr_header_enable: 1; /* enable header encoding before
>>> IDR frame */
>>> + u32 constraint_set1_flag: 1; /* enable CBP */
>>> u32 bg_detection: 1; /* enable background detection */
>>> };
>>>
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile
2026-03-23 17:06 ` Brandon Brnich
@ 2026-03-24 0:32 ` jackson.lee
0 siblings, 0 replies; 14+ messages in thread
From: jackson.lee @ 2026-03-24 0:32 UTC (permalink / raw)
To: Brandon Brnich, Nicolas Dufresne, mchehab@kernel.org,
hverkuil-cisco@xs4all.nl, bob.beckett@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lafley.kim, hverkuil@xs4all.nl, Nas Chung
Hi Brandon
> The above code breaks setting GOP size for the AVC case. Any reason this
> shouldn't remain just an if else where the else sets both constraint flag
> and avc period?
>
> Best,
> Brandon
>
Good catch, Brandon.
You're right — the else-if structure breaks avc_idr_period for AVC.
I've changed it to a single else block that sets both constraint_set1_flag and avc_idr_period.
constraint_set1_flag defaults to 0 and is only set to 1 in s_ctrl when CONSTRAINED_BASELINE is selected, so this is safe for all AVC profiles.
Thanks
Jackson
[C&M]
IMPORTANT NOTICE
The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message or their agent, or if this message has been addressed to you in some unexpected situation, please immediately notify the sender by replying email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, distribution, copying, or storage of this message or its attachments is strictly prohibited.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-03-24 0:32 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 5:32 [PATCH v0 0/3] Add encoder features Jackson.lee
2026-03-19 5:32 ` [PATCH v0 1/3] media: chips-media: wave5: Add Support for Background Detection Jackson.lee
2026-03-19 21:17 ` Nicolas Dufresne
2026-03-20 1:34 ` jackson.lee
2026-03-20 17:00 ` Nicolas Dufresne
2026-03-20 6:37 ` jackson.lee
2026-03-20 13:25 ` Nicolas Dufresne
2026-03-19 5:32 ` [PATCH v0 2/3] media: chips-media: wave5: Support CBP profile Jackson.lee
2026-03-19 12:32 ` Nicolas Dufresne
2026-03-20 1:23 ` jackson.lee
2026-03-23 17:06 ` Brandon Brnich
2026-03-24 0:32 ` jackson.lee
2026-03-19 5:32 ` [PATCH v0 3/3] media: chips-media: wave5: Add Support for Packed YUV422 Formats Jackson.lee
2026-03-19 21:18 ` Nicolas Dufresne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox