2022-03-14 19:50:23

by Dikshita Agarwal

[permalink] [raw]
Subject: [PATCH v4 0/2] Introduce Intra-refresh type control

From: Dikshita Agarwal <[email protected]>

Hi,

This series add a new intra-refresh type control for encoders.
this can be used to specify which intra refresh to be enabled, random, cyclic or none.

Change since v0:
Dropped INTRA_REFRESH_TYPE_NONE as it was not needed.
Intra refresh period value as zero will disable the intra refresh.

Change since v1:
Updated the control name for better undestanding.
Also updated the documentation accordingly.

Change since v2:
Updated the venus driver implementation as well to use the correct control name. Missed in v2.

Change since v3:
Addressed comments from Hans in v4l2 patch.
Enabled the support for cyclic intra refresh in venus driver.

Thanks,
Dikshita

Dikshita Agarwal (2):
media: v4l2-ctrls: Add intra-refresh type control
venus: venc: Add support for intra-refresh mode

.../userspace-api/media/v4l/ext-ctrls-codec.rst | 22 ++++++++++++++++++++++
drivers/media/platform/qcom/venus/core.h | 1 +
drivers/media/platform/qcom/venus/venc.c | 6 +++++-
drivers/media/platform/qcom/venus/venc_ctrls.c | 10 ++++++++++
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 9 +++++++++
include/uapi/linux/v4l2-controls.h | 5 +++++
6 files changed, 52 insertions(+), 1 deletion(-)

--
2.7.4


2022-03-14 22:25:42

by Dikshita Agarwal

[permalink] [raw]
Subject: [PATCH v4 1/2] media: v4l2-ctrls: Add intra-refresh type control

From: Dikshita Agarwal <[email protected]>

Add a control to set intra-refresh type.

Signed-off-by: Dikshita Agarwal <[email protected]>
Reviewed-by: Nicolas Dufresne <[email protected]>
---
.../userspace-api/media/v4l/ext-ctrls-codec.rst | 22 ++++++++++++++++++++++
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 9 +++++++++
include/uapi/linux/v4l2-controls.h | 5 +++++
3 files changed, 36 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
index 4cd7c54..1539cd5 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
@@ -1180,6 +1180,28 @@ enum v4l2_mpeg_video_h264_entropy_mode -
is set to non zero value.
Applicable to H264, H263 and MPEG4 encoder.

+``V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE (enum)``
+
+enum v4l2_mpeg_video_intra_refresh_period_type -
+ Sets the type of intra refresh. The period to refresh
+ the whole frame is specified by V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD.
+ Note that if this control is not present, then it is undefined what
+ refresh type is used and it is up to the drive to decide.
+ Applicable to H264 and HEVC encoders. Possible values are:
+
+.. tabularcolumns:: |p{9.6cm}|p{7.9cm}|
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - ``V4L2_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM``
+ - The whole frame is completely refreshed randomly
+ after the specified period.
+ * - ``V4L2_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC``
+ - The whole frame MBs are completely refreshed in cyclic order
+ after the specified period.
+
``V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (integer)``
Intra macroblock refresh period. This sets the period to refresh
the whole frame. In other words, this defines the number of frames
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index 54ca4e6..3089e50 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -572,6 +572,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
"VBV/CPB Limit",
NULL,
};
+ static const char * const intra_refresh_period_type[] = {
+ "Random",
+ "Cyclic",
+ NULL,
+ };

switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -705,6 +710,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return hevc_start_code;
case V4L2_CID_CAMERA_ORIENTATION:
return camera_orientation;
+ case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE:
+ return intra_refresh_period_type;
default:
return NULL;
}
@@ -834,6 +841,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: return "Decoder Slice Interface";
case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: return "MPEG4 Loop Filter Enable";
case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB: return "Number of Intra Refresh MBs";
+ case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE: return "Intra Refresh Priod Type";
case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD: return "Intra Refresh Period";
case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: return "Frame Level Rate Control Enable";
case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: return "H264 MB Level Rate Control";
@@ -1360,6 +1368,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_STATELESS_H264_DECODE_MODE:
case V4L2_CID_STATELESS_H264_START_CODE:
case V4L2_CID_CAMERA_ORIENTATION:
+ case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_LINK_FREQ:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index c8e0f84..e7df4c5 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -443,6 +443,11 @@ enum v4l2_mpeg_video_multi_slice_mode {
#define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (V4L2_CID_CODEC_BASE+234)
#define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (V4L2_CID_CODEC_BASE+235)
#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (V4L2_CID_CODEC_BASE+236)
+#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE (V4L2_CID_CODEC_BASE+237)
+enum v4l2_mpeg_video_intra_refresh_period_type {
+ V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM = 0,
+ V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1,
+};

/* CIDs for the MPEG-2 Part 2 (H.262) codec */
#define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270)
--
2.7.4

2022-03-17 05:07:37

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH v4 1/2] media: v4l2-ctrls: Add intra-refresh type control



On 3/14/22 11:09, [email protected] wrote:
> From: Dikshita Agarwal <[email protected]>
>
> Add a control to set intra-refresh type.
>
> Signed-off-by: Dikshita Agarwal <[email protected]>
> Reviewed-by: Nicolas Dufresne <[email protected]>
> ---
> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 22 ++++++++++++++++++++++
> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 9 +++++++++
> include/uapi/linux/v4l2-controls.h | 5 +++++
> 3 files changed, 36 insertions(+)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> index 4cd7c54..1539cd5 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
> @@ -1180,6 +1180,28 @@ enum v4l2_mpeg_video_h264_entropy_mode -
> is set to non zero value.
> Applicable to H264, H263 and MPEG4 encoder.
>
> +``V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE (enum)``
> +
> +enum v4l2_mpeg_video_intra_refresh_period_type -
> + Sets the type of intra refresh. The period to refresh
> + the whole frame is specified by V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD.
> + Note that if this control is not present, then it is undefined what
> + refresh type is used and it is up to the drive to decide.

drive -> driver

> + Applicable to H264 and HEVC encoders. Possible values are:
> +
> +.. tabularcolumns:: |p{9.6cm}|p{7.9cm}|
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * - ``V4L2_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM``
> + - The whole frame is completely refreshed randomly
> + after the specified period.
> + * - ``V4L2_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC``
> + - The whole frame MBs are completely refreshed in cyclic order
> + after the specified period.
> +
> ``V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (integer)``
> Intra macroblock refresh period. This sets the period to refresh
> the whole frame. In other words, this defines the number of frames
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> index 54ca4e6..3089e50 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> @@ -572,6 +572,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
> "VBV/CPB Limit",
> NULL,
> };
> + static const char * const intra_refresh_period_type[] = {
> + "Random",
> + "Cyclic",
> + NULL,
> + };
>
> switch (id) {
> case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
> @@ -705,6 +710,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
> return hevc_start_code;
> case V4L2_CID_CAMERA_ORIENTATION:
> return camera_orientation;
> + case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE:
> + return intra_refresh_period_type;
> default:
> return NULL;
> }
> @@ -834,6 +841,7 @@ const char *v4l2_ctrl_get_name(u32 id)
> case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: return "Decoder Slice Interface";
> case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: return "MPEG4 Loop Filter Enable";
> case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB: return "Number of Intra Refresh MBs";
> + case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE: return "Intra Refresh Priod Type";

Priod -> Period

> case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD: return "Intra Refresh Period";
> case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: return "Frame Level Rate Control Enable";
> case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: return "H264 MB Level Rate Control";
> @@ -1360,6 +1368,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
> case V4L2_CID_STATELESS_H264_DECODE_MODE:
> case V4L2_CID_STATELESS_H264_START_CODE:
> case V4L2_CID_CAMERA_ORIENTATION:
> + case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE:
> *type = V4L2_CTRL_TYPE_MENU;
> break;
> case V4L2_CID_LINK_FREQ:
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index c8e0f84..e7df4c5 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -443,6 +443,11 @@ enum v4l2_mpeg_video_multi_slice_mode {
> #define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (V4L2_CID_CODEC_BASE+234)
> #define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (V4L2_CID_CODEC_BASE+235)
> #define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (V4L2_CID_CODEC_BASE+236)
> +#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE (V4L2_CID_CODEC_BASE+237)
> +enum v4l2_mpeg_video_intra_refresh_period_type {
> + V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_RANDOM = 0,
> + V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE_CYCLIC = 1,
> +};
>
> /* CIDs for the MPEG-2 Part 2 (H.262) codec */
> #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270)

After fixing these two typos you can add my:

Acked-by: Hans Verkuil <[email protected]>

I assume that Stanimir will merge this together with patch 2/2.

Regards,

Hans

2022-04-07 06:51:24

by Stanimir Varbanov

[permalink] [raw]
Subject: Re: [PATCH v4 0/2] Introduce Intra-refresh type control

Dikshita,

I cannot find new version of this patchset with Han's comments addressed?

On 3/14/22 12:09, [email protected] wrote:
> From: Dikshita Agarwal <[email protected]>
>
> Hi,
>
> This series add a new intra-refresh type control for encoders.
> this can be used to specify which intra refresh to be enabled, random, cyclic or none.
>
> Change since v0:
> Dropped INTRA_REFRESH_TYPE_NONE as it was not needed.
> Intra refresh period value as zero will disable the intra refresh.
>
> Change since v1:
> Updated the control name for better undestanding.
> Also updated the documentation accordingly.
>
> Change since v2:
> Updated the venus driver implementation as well to use the correct control name. Missed in v2.
>
> Change since v3:
> Addressed comments from Hans in v4l2 patch.
> Enabled the support for cyclic intra refresh in venus driver.
>
> Thanks,
> Dikshita
>
> Dikshita Agarwal (2):
> media: v4l2-ctrls: Add intra-refresh type control
> venus: venc: Add support for intra-refresh mode
>
> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 22 ++++++++++++++++++++++
> drivers/media/platform/qcom/venus/core.h | 1 +
> drivers/media/platform/qcom/venus/venc.c | 6 +++++-
> drivers/media/platform/qcom/venus/venc_ctrls.c | 10 ++++++++++
> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 9 +++++++++
> include/uapi/linux/v4l2-controls.h | 5 +++++
> 6 files changed, 52 insertions(+), 1 deletion(-)
>

--
regards,
Stan

2022-04-21 19:22:30

by Dikshita Agarwal

[permalink] [raw]
Subject: RE: [PATCH v4 0/2] Introduce Intra-refresh type control

Hi Stan,

I was waiting for your comments on Venus changes if any, so that I can address all comments together in next patch.
Posted a new patchset v5 now, pls review.

Thanks,
Dikshita Agarwal

-----Original Message-----
From: Stanimir Varbanov <[email protected]>
Sent: Thursday, April 07, 2022 1:53 AM
To: Dikshita Agarwal (QUIC) <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Maheshwar Ajja (QUIC) <[email protected]>; quic_jdas <[email protected]>
Subject: Re: [PATCH v4 0/2] Introduce Intra-refresh type control

Dikshita,

I cannot find new version of this patchset with Han's comments addressed?

On 3/14/22 12:09, [email protected] wrote:
> From: Dikshita Agarwal <[email protected]>
>
> Hi,
>
> This series add a new intra-refresh type control for encoders.
> this can be used to specify which intra refresh to be enabled, random, cyclic or none.
>
> Change since v0:
> Dropped INTRA_REFRESH_TYPE_NONE as it was not needed.
> Intra refresh period value as zero will disable the intra refresh.
>
> Change since v1:
> Updated the control name for better undestanding.
> Also updated the documentation accordingly.
>
> Change since v2:
> Updated the venus driver implementation as well to use the correct control name. Missed in v2.
>
> Change since v3:
> Addressed comments from Hans in v4l2 patch.
> Enabled the support for cyclic intra refresh in venus driver.
>
> Thanks,
> Dikshita
>
> Dikshita Agarwal (2):
> media: v4l2-ctrls: Add intra-refresh type control
> venus: venc: Add support for intra-refresh mode
>
> .../userspace-api/media/v4l/ext-ctrls-codec.rst | 22 ++++++++++++++++++++++
> drivers/media/platform/qcom/venus/core.h | 1 +
> drivers/media/platform/qcom/venus/venc.c | 6 +++++-
> drivers/media/platform/qcom/venus/venc_ctrls.c | 10 ++++++++++
> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 9 +++++++++
> include/uapi/linux/v4l2-controls.h | 5 +++++
> 6 files changed, 52 insertions(+), 1 deletion(-)
>

--
regards,
Stan