linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: venus: Support V4L2 QP parameters in Venus encoder
@ 2018-11-12 10:59 Kelvin Lawson
  2018-11-29 10:04 ` Stanimir Varbanov
  0 siblings, 1 reply; 5+ messages in thread
From: Kelvin Lawson @ 2018-11-12 10:59 UTC (permalink / raw)
  To: linux-media

Support V4L2 QP parameters in Venus encoder:
 * V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP
 * V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP
 * V4L2_CID_MPEG_VIDEO_H264_MIN_QP
 * V4L2_CID_MPEG_VIDEO_H264_MAX_QP

Signed-off-by: Kelvin Lawson <klawson@lisden.com>
---
 drivers/media/platform/qcom/venus/venc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/media/platform/qcom/venus/venc.c
b/drivers/media/platform/qcom/venus/venc.c
index ce85962..321d612 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -651,6 +651,8 @@ static int venc_set_properties(struct venus_inst *inst)
  struct hfi_framerate frate;
  struct hfi_bitrate brate;
  struct hfi_idr_period idrp;
+ struct hfi_quantization quant;
+ struct hfi_quantization_range quant_range;
  u32 ptype, rate_control, bitrate, profile = 0, level = 0;
  int ret;

@@ -770,6 +772,23 @@ static int venc_set_properties(struct venus_inst *inst)
  if (ret)
  return ret;

+ ptype = HFI_PROPERTY_PARAM_VENC_SESSION_QP;
+ quant.qp_i = ctr->h264_i_qp;
+ quant.qp_p = ctr->h264_p_qp;
+ quant.qp_b = ctr->h264_b_qp;
+ quant.layer_id = 0;
+ ret = hfi_session_set_property(inst, ptype, &quant);
+ if (ret)
+ return ret;
+
+ ptype = HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE;
+ quant_range.min_qp = ctr->h264_min_qp;
+ quant_range.max_qp = ctr->h264_max_qp;
+ quant_range.layer_id = 0;
+ ret = hfi_session_set_property(inst, ptype, &quant_range);
+ if (ret)
+ return ret;
+
  if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264) {
  profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_H264_PROFILE,
     ctr->profile.h264);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: venus: Support V4L2 QP parameters in Venus encoder
  2018-11-12 10:59 [PATCH] media: venus: Support V4L2 QP parameters in Venus encoder Kelvin Lawson
@ 2018-11-29 10:04 ` Stanimir Varbanov
  2018-11-29 23:57   ` Kelvin Lawson
  2018-11-30  0:07   ` [PATCH v2] " Kelvin Lawson
  0 siblings, 2 replies; 5+ messages in thread
From: Stanimir Varbanov @ 2018-11-29 10:04 UTC (permalink / raw)
  To: Kelvin Lawson, linux-media

Hi Kelvin,

Thanks for the patch!

On 11/12/18 12:59 PM, Kelvin Lawson wrote:
> Support V4L2 QP parameters in Venus encoder:
>  * V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP
>  * V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP
>  * V4L2_CID_MPEG_VIDEO_H264_MIN_QP
>  * V4L2_CID_MPEG_VIDEO_H264_MAX_QP
> 
> Signed-off-by: Kelvin Lawson <klawson@lisden.com>
> ---
>  drivers/media/platform/qcom/venus/venc.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

As functional changes the patch is fine, but it has many coding style
issues. Did you read [1]?

> 
> diff --git a/drivers/media/platform/qcom/venus/venc.c
> b/drivers/media/platform/qcom/venus/venc.c
> index ce85962..321d612 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -651,6 +651,8 @@ static int venc_set_properties(struct venus_inst *inst)
>   struct hfi_framerate frate;
>   struct hfi_bitrate brate;
>   struct hfi_idr_period idrp;
> + struct hfi_quantization quant;
> + struct hfi_quantization_range quant_range;
>   u32 ptype, rate_control, bitrate, profile = 0, level = 0;
>   int ret;
> 
> @@ -770,6 +772,23 @@ static int venc_set_properties(struct venus_inst *inst)
>   if (ret)
>   return ret;
> 
> + ptype = HFI_PROPERTY_PARAM_VENC_SESSION_QP;
> + quant.qp_i = ctr->h264_i_qp;
> + quant.qp_p = ctr->h264_p_qp;
> + quant.qp_b = ctr->h264_b_qp;
> + quant.layer_id = 0;
> + ret = hfi_session_set_property(inst, ptype, &quant);
> + if (ret)
> + return ret;

please fix the indentation according to coding style
> +
> + ptype = HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE;
> + quant_range.min_qp = ctr->h264_min_qp;
> + quant_range.max_qp = ctr->h264_max_qp;
> + quant_range.layer_id = 0;
> + ret = hfi_session_set_property(inst, ptype, &quant_range);
> + if (ret)
> + return ret;

ditto

> +
>   if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264) {
>   profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_H264_PROFILE,
>      ctr->profile.h264);
> 

Maybe your mail server is mangling the patches, but also please run
checkpatch before sending patches.

-- 
regards,
Stan

[1] https://www.kernel.org/doc/html/v4.19/process/submitting-patches.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: venus: Support V4L2 QP parameters in Venus encoder
  2018-11-29 10:04 ` Stanimir Varbanov
@ 2018-11-29 23:57   ` Kelvin Lawson
  2018-11-30  0:07   ` [PATCH v2] " Kelvin Lawson
  1 sibling, 0 replies; 5+ messages in thread
From: Kelvin Lawson @ 2018-11-29 23:57 UTC (permalink / raw)
  To: Stanimir Varbanov; +Cc: linux-media

Hi Stanimir,

> As functional changes the patch is fine, but it has many coding style
> issues. Did you read [1]?

Yes, the patch was indented properly but it looks like it got mangled
by the webmail interface. I'll re-submit.

Thanks,
Kelvin

---
Kelvin Lawson
Embedded Linux Consultant
https://lisden.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] media: venus: Support V4L2 QP parameters in Venus encoder
  2018-11-29 10:04 ` Stanimir Varbanov
  2018-11-29 23:57   ` Kelvin Lawson
@ 2018-11-30  0:07   ` Kelvin Lawson
  2018-12-07  9:34     ` Stanimir Varbanov
  1 sibling, 1 reply; 5+ messages in thread
From: Kelvin Lawson @ 2018-11-30  0:07 UTC (permalink / raw)
  To: linux-media, stanimir.varbanov; +Cc: Kelvin Lawson

Support V4L2 QP parameters in Venus encoder:
 * V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP
 * V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP
 * V4L2_CID_MPEG_VIDEO_H264_MIN_QP
 * V4L2_CID_MPEG_VIDEO_H264_MAX_QP

Signed-off-by: Kelvin Lawson <klawson@lisden.com>
---
 drivers/media/platform/qcom/venus/venc.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index 41249d1..15deba7 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -651,6 +651,8 @@ static int venc_set_properties(struct venus_inst *inst)
 	struct hfi_framerate frate;
 	struct hfi_bitrate brate;
 	struct hfi_idr_period idrp;
+	struct hfi_quantization quant;
+	struct hfi_quantization_range quant_range;
 	u32 ptype, rate_control, bitrate, profile = 0, level = 0;
 	int ret;
 
@@ -770,6 +772,23 @@ static int venc_set_properties(struct venus_inst *inst)
 	if (ret)
 		return ret;
 
+	ptype = HFI_PROPERTY_PARAM_VENC_SESSION_QP;
+	quant.qp_i = ctr->h264_i_qp;
+	quant.qp_p = ctr->h264_p_qp;
+	quant.qp_b = ctr->h264_b_qp;
+	quant.layer_id = 0;
+	ret = hfi_session_set_property(inst, ptype, &quant);
+	if (ret)
+		return ret;
+
+	ptype = HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE;
+	quant_range.min_qp = ctr->h264_min_qp;
+	quant_range.max_qp = ctr->h264_max_qp;
+	quant_range.layer_id = 0;
+	ret = hfi_session_set_property(inst, ptype, &quant_range);
+	if (ret)
+		return ret;
+
 	if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264) {
 		profile = venc_v4l2_to_hfi(V4L2_CID_MPEG_VIDEO_H264_PROFILE,
 					   ctr->profile.h264);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] media: venus: Support V4L2 QP parameters in Venus encoder
  2018-11-30  0:07   ` [PATCH v2] " Kelvin Lawson
@ 2018-12-07  9:34     ` Stanimir Varbanov
  0 siblings, 0 replies; 5+ messages in thread
From: Stanimir Varbanov @ 2018-12-07  9:34 UTC (permalink / raw)
  To: Kelvin Lawson, linux-media

Hi Kelvin,

Thanks for the patch!

On 11/30/18 2:07 AM, Kelvin Lawson wrote:
> Support V4L2 QP parameters in Venus encoder:
>  * V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP
>  * V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP
>  * V4L2_CID_MPEG_VIDEO_H264_MIN_QP
>  * V4L2_CID_MPEG_VIDEO_H264_MAX_QP
> 
> Signed-off-by: Kelvin Lawson <klawson@lisden.com>
> ---
>  drivers/media/platform/qcom/venus/venc.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-12-07  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 10:59 [PATCH] media: venus: Support V4L2 QP parameters in Venus encoder Kelvin Lawson
2018-11-29 10:04 ` Stanimir Varbanov
2018-11-29 23:57   ` Kelvin Lawson
2018-11-30  0:07   ` [PATCH v2] " Kelvin Lawson
2018-12-07  9:34     ` Stanimir Varbanov

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).