From: Nicolas Dufresne <nicolas@ndufresne.ca>
To: "jackson.lee" <jackson.lee@chipsnmedia.com>,
mchehab@kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, nas.chung@chipsnmedia.com
Cc: lafley.kim@chipsnmedia.com, b-brnich@ti.com
Subject: Re: [RESEND PATCH v0 2/5] wave5: Support to prepend sps/pps to IDR frame.
Date: Wed, 07 Feb 2024 13:00:06 -0500 [thread overview]
Message-ID: <cdcf594ecaefaac748655bdcb7dcc1c4f9ad1a68.camel@ndufresne.ca> (raw)
In-Reply-To: <20240131013046.15687-3-jackson.lee@chipsnmedia.com>
Hi Jackson,
Le mercredi 31 janvier 2024 à 10:30 +0900, jackson.lee a écrit :
> Indicates whether to generate SPS and PPS at every IDR. Setting it to 0 disables generating SPS and PPS at every IDR.
> Setting it to one enables generating SPS and PPS at every IDR.
>
> 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 | 6 ++++--
> drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 7 +++++++
> drivers/media/platform/chips-media/wave5/wave5-vpuapi.h | 1 +
> 3 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-hw.c b/drivers/media/platform/chips-media/wave5/wave5-hw.c
> index f1e022fb148e..8ad7f3a28ae1 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-hw.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-hw.c
> @@ -1602,11 +1602,13 @@ int wave5_vpu_enc_init_seq(struct vpu_instance *inst)
> if (inst->std == W_AVC_ENC)
> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_INTRA_PARAM, p_param->intra_qp |
> ((p_param->intra_period & 0x7ff) << 6) |
> - ((p_param->avc_idr_period & 0x7ff) << 17));
> + ((p_param->avc_idr_period & 0x7ff) << 17) |
> + (p_param->forced_idr_header_enable << 28));
I can spot evident hard-coding of mask and bit shifts in here. In order to
continuously improve this driver code, I would like to see this (and the
following) magic number being defined with well named macros as a preparation
patch to this feature change.
regards,
Nicolas
> else if (inst->std == W_HEVC_ENC)
> vpu_write_reg(inst->dev, W5_CMD_ENC_SEQ_INTRA_PARAM,
> p_param->decoding_refresh_type | (p_param->intra_qp << 3) |
> - (p_param->intra_period << 16));
> + (p_param->forced_idr_header_enable << 9) |
> + (p_param->intra_period << 16));
>
> reg_val = (p_param->rdo_skip << 2) |
> (p_param->lambda_scaling_enable << 3) |
> 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 0cb5bfb67258..761775216cd4 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c
> @@ -1125,6 +1125,9 @@ static int wave5_vpu_enc_s_ctrl(struct v4l2_ctrl *ctrl)
> case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE:
> inst->enc_param.entropy_coding_mode = ctrl->val;
> break;
> + case V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR:
> + inst->enc_param.forced_idr_header_enable = ctrl->val;
> + break;
> case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT:
> break;
> default:
> @@ -1292,6 +1295,7 @@ static void wave5_set_enc_openparam(struct enc_open_param *open_param,
> else
> open_param->wave_param.intra_refresh_arg = num_ctu_row;
> }
> + open_param->wave_param.forced_idr_header_enable = input.forced_idr_header_enable;
> }
>
> static int initialize_sequence(struct vpu_instance *inst)
> @@ -1775,6 +1779,9 @@ static int wave5_vpu_open_enc(struct file *filp)
> 0, 1, 1, 0);
> v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> V4L2_CID_MIN_BUFFERS_FOR_OUTPUT, 1, 32, 1, 1);
> + v4l2_ctrl_new_std(v4l2_ctrl_hdl, &wave5_vpu_enc_ctrl_ops,
> + V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR,
> + 0, 1, 1, 0);
>
> if (v4l2_ctrl_hdl->error) {
> ret = -ENODEV;
> diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> index 352f6e904e50..3ad6118550ac 100644
> --- a/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> +++ b/drivers/media/platform/chips-media/wave5/wave5-vpuapi.h
> @@ -566,6 +566,7 @@ struct enc_wave_param {
> u32 lambda_scaling_enable: 1; /* enable lambda scaling using custom GOP */
> 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 */
> };
>
> struct enc_open_param {
next prev parent reply other threads:[~2024-02-07 18:00 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 1:30 [RESEND PATCH v0 0/5] wave5 codec driver jackson.lee
2024-01-31 1:30 ` [RESEND PATCH v0 1/5] wave5 : Support yuv422 input format for encoder jackson.lee
2024-02-07 17:55 ` Nicolas Dufresne
2024-02-08 9:42 ` Sebastian Fricke
2024-02-16 6:48 ` jackson.lee
2024-01-31 1:30 ` [RESEND PATCH v0 2/5] wave5: Support to prepend sps/pps to IDR frame jackson.lee
2024-02-07 18:00 ` Nicolas Dufresne [this message]
2024-02-08 10:01 ` Sebastian Fricke
2024-02-16 7:12 ` jackson.lee
2024-01-31 1:30 ` [RESEND PATCH v0 3/5] wave5 : Support runtime suspend/resume jackson.lee
2024-02-07 18:29 ` Nicolas Dufresne
2024-02-19 4:04 ` jackson.lee
2024-02-19 21:20 ` Nicolas Dufresne
2024-02-20 5:12 ` jackson.lee
2024-02-20 19:06 ` Nicolas Dufresne
2024-02-21 2:27 ` jackson.lee
2024-02-21 15:26 ` Nicolas Dufresne
2024-02-22 1:36 ` jackson.lee
2024-02-22 3:57 ` jackson.lee
2024-02-22 20:55 ` Nicolas Dufresne
2024-02-23 1:06 ` jackson.lee
2024-02-23 15:16 ` Nicolas Dufresne
2024-02-23 18:05 ` Nicolas Dufresne
2024-02-23 18:09 ` Nicolas Dufresne
2024-02-26 0:56 ` jackson.lee
2024-02-26 1:33 ` jackson.lee
2024-03-04 14:12 ` Nicolas Dufresne
2024-03-05 0:54 ` jackson.lee
2024-02-22 20:42 ` Nicolas Dufresne
2024-01-31 1:30 ` [RESEND PATCH v0 4/5] wave5: Use the bitstream buffer size from host jackson.lee
2024-01-31 17:36 ` Andrew Davis
2024-02-02 1:55 ` jackson.lee
2024-01-31 1:30 ` [RESEND PATCH v0 5/5] wave5 : Fixed the wrong buffer size formula jackson.lee
2024-02-07 18:31 ` Nicolas Dufresne
2024-02-08 10:36 ` [RESEND PATCH v0 0/5] wave5 codec driver Sebastian Fricke
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=cdcf594ecaefaac748655bdcb7dcc1c4f9ad1a68.camel@ndufresne.ca \
--to=nicolas@ndufresne.ca \
--cc=b-brnich@ti.com \
--cc=jackson.lee@chipsnmedia.com \
--cc=lafley.kim@chipsnmedia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nas.chung@chipsnmedia.com \
/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;
as well as URLs for NNTP newsgroup(s).