Re: [Patch v4 10/12] [media] v4l2: Add v4l2 control IDs for HEVC encoder

2017-04-07 Thread Smitha T Murthy
On Fri, 2017-04-07 at 11:25 +0200, Sylwester Nawrocki wrote:
> On 04/07/2017 10:31 AM, Smitha T Murthy wrote:
> > On Thu, 2017-04-06 at 15:14 +0200, Sylwester Nawrocki wrote:
> >> On 04/06/2017 08:11 AM, Smitha T Murthy wrote:
> >>> @@ -775,6 +832,47 @@ const char *v4l2_ctrl_get_name(u32 id)
> >>>   case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return "VPX 
> >>> P-Frame QP Value";
> >>>   case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:   return "VPX 
> >>> Profile";
> >>>
> >>> + /* HEVC controls */
> >> [...]
> >>> + case V4L2_CID_MPEG_VIDEO_HEVC_LF_SLICE_BOUNDARY:return "HEVC LF 
> >>> Across Slice Boundary or Not";
> >> Please make sure the names are no longer than 31 characters to avoid
> >> truncation during control enumeration in user space.
> >> Data structures like struct v4l2_queryctrl, struct v4l2_query_ext_ctrl
> >> have only 32 bytes long array dedicated for the control name.
>  >
> > I will try to make the names less than 31 characters long without losing
> > the context. But there are many control names in this file which are
> > longer than 31 characters like
> > V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP,
> > V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD etc so I assumed it was
> > alright to have such long names. But I will shorten them as per your
> > suggestion.
> 
> Apologies if it wasn't clean enough but my comment referred to the
> length of the character string being returned (e.g. "HEVC LF Across
> Slice Boundary or Not") and not to the name of the enum.
> 
> --
> Regards,
> Sylwester
> 
Sorry I misunderstood I will take care of it in the next version.

Thank you,
Smitha




Re: [Patch v4 10/12] [media] v4l2: Add v4l2 control IDs for HEVC encoder

2017-04-07 Thread Sylwester Nawrocki

On 04/07/2017 10:31 AM, Smitha T Murthy wrote:

On Thu, 2017-04-06 at 15:14 +0200, Sylwester Nawrocki wrote:

On 04/06/2017 08:11 AM, Smitha T Murthy wrote:

@@ -775,6 +832,47 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return "VPX P-Frame 
QP Value";
case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:   return "VPX 
Profile";

+   /* HEVC controls */

[...]

+   case V4L2_CID_MPEG_VIDEO_HEVC_LF_SLICE_BOUNDARY:return "HEVC LF 
Across Slice Boundary or Not";

Please make sure the names are no longer than 31 characters to avoid
truncation during control enumeration in user space.
Data structures like struct v4l2_queryctrl, struct v4l2_query_ext_ctrl
have only 32 bytes long array dedicated for the control name.

>

I will try to make the names less than 31 characters long without losing
the context. But there are many control names in this file which are
longer than 31 characters like
V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP,
V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD etc so I assumed it was
alright to have such long names. But I will shorten them as per your
suggestion.


Apologies if it wasn't clean enough but my comment referred to the
length of the character string being returned (e.g. "HEVC LF Across
Slice Boundary or Not") and not to the name of the enum.

--
Regards,
Sylwester


Re: [Patch v4 10/12] [media] v4l2: Add v4l2 control IDs for HEVC encoder

2017-04-07 Thread Smitha T Murthy
On Thu, 2017-04-06 at 15:14 +0200, Sylwester Nawrocki wrote:
> On 04/06/2017 08:11 AM, Smitha T Murthy wrote:
> > @@ -775,6 +832,47 @@ const char *v4l2_ctrl_get_name(u32 id)
> > case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return "VPX 
> > P-Frame QP Value";
> > case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:   return "VPX 
> > Profile";
> >  
> > +   /* HEVC controls */
> [...]
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_LF_SLICE_BOUNDARY:return "HEVC LF 
> > Across Slice Boundary or Not";
> 
> Please make sure the names are no longer than 31 characters to avoid
> truncation during control enumeration in user space.
> Data structures like struct v4l2_queryctrl, struct v4l2_query_ext_ctrl
> have only 32 bytes long array dedicated for the control name.

I will try to make the names less than 31 characters long without losing
the context. But there are many control names in this file which are
longer than 31 characters like
V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP,
V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD etc so I assumed it was
alright to have such long names. But I will shorten them as per your
suggestion.

> 
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_QP:  return "HEVC QP 
> > Values";
> 
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_TYPE: return "HEVC 
> > Hierarchical Coding Type";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER:return "HEVC 
> > Hierarchical Coding Layer";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_QP:return "HEVC 
> > Hierarchical Layer QP";
> 
> How about s/HIERARCHICAL_/HIER_ for the above 3 control IDs?
> 
Ok I will change it.

> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER0_BITRATE:return "HEVC 
> > Hierarchical Lay 0 Bit Rate";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER1_BITRATE:return "HEVC 
> > Hierarchical Lay 1 Bit Rate";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER2_BITRATE:return "HEVC 
> > Hierarchical Lay 2 Bit Rate";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER3_BITRATE:return "HEVC 
> > Hierarchical Lay 3 Bit Rate";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER4_BITRATE:return "HEVC 
> > Hierarchical Lay 4 Bit Rate";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER5_BITRATE:return "HEVC 
> > Hierarchical Lay 5 Bit Rate";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER6_BITRATE:return "HEVC 
> > Hierarchical Lay 6 Bit Rate";
> 
> Using single letter L instead of LAYER would make the control ID shorter
> and more consistent with existing controls, e.g. 
> V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BITRATE.
> 
Ok I will change it.

> > +   case V4L2_CID_MPEG_VIDEO_HEVC_SIGN_DATA_HIDING: return "HEVC 
> > Sign Data Hiding";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB:   return "HEVC 
> > General PB";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID:  return "HEVC 
> > Temporal ID";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOOTHING: return "HEVC 
> > Strong Intra Smoothing";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_INTRA_PU_SPLIT:   return "HEVC 
> > Intra PU Split";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_TMV_PREDICTION:   return "HEVC 
> > TMV Prediction";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1:  return "HEVC 
> > Max Number of Candidate MVs";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE:return "HEVC 
> > ENC Without Startcode";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD:   return "HEVC 
> > Num of I Frame b/w 2 IDR";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_LF_BETA_OFFSET_DIV2:  return "HEVC 
> > Loop Filter Beta Offset";
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_LF_TC_OFFSET_DIV2:return "HEVC 
> > Loop Filter tc Offset";
> 
> s/tc/Tc or s/tc/TC ?
> 
I will correct it.
> > +   case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD: return "HEVC 
> > Size of Length Field";
> 
> --
> Thanks,
> Sylwester
> 
Thank you for the review.

Regards,
Smitha




Re: [Patch v4 10/12] [media] v4l2: Add v4l2 control IDs for HEVC encoder

2017-04-06 Thread Sylwester Nawrocki
On 04/06/2017 08:11 AM, Smitha T Murthy wrote:
> @@ -775,6 +832,47 @@ const char *v4l2_ctrl_get_name(u32 id)
>   case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return "VPX 
> P-Frame QP Value";
>   case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:   return "VPX 
> Profile";
>  
> + /* HEVC controls */
[...]
> + case V4L2_CID_MPEG_VIDEO_HEVC_LF_SLICE_BOUNDARY:return "HEVC LF 
> Across Slice Boundary or Not";

Please make sure the names are no longer than 31 characters to avoid
truncation during control enumeration in user space.
Data structures like struct v4l2_queryctrl, struct v4l2_query_ext_ctrl
have only 32 bytes long array dedicated for the control name.

> + case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_QP:  return "HEVC QP 
> Values";

> + case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_TYPE: return "HEVC 
> Hierarchical Coding Type";
> + case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER:return "HEVC 
> Hierarchical Coding Layer";
> + case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_QP:return "HEVC 
> Hierarchical Layer QP";

How about s/HIERARCHICAL_/HIER_ for the above 3 control IDs?

> + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER0_BITRATE:return "HEVC 
> Hierarchical Lay 0 Bit Rate";
> + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER1_BITRATE:return "HEVC 
> Hierarchical Lay 1 Bit Rate";
> + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER2_BITRATE:return "HEVC 
> Hierarchical Lay 2 Bit Rate";
> + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER3_BITRATE:return "HEVC 
> Hierarchical Lay 3 Bit Rate";
> + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER4_BITRATE:return "HEVC 
> Hierarchical Lay 4 Bit Rate";
> + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER5_BITRATE:return "HEVC 
> Hierarchical Lay 5 Bit Rate";
> + case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER6_BITRATE:return "HEVC 
> Hierarchical Lay 6 Bit Rate";

Using single letter L instead of LAYER would make the control ID shorter
and more consistent with existing controls, e.g. 
V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BITRATE.

> + case V4L2_CID_MPEG_VIDEO_HEVC_SIGN_DATA_HIDING: return "HEVC 
> Sign Data Hiding";
> + case V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB:   return "HEVC 
> General PB";
> + case V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID:  return "HEVC 
> Temporal ID";
> + case V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOOTHING: return "HEVC 
> Strong Intra Smoothing";
> + case V4L2_CID_MPEG_VIDEO_HEVC_INTRA_PU_SPLIT:   return "HEVC 
> Intra PU Split";
> + case V4L2_CID_MPEG_VIDEO_HEVC_TMV_PREDICTION:   return "HEVC 
> TMV Prediction";
> + case V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1:  return "HEVC 
> Max Number of Candidate MVs";
> + case V4L2_CID_MPEG_VIDEO_HEVC_WITHOUT_STARTCODE:return "HEVC 
> ENC Without Startcode";
> + case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD:   return "HEVC 
> Num of I Frame b/w 2 IDR";
> + case V4L2_CID_MPEG_VIDEO_HEVC_LF_BETA_OFFSET_DIV2:  return "HEVC 
> Loop Filter Beta Offset";
> + case V4L2_CID_MPEG_VIDEO_HEVC_LF_TC_OFFSET_DIV2:return "HEVC 
> Loop Filter tc Offset";

s/tc/Tc or s/tc/TC ?

> + case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD: return "HEVC 
> Size of Length Field";

--
Thanks,
Sylwester


[Patch v4 10/12] [media] v4l2: Add v4l2 control IDs for HEVC encoder

2017-04-06 Thread Smitha T Murthy
Add v4l2 controls for HEVC encoder

Signed-off-by: Smitha T Murthy 
Reviewed-by: Andrzej Hajda 
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 104 +++
 include/uapi/linux/v4l2-controls.h   | 132 +++
 2 files changed, 236 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b9e08e3..b68d38b5 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -479,6 +479,51 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
NULL,
};
 
+   static const char * const hevc_profile[] = {
+   "Main",
+   "Main Still Picture",
+   NULL,
+   };
+   static const char * const hevc_level[] = {
+   "1",
+   "2",
+   "2.1",
+   "3",
+   "3.1",
+   "4",
+   "4.1",
+   "5",
+   "5.1",
+   "5.2",
+   "6",
+   "6.1",
+   "6.2",
+   NULL,
+   };
+   static const char * const hevc_hierarchial_coding_type[] = {
+   "B",
+   "P",
+   NULL,
+   };
+   static const char * const hevc_refresh_type[] = {
+   "None",
+   "CRA",
+   "IDR",
+   NULL,
+   };
+   static const char * const hevc_size_of_length_field[] = {
+   "0",
+   "1",
+   "2",
+   "4",
+   NULL,
+   };
+   static const char * const hevc_tier_flag[] = {
+   "Main",
+   "High",
+   NULL,
+   };
+
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -574,6 +619,18 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return dv_it_content_type;
case V4L2_CID_DETECT_MD_MODE:
return detect_md_mode;
+   case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
+   return hevc_profile;
+   case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:
+   return hevc_level;
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_TYPE:
+   return hevc_hierarchial_coding_type;
+   case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE:
+   return hevc_refresh_type;
+   case V4L2_CID_MPEG_VIDEO_HEVC_SIZE_OF_LENGTH_FIELD:
+   return hevc_size_of_length_field;
+   case V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG:
+   return hevc_tier_flag;
 
default:
return NULL;
@@ -775,6 +832,47 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return "VPX 
P-Frame QP Value";
case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:   return "VPX 
Profile";
 
+   /* HEVC controls */
+   case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP:   return "HEVC 
I-Frame QP Value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP:   return "HEVC 
P-Frame QP Value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP:   return "HEVC 
B-Frame QP Value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP:   return "HEVC 
Minimum QP Value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP:   return "HEVC 
Maximum QP Value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:  return "HEVC 
Profile";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:return "HEVC 
Level";
+   case V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG:return "HEVC 
Tier_flag";
+   case V4L2_CID_MPEG_VIDEO_HEVC_FRAME_RATE_RESOLUTION:return "HEVC 
Frame Rate Resolution";
+   case V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH:  return "HEVC 
Maximum Coding Unit Depth";
+   case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE: return "HEVC 
Refresh Type";
+   case V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED: return "HEVC 
Constant Intra Prediction";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU:  return "HEVC 
Lossless Encoding";
+   case V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT:return "HEVC 
Wavefront";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LF:   return "HEVC 
Loop Filter";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LF_SLICE_BOUNDARY:return "HEVC LF 
Across Slice Boundary or Not";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_QP:  return "HEVC QP 
Values";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_TYPE: return "HEVC 
Hierarchical Coding Type";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER:return "HEVC 
Hierarchical Coding Layer";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_QP:return "HEVC 
Hierarchical Layer QP";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_LAYER0_BITRATE:return "HEVC 
Hierarchical Lay 0 Bit