linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks
@ 2013-12-30 10:43 Amit Grover
  2014-01-23  5:19 ` swaminathan
  2014-01-23 10:11 ` Kamil Debski
  0 siblings, 2 replies; 17+ messages in thread
From: Amit Grover @ 2013-12-30 10:43 UTC (permalink / raw)
  To: m.chehab, linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, rob, kyungmin.park, k.debski, jtp.park
  Cc: hans.verkuil, andrew.smirnov, s.nawrocki, arun.kk,
	anatol.pomozov, jmccrohan, austin.lobo, Swami Nathan

This patch adds Controls to set Horizontal and Vertical search range
for Motion Estimation block for Samsung MFC video Encoders.

Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
Signed-off-by: Amit Grover <amit.grover@samsung.com>
---
 Documentation/DocBook/media/v4l/controls.xml    |   14 +++++++++++++
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24 +++++++++++++++++++++++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
 drivers/media/v4l2-core/v4l2-ctrls.c            |   14 +++++++++++++
 include/uapi/linux/v4l2-controls.h              |    2 ++
 6 files changed, 58 insertions(+), 6 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
index 7a3b49b..70a0f6f 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2258,6 +2258,20 @@ Applicable to the MPEG1, MPEG2, MPEG4 encoders.</entry>
 VBV buffer control.</entry>
 	      </row>
 
+		  <row><entry></entry></row>
+	      <row id="v4l2-mpeg-video-horz-search-range">
+		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE</constant>&nbsp;</entry>
+		<entry>integer</entry>
+	      </row><row><entry spanname="descr">Sets the Horizontal search range for Video Macro blocks.</entry>
+	      </row>
+
+		 <row><entry></entry></row>
+	      <row id="v4l2-mpeg-video-vert-search-range">
+		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE</constant>&nbsp;</entry>
+		<entry>integer</entry>
+	      </row><row><entry spanname="descr">Sets the Vertical search range for Video Macro blocks.</entry>
+	      </row>
+
 	      <row><entry></entry></row>
 	      <row>
 		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&nbsp;</entry>
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 6920b54..f2c13c3 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -430,6 +430,8 @@ struct s5p_mfc_vp8_enc_params {
 struct s5p_mfc_enc_params {
 	u16 width;
 	u16 height;
+	u32 horz_range;
+	u32 vert_range;
 
 	u16 gop_size;
 	enum v4l2_mpeg_video_multi_slice_mode slice_mode;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 4ff3b6c..a02e7b8 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
 		.default_value = 0,
 	},
 	{
+		.id = V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE,
+		.type = V4L2_CTRL_TYPE_INTEGER,
+		.name = "horizontal search range of video macro block",
+		.minimum = 16,
+		.maximum = 128,
+		.step = 16,
+		.default_value = 32,
+	},
+	{
+		.id = V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE,
+		.type = V4L2_CTRL_TYPE_INTEGER,
+		.name = "vertical search range of video macro block",
+		.minimum = 16,
+		.maximum = 128,
+		.step = 16,
+		.default_value = 32,
+	},
+	{
 		.id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
 		.type = V4L2_CTRL_TYPE_INTEGER,
 		.minimum = 0,
@@ -1377,6 +1395,12 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_MPEG_VIDEO_VBV_SIZE:
 		p->vbv_size = ctrl->val;
 		break;
+	case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:
+		p->horz_range = ctrl->val;
+		break;
+	case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:
+		p->vert_range = ctrl->val;
+		break;
 	case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
 		p->codec.h264.cpb_size = ctrl->val;
 		break;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 461358c..47e1807 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -727,14 +727,10 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)
 	WRITEL(reg, S5P_FIMV_E_RC_CONFIG_V6);
 
 	/* setting for MV range [16, 256] */
-	reg = 0;
-	reg &= ~(0x3FFF);
-	reg = 256;
+	reg = (p->horz_range & 0x3fff);	/* conditional check in app */
 	WRITEL(reg, S5P_FIMV_E_MV_HOR_RANGE_V6);
 
-	reg = 0;
-	reg &= ~(0x3FFF);
-	reg = 256;
+	reg = (p->vert_range & 0x3fff);	/* conditional check in app */
 	WRITEL(reg, S5P_FIMV_E_MV_VER_RANGE_V6);
 
 	WRITEL(0x0, S5P_FIMV_E_FRAME_INSERTION_V6);
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index fb46790..7cf23d5 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return "Video Decoder PTS";
 	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return "Video Decoder Frame Count";
 	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:			return "Initial Delay for VBV Control";
+	case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:		return "hor search range of video MB";
+	case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:		return "vert search range of video MB";
 	case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:		return "Repeat Sequence Header";
 
 	/* VPX controls */
@@ -905,6 +907,18 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 		*min = 0;
 		*max = *step = 1;
 		break;
+	case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:
+		*type = V4L2_CTRL_TYPE_INTEGER;
+		*min = 16;
+		*max = 128;
+		*step = 16;
+		break;
+	case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:
+		*type = V4L2_CTRL_TYPE_INTEGER;
+		*min = 16;
+		*max = 128;
+		*step = 16;
+		break;
 	case V4L2_CID_PAN_RESET:
 	case V4L2_CID_TILT_RESET:
 	case V4L2_CID_FLASH_STROBE:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 1666aab..bcce536 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -372,6 +372,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_DEC_FRAME			(V4L2_CID_MPEG_BASE+224)
 #define V4L2_CID_MPEG_VIDEO_VBV_DELAY			(V4L2_CID_MPEG_BASE+225)
 #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER		(V4L2_CID_MPEG_BASE+226)
+#define V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+227)
+#define V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+228)
 
 #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP		(V4L2_CID_MPEG_BASE+300)
 #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP		(V4L2_CID_MPEG_BASE+301)
-- 
1.7.9.5


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

* Re: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks
  2013-12-30 10:43 [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks Amit Grover
@ 2014-01-23  5:19 ` swaminathan
  2014-01-23  5:42   ` Prabhakar Lad
  2014-01-23 10:11 ` Kamil Debski
  1 sibling, 1 reply; 17+ messages in thread
From: swaminathan @ 2014-01-23  5:19 UTC (permalink / raw)
  To: Amit Grover, linux-media, linux-doc, linux-kernel,
	linux-arm-kernel, linux-samsung-soc, rob, kyungmin.park,
	k.debski, jtp.park
  Cc: hans.verkuil, andrew.smirnov, s.nawrocki, arun.kk,
	anatol.pomozov, jmccrohan, austin.lobo, hverkuil

Hi All,
Is there any review Comments for the patch "[PATCH] [media] s5p-mfc: Add 
Horizontal and Vertical search range for Video Macro Blocks"
posted on 30-Dec-2013 ?


Regards,
Swaminathan




--------------------------------------------------
From: "Amit Grover" <amit.grover@samsung.com>
Sent: Monday, December 30, 2013 4:13 PM
To: <m.chehab@samsung.com>; <linux-media@vger.kernel.org>; 
<linux-doc@vger.kernel.org>; <linux-kernel@vger.kernel.org>; 
<linux-arm-kernel@lists.infradead.org>; <linux-samsung-soc@vger.kernel.org>; 
<rob@landley.net>; <kyungmin.park@samsung.com>; <k.debski@samsung.com>; 
<jtp.park@samsung.com>
Cc: <hans.verkuil@cisco.com>; <andrew.smirnov@gmail.com>; 
<s.nawrocki@samsung.com>; <arun.kk@samsung.com>; <anatol.pomozov@gmail.com>; 
<jmccrohan@gmail.com>; <austin.lobo@samsung.com>; "Swami Nathan" 
<swaminath.p@samsung.com>
Subject: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range 
for Video Macro Blocks

> This patch adds Controls to set Horizontal and Vertical search range
> for Motion Estimation block for Samsung MFC video Encoders.
>
> Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
> Signed-off-by: Amit Grover <amit.grover@samsung.com>
> ---
> Documentation/DocBook/media/v4l/controls.xml    |   14 +++++++++++++
> drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
> drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24 
> +++++++++++++++++++++++
> drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
> drivers/media/v4l2-core/v4l2-ctrls.c            |   14 +++++++++++++
> include/uapi/linux/v4l2-controls.h              |    2 ++
> 6 files changed, 58 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/DocBook/media/v4l/controls.xml 
> b/Documentation/DocBook/media/v4l/controls.xml
> index 7a3b49b..70a0f6f 100644
> --- a/Documentation/DocBook/media/v4l/controls.xml
> +++ b/Documentation/DocBook/media/v4l/controls.xml
> @@ -2258,6 +2258,20 @@ Applicable to the MPEG1, MPEG2, MPEG4 
> encoders.</entry>
> VBV buffer control.</entry>
>        </row>
>
> +   <row><entry></entry></row>
> +       <row id="v4l2-mpeg-video-horz-search-range">
> + <entry 
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE</constant>&nbsp;</entry>
> + <entry>integer</entry>
> +       </row><row><entry spanname="descr">Sets the Horizontal search 
> range for Video Macro blocks.</entry>
> +       </row>
> +
> + <row><entry></entry></row>
> +       <row id="v4l2-mpeg-video-vert-search-range">
> + <entry 
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE</constant>&nbsp;</entry>
> + <entry>integer</entry>
> +       </row><row><entry spanname="descr">Sets the Vertical search range 
> for Video Macro blocks.</entry>
> +       </row>
> +
>        <row><entry></entry></row>
>        <row>
>  <entry 
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&nbsp;</entry>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> index 6920b54..f2c13c3 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> @@ -430,6 +430,8 @@ struct s5p_mfc_vp8_enc_params {
> struct s5p_mfc_enc_params {
>  u16 width;
>  u16 height;
> + u32 horz_range;
> + u32 vert_range;
>
>  u16 gop_size;
>  enum v4l2_mpeg_video_multi_slice_mode slice_mode;
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index 4ff3b6c..a02e7b8 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
>  .default_value = 0,
>  },
>  {
> + .id = V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE,
> + .type = V4L2_CTRL_TYPE_INTEGER,
> + .name = "horizontal search range of video macro block",
> + .minimum = 16,
> + .maximum = 128,
> + .step = 16,
> + .default_value = 32,
> + },
> + {
> + .id = V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE,
> + .type = V4L2_CTRL_TYPE_INTEGER,
> + .name = "vertical search range of video macro block",
> + .minimum = 16,
> + .maximum = 128,
> + .step = 16,
> + .default_value = 32,
> + },
> + {
>  .id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
>  .type = V4L2_CTRL_TYPE_INTEGER,
>  .minimum = 0,
> @@ -1377,6 +1395,12 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl 
> *ctrl)
>  case V4L2_CID_MPEG_VIDEO_VBV_SIZE:
>  p->vbv_size = ctrl->val;
>  break;
> + case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:
> + p->horz_range = ctrl->val;
> + break;
> + case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:
> + p->vert_range = ctrl->val;
> + break;
>  case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
>  p->codec.h264.cpb_size = ctrl->val;
>  break;
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> index 461358c..47e1807 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> @@ -727,14 +727,10 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx 
> *ctx)
>  WRITEL(reg, S5P_FIMV_E_RC_CONFIG_V6);
>
>  /* setting for MV range [16, 256] */
> - reg = 0;
> - reg &= ~(0x3FFF);
> - reg = 256;
> + reg = (p->horz_range & 0x3fff); /* conditional check in app */
>  WRITEL(reg, S5P_FIMV_E_MV_HOR_RANGE_V6);
>
> - reg = 0;
> - reg &= ~(0x3FFF);
> - reg = 256;
> + reg = (p->vert_range & 0x3fff); /* conditional check in app */
>  WRITEL(reg, S5P_FIMV_E_MV_VER_RANGE_V6);
>
>  WRITEL(0x0, S5P_FIMV_E_FRAME_INSERTION_V6);
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
> b/drivers/media/v4l2-core/v4l2-ctrls.c
> index fb46790..7cf23d5 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
>  case V4L2_CID_MPEG_VIDEO_DEC_PTS: return "Video Decoder PTS";
>  case V4L2_CID_MPEG_VIDEO_DEC_FRAME: return "Video Decoder Frame Count";
>  case V4L2_CID_MPEG_VIDEO_VBV_DELAY: return "Initial Delay for VBV 
> Control";
> + case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE: return "hor search range of 
> video MB";
> + case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE: return "vert search range of 
> video MB";
>  case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER: return "Repeat Sequence 
> Header";
>
>  /* VPX controls */
> @@ -905,6 +907,18 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
> v4l2_ctrl_type *type,
>  *min = 0;
>  *max = *step = 1;
>  break;
> + case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:
> + *type = V4L2_CTRL_TYPE_INTEGER;
> + *min = 16;
> + *max = 128;
> + *step = 16;
> + break;
> + case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:
> + *type = V4L2_CTRL_TYPE_INTEGER;
> + *min = 16;
> + *max = 128;
> + *step = 16;
> + break;
>  case V4L2_CID_PAN_RESET:
>  case V4L2_CID_TILT_RESET:
>  case V4L2_CID_FLASH_STROBE:
> diff --git a/include/uapi/linux/v4l2-controls.h 
> b/include/uapi/linux/v4l2-controls.h
> index 1666aab..bcce536 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -372,6 +372,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
> #define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
> #define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225)
> #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE+226)
> +#define V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE (V4L2_CID_MPEG_BASE+227)
> +#define V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228)
>
> #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
> #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks
  2014-01-23  5:19 ` swaminathan
@ 2014-01-23  5:42   ` Prabhakar Lad
  0 siblings, 0 replies; 17+ messages in thread
From: Prabhakar Lad @ 2014-01-23  5:42 UTC (permalink / raw)
  To: swaminathan
  Cc: Amit Grover, linux-media, LDOC, LKML, LAK, linux-samsung-soc,
	Rob Landley, Kyungmin Park, Kamil Debski, Jeongtae Park,
	anatol.pomozov, Andrey Smirnov, Hans Verkuil, Hans Verkuil,
	Sylwester Nawrocki, austin.lobo, jmccrohan, arun.kk

Hi Swaminathan,

On Thu, Jan 23, 2014 at 10:49 AM, swaminathan <swaminath.p@samsung.com> wrote:
> Hi All,
> Is there any review Comments for the patch "[PATCH] [media] s5p-mfc: Add
> Horizontal and Vertical search range for Video Macro Blocks"
> posted on 30-Dec-2013 ?
>
>
Just a side note, please don’t top post and always reply as plain text.

[Snip]

> Subject: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range
> for Video Macro Blocks
>
>
>> This patch adds Controls to set Horizontal and Vertical search range
>> for Motion Estimation block for Samsung MFC video Encoders.
>>
>> Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
>> Signed-off-by: Amit Grover <amit.grover@samsung.com>
>> ---
>> Documentation/DocBook/media/v4l/controls.xml    |   14 +++++++++++++
>> drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
>> drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24
>> +++++++++++++++++++++++
>> drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
>> drivers/media/v4l2-core/v4l2-ctrls.c            |   14 +++++++++++++
>> include/uapi/linux/v4l2-controls.h              |    2 ++
>> 6 files changed, 58 insertions(+), 6 deletions(-)
>>
This patch from the outset looks OK,  but you need to split up
into two, first adding a v4l control and second one using it up in the driver.

Regards,
--Prabhakar Lad

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

* RE: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks
  2013-12-30 10:43 [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks Amit Grover
  2014-01-23  5:19 ` swaminathan
@ 2014-01-23 10:11 ` Kamil Debski
  2014-01-23 10:21   ` Sylwester Nawrocki
  1 sibling, 1 reply; 17+ messages in thread
From: Kamil Debski @ 2014-01-23 10:11 UTC (permalink / raw)
  To: 'Amit Grover',
	m.chehab, linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, rob, kyungmin.park, jtp.park
  Cc: hans.verkuil, andrew.smirnov, Sylwester Nawrocki, arun.kk,
	anatol.pomozov, jmccrohan, austin.lobo, 'Swami Nathan'

Hi Amit,

> From: Amit Grover [mailto:amit.grover@samsung.com]
> Sent: Monday, December 30, 2013 11:43 AM
> 
> This patch adds Controls to set Horizontal and Vertical search range
> for Motion Estimation block for Samsung MFC video Encoders.
> 
> Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
> Signed-off-by: Amit Grover <amit.grover@samsung.com>
> ---
>  Documentation/DocBook/media/v4l/controls.xml    |   14 +++++++++++++
>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
>  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24
> +++++++++++++++++++++++
>  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
>  drivers/media/v4l2-core/v4l2-ctrls.c            |   14 +++++++++++++
>  include/uapi/linux/v4l2-controls.h              |    2 ++
>  6 files changed, 58 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/controls.xml
> b/Documentation/DocBook/media/v4l/controls.xml
> index 7a3b49b..70a0f6f 100644
> --- a/Documentation/DocBook/media/v4l/controls.xml
> +++ b/Documentation/DocBook/media/v4l/controls.xml
> @@ -2258,6 +2258,20 @@ Applicable to the MPEG1, MPEG2, MPEG4
> encoders.</entry>
>  VBV buffer control.</entry>
>  	      </row>
> 
> +		  <row><entry></entry></row>
> +	      <row id="v4l2-mpeg-video-horz-search-range">
> +		<entry
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE</constant

HORZ is nowhere used. HOR is more commonly used in control names.
V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE seems better.

> >&nbsp;</entry>
> +		<entry>integer</entry>
> +	      </row><row><entry spanname="descr">Sets the Horizontal
> search range for Video Macro blocks.</entry>
> +	      </row>

It's expressed in pixels? If so then it should be mentioned here. Also I
think this lacks the mention that it is used for motion estimation.
Please add a more detailed description.

> +
> +		 <row><entry></entry></row>
> +	      <row id="v4l2-mpeg-video-vert-search-range">
> +		<entry
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE</constant
> >&nbsp;</entry>

V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE seems better.

> +		<entry>integer</entry>
> +	      </row><row><entry spanname="descr">Sets the Vertical search
> range for Video Macro blocks.</entry>
> +	      </row>
> +

This description is too vague as well.

>  	      <row><entry></entry></row>
>  	      <row>
>  		<entry
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&nb
> sp;</entry>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> index 6920b54..f2c13c3 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> @@ -430,6 +430,8 @@ struct s5p_mfc_vp8_enc_params {
>  struct s5p_mfc_enc_params {
>  	u16 width;
>  	u16 height;
> +	u32 horz_range;
> +	u32 vert_range;

mv_h_range ?
mv_v_range ?

> 
>  	u16 gop_size;
>  	enum v4l2_mpeg_video_multi_slice_mode slice_mode;
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index 4ff3b6c..a02e7b8 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
>  		.default_value = 0,
>  	},
>  	{
> +		.id = V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE,
> +		.type = V4L2_CTRL_TYPE_INTEGER,
> +		.name = "horizontal search range of video macro block",

This too should be property capitalised. Please mention the motion vectors
too.

> +		.minimum = 16,
> +		.maximum = 128,
> +		.step = 16,
> +		.default_value = 32,
> +	},
> +	{
> +		.id = V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE,
> +		.type = V4L2_CTRL_TYPE_INTEGER,
> +		.name = "vertical search range of video macro block",

This too should be property capitalised. Please mention the motion vectors
too.

> +		.minimum = 16,
> +		.maximum = 128,
> +		.step = 16,
> +		.default_value = 32,
> +	},
> +	{
>  		.id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
>  		.type = V4L2_CTRL_TYPE_INTEGER,
>  		.minimum = 0,
> @@ -1377,6 +1395,12 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl
> *ctrl)
>  	case V4L2_CID_MPEG_VIDEO_VBV_SIZE:
>  		p->vbv_size = ctrl->val;
>  		break;
> +	case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:
> +		p->horz_range = ctrl->val;
> +		break;
> +	case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:
> +		p->vert_range = ctrl->val;
> +		break;
>  	case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
>  		p->codec.h264.cpb_size = ctrl->val;
>  		break;
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> index 461358c..47e1807 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> @@ -727,14 +727,10 @@ static int s5p_mfc_set_enc_params(struct
> s5p_mfc_ctx *ctx)
>  	WRITEL(reg, S5P_FIMV_E_RC_CONFIG_V6);
> 
>  	/* setting for MV range [16, 256] */
> -	reg = 0;
> -	reg &= ~(0x3FFF);
> -	reg = 256;
> +	reg = (p->horz_range & 0x3fff);	/* conditional check in app */
>  	WRITEL(reg, S5P_FIMV_E_MV_HOR_RANGE_V6);

Please add a S5P_FIMV_E_MV_HOR_RANGE_V6_MASK or something instead of this
magic number.
> 
> -	reg = 0;
> -	reg &= ~(0x3FFF);
> -	reg = 256;
> +	reg = (p->vert_range & 0x3fff);	/* conditional check in app */

Please add a S5P_FIMV_E_MV_VER_RANGE_V6_MASK or something instead of this
magic number.

>  	WRITEL(reg, S5P_FIMV_E_MV_VER_RANGE_V6);
> 
>  	WRITEL(0x0, S5P_FIMV_E_FRAME_INSERTION_V6);
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-
> core/v4l2-ctrls.c
> index fb46790..7cf23d5 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return
"Video
> Decoder PTS";
>  	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return
"Video
> Decoder Frame Count";
>  	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:			return
"Initial
> Delay for VBV Control";
> +	case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:		return "hor
> search range of video MB";

This should be property capitalised. Please mention the motion vectors too.

> +	case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:		return "vert
> search range of video MB";

This too should be property capitalised. Please mention the motion vectors
too.

>  	case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:		return
> "Repeat Sequence Header";
> 
>  	/* VPX controls */
> @@ -905,6 +907,18 @@ void v4l2_ctrl_fill(u32 id, const char **name,
> enum v4l2_ctrl_type *type,
>  		*min = 0;
>  		*max = *step = 1;
>  		break;
> +	case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:
> +		*type = V4L2_CTRL_TYPE_INTEGER;
> +		*min = 16;
> +		*max = 128;
> +		*step = 16;
> +		break;
> +	case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:
> +		*type = V4L2_CTRL_TYPE_INTEGER;
> +		*min = 16;
> +		*max = 128;
> +		*step = 16;
> +		break;
>  	case V4L2_CID_PAN_RESET:
>  	case V4L2_CID_TILT_RESET:
>  	case V4L2_CID_FLASH_STROBE:
> diff --git a/include/uapi/linux/v4l2-controls.h
> b/include/uapi/linux/v4l2-controls.h
> index 1666aab..bcce536 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -372,6 +372,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
>  #define V4L2_CID_MPEG_VIDEO_DEC_FRAME
> 	(V4L2_CID_MPEG_BASE+224)
>  #define V4L2_CID_MPEG_VIDEO_VBV_DELAY
> 	(V4L2_CID_MPEG_BASE+225)
>  #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER
> 	(V4L2_CID_MPEG_BASE+226)
> +#define V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE
> 	(V4L2_CID_MPEG_BASE+227)
> +#define V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE
> 	(V4L2_CID_MPEG_BASE+228)
> 
>  #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP
> 	(V4L2_CID_MPEG_BASE+300)
>  #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP
> 	(V4L2_CID_MPEG_BASE+301)
> --
> 1.7.9.5

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland



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

* Re: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks
  2014-01-23 10:11 ` Kamil Debski
@ 2014-01-23 10:21   ` Sylwester Nawrocki
  2014-01-30  5:42     ` [PATCH v2 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range Amit Grover
  2014-02-04  9:59     ` [PATCH v3 " Amit Grover
  0 siblings, 2 replies; 17+ messages in thread
From: Sylwester Nawrocki @ 2014-01-23 10:21 UTC (permalink / raw)
  To: 'Amit Grover',
	m.chehab, linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, rob, kyungmin.park, jtp.park
  Cc: Kamil Debski, hans.verkuil, andrew.smirnov, arun.kk,
	anatol.pomozov, jmccrohan, austin.lobo, 'Swami Nathan'

Hi,

On 23/01/14 11:11, Kamil Debski wrote:
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
>> > b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
>> > index 4ff3b6c..a02e7b8 100644
>> > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
>> > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
>> > @@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
>> >  		.default_value = 0,
>> >  	},
>> >  	{
>> > +		.id = V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE,
>> > +		.type = V4L2_CTRL_TYPE_INTEGER,
>> > +		.name = "horizontal search range of video macro block",
>
> This too should be property capitalised. Please mention the motion vectors
> too. 

And additionally length of the name string should not exceed 31 characters.

--
Thanks,
Sylwester

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

* [PATCH v2 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range
  2014-01-23 10:21   ` Sylwester Nawrocki
@ 2014-01-30  5:42     ` Amit Grover
  2014-01-30  5:42       ` [PATCH v2 1/2] drivers/media: v4l2: Add settings " Amit Grover
                         ` (2 more replies)
  2014-02-04  9:59     ` [PATCH v3 " Amit Grover
  1 sibling, 3 replies; 17+ messages in thread
From: Amit Grover @ 2014-01-30  5:42 UTC (permalink / raw)
  To: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, hverkuil, swaminath.p
  Cc: jtp.park, Rrob, andrew.smirnov, anatol.pomozov, jmccrohan, joe,
	awalls, arun.kk, amit.grover, austin.lobo

Based on 'master' branch of Linux-next.
This is v2 version for the patch:
s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks
(https://lkml.org/lkml/2013/12/30/83)

Changes from v1:
1) Splitted the patch into v4l2 and mfc driver patches.
2) Incorporated review comments of v1

Amit Grover (2):
  drivers/media: v4l2: Add settings for Horizontal and Vertical MV
    Search Range
  drivers/media: s5p-mfc: Add Horizontal and Vertical MV Search Range

 Documentation/DocBook/media/v4l/controls.xml    |   20 +++++++++++++++++++
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h    |    1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24 +++++++++++++++++++++++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
 drivers/media/v4l2-core/v4l2-ctrls.c            |   14 +++++++++++++
 include/uapi/linux/v4l2-controls.h              |    2 ++
 7 files changed, 65 insertions(+), 6 deletions(-)

-- 
1.7.9.5


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

* [PATCH v2 1/2] drivers/media: v4l2: Add settings for Horizontal and Vertical MV Search Range
  2014-01-30  5:42     ` [PATCH v2 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range Amit Grover
@ 2014-01-30  5:42       ` Amit Grover
  2014-01-30  7:36         ` Hans Verkuil
  2014-01-30  5:42       ` [PATCH v2 2/2] drivers/media: s5p-mfc: Add " Amit Grover
  2014-01-30  6:02       ` [PATCH v2 0/2] drivers/media: Add controls for " Sachin Kamat
  2 siblings, 1 reply; 17+ messages in thread
From: Amit Grover @ 2014-01-30  5:42 UTC (permalink / raw)
  To: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, hverkuil, swaminath.p
  Cc: jtp.park, Rrob, andrew.smirnov, anatol.pomozov, jmccrohan, joe,
	awalls, arun.kk, amit.grover, austin.lobo

Adding V4L2 controls for horizontal and vertical search range in pixels
for motion estimation module in video encoder.

Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
Signed-off-by: Amit Grover <amit.grover@samsung.com>
---
 Documentation/DocBook/media/v4l/controls.xml |   20 ++++++++++++++++++++
 drivers/media/v4l2-core/v4l2-ctrls.c         |   14 ++++++++++++++
 include/uapi/linux/v4l2-controls.h           |    2 ++
 3 files changed, 36 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
index 7a3b49b..be04d18 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2258,6 +2258,26 @@ Applicable to the MPEG1, MPEG2, MPEG4 encoders.</entry>
 VBV buffer control.</entry>
 	      </row>
 
+		  <row><entry></entry></row>
+	      <row id=""v4l2-mpeg-video-hor-search-range">
+		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE</constant>&nbsp;</entry>
+		<entry>integer</entry>
+	      </row>
+		<row><entry spanname="descr">Horizontal search range defines maximum horizontal search area in pixels
+to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
+horizontal search range for motion estimation module in video encoder.</entry>
+	      </row>
+
+		 <row><entry></entry></row>
+	      <row id="v4l2-mpeg-video-vert-search-range">
+		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE</constant>&nbsp;</entry>
+		<entry>integer</entry>
+	      </row>
+		<row><entry spanname="descr">Vertical search range defines maximum vertical search area in pixels
+to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
+vertical search range for motion estimation module in video encoder.</entry>
+	      </row>
+
 	      <row><entry></entry></row>
 	      <row>
 		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&nbsp;</entry>
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index fb46790..e775388 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return "Video Decoder PTS";
 	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return "Video Decoder Frame Count";
 	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:			return "Initial Delay for VBV Control";
+	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:		return "Horizontal MV Search Range";
+	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:		return "Vertical MV Search Range";
 	case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:		return "Repeat Sequence Header";
 
 	/* VPX controls */
@@ -905,6 +907,18 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 		*min = 0;
 		*max = *step = 1;
 		break;
+	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
+		*type = V4L2_CTRL_TYPE_INTEGER;
+		*min = 16;
+		*max = 128;
+		*step = 16;
+		break;
+	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
+		*type = V4L2_CTRL_TYPE_INTEGER;
+		*min = 16;
+		*max = 128;
+		*step = 16;
+		break;
 	case V4L2_CID_PAN_RESET:
 	case V4L2_CID_TILT_RESET:
 	case V4L2_CID_FLASH_STROBE:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 1666aab..80e1def 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -372,6 +372,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_DEC_FRAME			(V4L2_CID_MPEG_BASE+224)
 #define V4L2_CID_MPEG_VIDEO_VBV_DELAY			(V4L2_CID_MPEG_BASE+225)
 #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER		(V4L2_CID_MPEG_BASE+226)
+#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+227)
+#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+228)
 
 #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP		(V4L2_CID_MPEG_BASE+300)
 #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP		(V4L2_CID_MPEG_BASE+301)
-- 
1.7.9.5


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

* [PATCH v2 2/2] drivers/media: s5p-mfc: Add Horizontal and Vertical MV Search Range
  2014-01-30  5:42     ` [PATCH v2 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range Amit Grover
  2014-01-30  5:42       ` [PATCH v2 1/2] drivers/media: v4l2: Add settings " Amit Grover
@ 2014-01-30  5:42       ` Amit Grover
  2014-01-30  7:39         ` Hans Verkuil
  2014-01-30  6:02       ` [PATCH v2 0/2] drivers/media: Add controls for " Sachin Kamat
  2 siblings, 1 reply; 17+ messages in thread
From: Amit Grover @ 2014-01-30  5:42 UTC (permalink / raw)
  To: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, hverkuil, swaminath.p
  Cc: jtp.park, Rrob, andrew.smirnov, anatol.pomozov, jmccrohan, joe,
	awalls, arun.kk, amit.grover, austin.lobo

This patch adds Controls to set Horizontal and Vertical search range
for Motion Estimation block for Samsung MFC video Encoders.

Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
Signed-off-by: Amit Grover <amit.grover@samsung.com>
---
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h    |    1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24 +++++++++++++++++++++++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
index 2398cdf..8d0b686 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
@@ -229,6 +229,7 @@
 #define S5P_FIMV_E_PADDING_CTRL_V6		0xf7a4
 #define S5P_FIMV_E_MV_HOR_RANGE_V6		0xf7ac
 #define S5P_FIMV_E_MV_VER_RANGE_V6		0xf7b0
+#define S5P_FIMV_E_MV_RANGE_V6_MASK		0x3fff
 
 #define S5P_FIMV_E_VBV_BUFFER_SIZE_V6		0xf84c
 #define S5P_FIMV_E_VBV_INIT_DELAY_V6		0xf850
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 6920b54..b90ee34 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -430,6 +430,8 @@ struct s5p_mfc_vp8_enc_params {
 struct s5p_mfc_enc_params {
 	u16 width;
 	u16 height;
+	u32 mv_h_range;
+	u32 mv_v_range;
 
 	u16 gop_size;
 	enum v4l2_mpeg_video_multi_slice_mode slice_mode;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 4ff3b6c..704f30c1 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
 		.default_value = 0,
 	},
 	{
+		.id = V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE,
+		.type = V4L2_CTRL_TYPE_INTEGER,
+		.name = "Horizontal MV Search Range",
+		.minimum = 16,
+		.maximum = 128,
+		.step = 16,
+		.default_value = 32,
+	},
+	{
+		.id = V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE,
+		.type = V4L2_CTRL_TYPE_INTEGER,
+		.name = "Vertical MV Search Range",
+		.minimum = 16,
+		.maximum = 128,
+		.step = 16,
+		.default_value = 32,
+	},
+	{
 		.id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
 		.type = V4L2_CTRL_TYPE_INTEGER,
 		.minimum = 0,
@@ -1377,6 +1395,12 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_MPEG_VIDEO_VBV_SIZE:
 		p->vbv_size = ctrl->val;
 		break;
+	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
+		p->mv_h_range = ctrl->val;
+		break;
+	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
+		p->mv_v_range = ctrl->val;
+		break;
 	case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
 		p->codec.h264.cpb_size = ctrl->val;
 		break;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 461358c..3c10188 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -727,14 +727,10 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)
 	WRITEL(reg, S5P_FIMV_E_RC_CONFIG_V6);
 
 	/* setting for MV range [16, 256] */
-	reg = 0;
-	reg &= ~(0x3FFF);
-	reg = 256;
+	reg = (p->mv_h_range & S5P_FIMV_E_MV_RANGE_V6_MASK);
 	WRITEL(reg, S5P_FIMV_E_MV_HOR_RANGE_V6);
 
-	reg = 0;
-	reg &= ~(0x3FFF);
-	reg = 256;
+	reg = (p->mv_v_range & S5P_FIMV_E_MV_RANGE_V6_MASK);
 	WRITEL(reg, S5P_FIMV_E_MV_VER_RANGE_V6);
 
 	WRITEL(0x0, S5P_FIMV_E_FRAME_INSERTION_V6);
-- 
1.7.9.5


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

* Re: [PATCH v2 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range
  2014-01-30  5:42     ` [PATCH v2 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range Amit Grover
  2014-01-30  5:42       ` [PATCH v2 1/2] drivers/media: v4l2: Add settings " Amit Grover
  2014-01-30  5:42       ` [PATCH v2 2/2] drivers/media: s5p-mfc: Add " Amit Grover
@ 2014-01-30  6:02       ` Sachin Kamat
  2 siblings, 0 replies; 17+ messages in thread
From: Sachin Kamat @ 2014-01-30  6:02 UTC (permalink / raw)
  To: Amit Grover
  Cc: linux-media, linux-doc, LKML, linux-arm-kernel, Kyungmin Park,
	Kamil Debski, Prabhakar Lad, Sylwester Nawrocki, hans.verkuil,
	Hans Verkuil, swaminath.p, jtp.park, Rrob, andrew.smirnov,
	anatol.pomozov, jmccrohan, Joe Perches, awalls, Arun Kumar,
	austin.lobo

Hi Amit,

On 30 January 2014 11:12, Amit Grover <amit.grover@samsung.com> wrote:
> Based on 'master' branch of Linux-next.

Kamil's tree [1] would be more current most of the times for this driver.

[1] git://linuxtv.org/kdebski/media.git


> This is v2 version for the patch:
> s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks
> (https://lkml.org/lkml/2013/12/30/83)
>
> Changes from v1:
> 1) Splitted the patch into v4l2 and mfc driver patches.
> 2) Incorporated review comments of v1
>
> Amit Grover (2):
>   drivers/media: v4l2: Add settings for Horizontal and Vertical MV
>     Search Range
>   drivers/media: s5p-mfc: Add Horizontal and Vertical MV Search Range

nit: media changes use the following title format:
[media] v4l2: Add settings for Horizontal and Vertical MV Search Range
[media] s5p-mfc: Add Horizontal and Vertical MV Search Range



-- 
With warm regards,
Sachin

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

* Re: [PATCH v2 1/2] drivers/media: v4l2: Add settings for Horizontal and Vertical MV Search Range
  2014-01-30  5:42       ` [PATCH v2 1/2] drivers/media: v4l2: Add settings " Amit Grover
@ 2014-01-30  7:36         ` Hans Verkuil
  2014-01-30 15:22           ` Kamil Debski
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Verkuil @ 2014-01-30  7:36 UTC (permalink / raw)
  To: Amit Grover
  Cc: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, swaminath.p, jtp.park, Rrob, andrew.smirnov,
	anatol.pomozov, jmccrohan, joe, awalls, arun.kk, austin.lobo

On 01/30/2014 06:42 AM, Amit Grover wrote:
> Adding V4L2 controls for horizontal and vertical search range in pixels
> for motion estimation module in video encoder.
> 
> Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
> Signed-off-by: Amit Grover <amit.grover@samsung.com>
> ---
>  Documentation/DocBook/media/v4l/controls.xml |   20 ++++++++++++++++++++
>  drivers/media/v4l2-core/v4l2-ctrls.c         |   14 ++++++++++++++
>  include/uapi/linux/v4l2-controls.h           |    2 ++
>  3 files changed, 36 insertions(+)
> 
> diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
> index 7a3b49b..be04d18 100644
> --- a/Documentation/DocBook/media/v4l/controls.xml
> +++ b/Documentation/DocBook/media/v4l/controls.xml
> @@ -2258,6 +2258,26 @@ Applicable to the MPEG1, MPEG2, MPEG4 encoders.</entry>
>  VBV buffer control.</entry>
>  	      </row>
>  
> +		  <row><entry></entry></row>
> +	      <row id=""v4l2-mpeg-video-hor-search-range">
> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE</constant>&nbsp;</entry>
> +		<entry>integer</entry>
> +	      </row>
> +		<row><entry spanname="descr">Horizontal search range defines maximum horizontal search area in pixels
> +to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
> +horizontal search range for motion estimation module in video encoder.</entry>
> +	      </row>
> +
> +		 <row><entry></entry></row>
> +	      <row id="v4l2-mpeg-video-vert-search-range">
> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE</constant>&nbsp;</entry>
> +		<entry>integer</entry>

These two controls sound very mfc specific as opposed to being part of the standard.
If so, then they should be named V4L2_CID_MPEG_MFC51_*. Also, for which codecs are
these controls applicable?

> +	      </row>
> +		<row><entry spanname="descr">Vertical search range defines maximum vertical search area in pixels
> +to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
> +vertical search range for motion estimation module in video encoder.</entry>
> +	      </row>
> +
>  	      <row><entry></entry></row>
>  	      <row>
>  		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&nbsp;</entry>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index fb46790..e775388 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return "Video Decoder PTS";
>  	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return "Video Decoder Frame Count";
>  	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:			return "Initial Delay for VBV Control";
> +	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:		return "Horizontal MV Search Range";
> +	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:		return "Vertical MV Search Range";
>  	case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:		return "Repeat Sequence Header";
>  
>  	/* VPX controls */
> @@ -905,6 +907,18 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>  		*min = 0;
>  		*max = *step = 1;
>  		break;
> +	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
> +		*type = V4L2_CTRL_TYPE_INTEGER;
> +		*min = 16;
> +		*max = 128;
> +		*step = 16;

Weird range, why not use range 1-8?

> +		break;
> +	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
> +		*type = V4L2_CTRL_TYPE_INTEGER;
> +		*min = 16;
> +		*max = 128;
> +		*step = 16;
> +		break;
>  	case V4L2_CID_PAN_RESET:
>  	case V4L2_CID_TILT_RESET:
>  	case V4L2_CID_FLASH_STROBE:
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index 1666aab..80e1def 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -372,6 +372,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
>  #define V4L2_CID_MPEG_VIDEO_DEC_FRAME			(V4L2_CID_MPEG_BASE+224)
>  #define V4L2_CID_MPEG_VIDEO_VBV_DELAY			(V4L2_CID_MPEG_BASE+225)
>  #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER		(V4L2_CID_MPEG_BASE+226)
> +#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+227)
> +#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+228)
>  
>  #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP		(V4L2_CID_MPEG_BASE+300)
>  #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP		(V4L2_CID_MPEG_BASE+301)
> 

Regards,

	Hans

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

* Re: [PATCH v2 2/2] drivers/media: s5p-mfc: Add Horizontal and Vertical MV Search Range
  2014-01-30  5:42       ` [PATCH v2 2/2] drivers/media: s5p-mfc: Add " Amit Grover
@ 2014-01-30  7:39         ` Hans Verkuil
  0 siblings, 0 replies; 17+ messages in thread
From: Hans Verkuil @ 2014-01-30  7:39 UTC (permalink / raw)
  To: Amit Grover
  Cc: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, swaminath.p, jtp.park, Rrob, andrew.smirnov,
	anatol.pomozov, jmccrohan, joe, awalls, arun.kk, austin.lobo

On 01/30/2014 06:42 AM, Amit Grover wrote:
> This patch adds Controls to set Horizontal and Vertical search range
> for Motion Estimation block for Samsung MFC video Encoders.
> 
> Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
> Signed-off-by: Amit Grover <amit.grover@samsung.com>
> ---
>  drivers/media/platform/s5p-mfc/regs-mfc-v6.h    |    1 +
>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
>  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24 +++++++++++++++++++++++
>  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
>  4 files changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
> index 2398cdf..8d0b686 100644
> --- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
> +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
> @@ -229,6 +229,7 @@
>  #define S5P_FIMV_E_PADDING_CTRL_V6		0xf7a4
>  #define S5P_FIMV_E_MV_HOR_RANGE_V6		0xf7ac
>  #define S5P_FIMV_E_MV_VER_RANGE_V6		0xf7b0
> +#define S5P_FIMV_E_MV_RANGE_V6_MASK		0x3fff
>  
>  #define S5P_FIMV_E_VBV_BUFFER_SIZE_V6		0xf84c
>  #define S5P_FIMV_E_VBV_INIT_DELAY_V6		0xf850
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> index 6920b54..b90ee34 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> @@ -430,6 +430,8 @@ struct s5p_mfc_vp8_enc_params {
>  struct s5p_mfc_enc_params {
>  	u16 width;
>  	u16 height;
> +	u32 mv_h_range;
> +	u32 mv_v_range;
>  
>  	u16 gop_size;
>  	enum v4l2_mpeg_video_multi_slice_mode slice_mode;
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index 4ff3b6c..704f30c1 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
>  		.default_value = 0,
>  	},
>  	{
> +		.id = V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE,
> +		.type = V4L2_CTRL_TYPE_INTEGER,
> +		.name = "Horizontal MV Search Range",

Don't set the name here if the control is also defined in v4l2-ctrls.
That way the string from v4l2-ctrls is the leading definition.

Regards,

	Hans

> +		.minimum = 16,
> +		.maximum = 128,
> +		.step = 16,
> +		.default_value = 32,
> +	},
> +	{
> +		.id = V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE,
> +		.type = V4L2_CTRL_TYPE_INTEGER,
> +		.name = "Vertical MV Search Range",
> +		.minimum = 16,
> +		.maximum = 128,
> +		.step = 16,
> +		.default_value = 32,
> +	},
> +	{
>  		.id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
>  		.type = V4L2_CTRL_TYPE_INTEGER,
>  		.minimum = 0,
> @@ -1377,6 +1395,12 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
>  	case V4L2_CID_MPEG_VIDEO_VBV_SIZE:
>  		p->vbv_size = ctrl->val;
>  		break;
> +	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
> +		p->mv_h_range = ctrl->val;
> +		break;
> +	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
> +		p->mv_v_range = ctrl->val;
> +		break;
>  	case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
>  		p->codec.h264.cpb_size = ctrl->val;
>  		break;
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> index 461358c..3c10188 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> @@ -727,14 +727,10 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)
>  	WRITEL(reg, S5P_FIMV_E_RC_CONFIG_V6);
>  
>  	/* setting for MV range [16, 256] */
> -	reg = 0;
> -	reg &= ~(0x3FFF);
> -	reg = 256;
> +	reg = (p->mv_h_range & S5P_FIMV_E_MV_RANGE_V6_MASK);
>  	WRITEL(reg, S5P_FIMV_E_MV_HOR_RANGE_V6);
>  
> -	reg = 0;
> -	reg &= ~(0x3FFF);
> -	reg = 256;
> +	reg = (p->mv_v_range & S5P_FIMV_E_MV_RANGE_V6_MASK);
>  	WRITEL(reg, S5P_FIMV_E_MV_VER_RANGE_V6);
>  
>  	WRITEL(0x0, S5P_FIMV_E_FRAME_INSERTION_V6);
> 


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

* RE: [PATCH v2 1/2] drivers/media: v4l2: Add settings for Horizontal and Vertical MV Search Range
  2014-01-30  7:36         ` Hans Verkuil
@ 2014-01-30 15:22           ` Kamil Debski
  0 siblings, 0 replies; 17+ messages in thread
From: Kamil Debski @ 2014-01-30 15:22 UTC (permalink / raw)
  To: 'Hans Verkuil', 'Amit Grover'
  Cc: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, prabhakar.csengg, Sylwester Nawrocki,
	hans.verkuil, swaminath.p, jtp.park, Rrob, andrew.smirnov,
	anatol.pomozov, jmccrohan, joe, awalls, arun.kk, austin.lobo

Hi Hans, Amit,

> From: Hans Verkuil [mailto:hverkuil@xs4all.nl]
> Sent: Thursday, January 30, 2014 8:36 AM
> 
> On 01/30/2014 06:42 AM, Amit Grover wrote:
> > Adding V4L2 controls for horizontal and vertical search range in
> > pixels for motion estimation module in video encoder.
> >
> > Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
> > Signed-off-by: Amit Grover <amit.grover@samsung.com>
> > ---
> >  Documentation/DocBook/media/v4l/controls.xml |   20
> ++++++++++++++++++++
> >  drivers/media/v4l2-core/v4l2-ctrls.c         |   14 ++++++++++++++
> >  include/uapi/linux/v4l2-controls.h           |    2 ++
> >  3 files changed, 36 insertions(+)
> >
> > diff --git a/Documentation/DocBook/media/v4l/controls.xml
> > b/Documentation/DocBook/media/v4l/controls.xml
> > index 7a3b49b..be04d18 100644
> > --- a/Documentation/DocBook/media/v4l/controls.xml
> > +++ b/Documentation/DocBook/media/v4l/controls.xml
> > @@ -2258,6 +2258,26 @@ Applicable to the MPEG1, MPEG2, MPEG4
> > encoders.</entry>  VBV buffer control.</entry>
> >  	      </row>
> >
> > +		  <row><entry></entry></row>
> > +	      <row id=""v4l2-mpeg-video-hor-search-range">
> > +		<entry
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE</constant
> >&nbsp;</entry>
> > +		<entry>integer</entry>
> > +	      </row>
> > +		<row><entry spanname="descr">Horizontal search range
> defines
> > +maximum horizontal search area in pixels to search and match for the
> > +present Macroblock (MB) in the reference picture. This V4L2 control
> macro is used to set horizontal search range for motion estimation
> module in video encoder.</entry>
> > +	      </row>
> > +
> > +		 <row><entry></entry></row>
> > +	      <row id="v4l2-mpeg-video-vert-search-range">
> > +		<entry
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE</constant
> >&nbsp;</entry>
> > +		<entry>integer</entry>
> 
> These two controls sound very mfc specific as opposed to being part of
> the standard.
> If so, then they should be named V4L2_CID_MPEG_MFC51_*. 

mencoder has an option to set motion vector search radius.

>From man mencoder:
       me_range=<4-64>
              radius  of  exhaustive  or multi-hexagon motion search
(default:
              16)

So I think it could be applicable to other hardware codecs as well.

> Also, for which codecs are these controls applicable?

Isn't the choice of motion estimation algorithm (and its parameters)
codec agnostic, as long as the restrictions of the standard are honoured?

> 
> > +	      </row>
> > +		<row><entry spanname="descr">Vertical search range defines
> maximum
> > +vertical search area in pixels to search and match for the present
> > +Macroblock (MB) in the reference picture. This V4L2 control macro is
> used to set vertical search range for motion estimation module in video
> encoder.</entry>
> > +	      </row>
> > +
> >  	      <row><entry></entry></row>
> >  	      <row>
> >  		<entry
> >
> spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&n
> > bsp;</entry> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c
> > b/drivers/media/v4l2-core/v4l2-ctrls.c
> > index fb46790..e775388 100644
> > --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> > +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> > @@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
> >  	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return
"Video
> Decoder PTS";
> >  	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return
"Video
> Decoder Frame Count";
> >  	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:			return
"Initial
> Delay for VBV Control";
> > +	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:		return
> "Horizontal MV Search Range";
> > +	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:		return
> "Vertical MV Search Range";
> >  	case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:		return
> "Repeat Sequence Header";
> >
> >  	/* VPX controls */
> > @@ -905,6 +907,18 @@ void v4l2_ctrl_fill(u32 id, const char **name,
> enum v4l2_ctrl_type *type,
> >  		*min = 0;
> >  		*max = *step = 1;
> >  		break;
> > +	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
> > +		*type = V4L2_CTRL_TYPE_INTEGER;
> > +		*min = 16;
> > +		*max = 128;
> > +		*step = 16;
> 
> Weird range, why not use range 1-8?

If the search range is represented in pixels, then pixels should be used.
It the control is also used in other hardware, then I think it the values
should not be limited in this way here. For example mencoder accepts the
value between 4 and 64. The range and step could be limited in the
s5p_mfc_enc.c.

> 
> > +		break;
> > +	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
> > +		*type = V4L2_CTRL_TYPE_INTEGER;
> > +		*min = 16;
> > +		*max = 128;
> > +		*step = 16;
> > +		break;
> >  	case V4L2_CID_PAN_RESET:
> >  	case V4L2_CID_TILT_RESET:
> >  	case V4L2_CID_FLASH_STROBE:
> > diff --git a/include/uapi/linux/v4l2-controls.h
> > b/include/uapi/linux/v4l2-controls.h
> > index 1666aab..80e1def 100644
> > --- a/include/uapi/linux/v4l2-controls.h
> > +++ b/include/uapi/linux/v4l2-controls.h
> > @@ -372,6 +372,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
> >  #define V4L2_CID_MPEG_VIDEO_DEC_FRAME
> 	(V4L2_CID_MPEG_BASE+224)
> >  #define V4L2_CID_MPEG_VIDEO_VBV_DELAY
> 	(V4L2_CID_MPEG_BASE+225)
> >  #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER
> 	(V4L2_CID_MPEG_BASE+226)
> > +#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE
> 	(V4L2_CID_MPEG_BASE+227)
> > +#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE
> 	(V4L2_CID_MPEG_BASE+228)
> >
> >  #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP
> 	(V4L2_CID_MPEG_BASE+300)
> >  #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP
> 	(V4L2_CID_MPEG_BASE+301)
> >
> 
> Regards,
> 
> 	Hans

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland


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

* [PATCH v3 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range
  2014-01-23 10:21   ` Sylwester Nawrocki
  2014-01-30  5:42     ` [PATCH v2 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range Amit Grover
@ 2014-02-04  9:59     ` Amit Grover
  2014-02-04  9:59       ` [PATCH 1/2] [media] v4l2: Add settings " Amit Grover
  2014-02-04  9:59       ` [PATCH 2/2] [media] s5p-mfc: Add " Amit Grover
  1 sibling, 2 replies; 17+ messages in thread
From: Amit Grover @ 2014-02-04  9:59 UTC (permalink / raw)
  To: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, hverkuil, swaminath.p
  Cc: jtp.park, Rrob, andrew.smirnov, anatol.pomozov, jmccrohan, joe,
	awalls, arun.kk, amit.grover, austin.lobo

This is v3 version for the patch:
s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks
(https://lkml.org/lkml/2013/12/30/83)

Changes from v1:
1) Splitted the patch into V4L2 and MFC driver patches.
2) Incorporated review comments on v1.

Changes from v2:
1) Removed the range restrictions from drivers/media/v4l2-core/v4l2-ctrls.c.
2) Rebased the patch to git://linuxtv.org/mchehab/media-next.git.
3) Added [media] tag in title.

Amit Grover (2):
  [media] v4l2: Add settings for Horizontal and Vertical MV Search
    Range
  [media] s5p-mfc: Add Horizontal and Vertical MV Search Range

 Documentation/DocBook/media/v4l/controls.xml    |   20 +++++++++++++++++++
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h    |    1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24 +++++++++++++++++++++++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
 drivers/media/v4l2-core/v4l2-ctrls.c            |    6 ++++++
 include/uapi/linux/v4l2-controls.h              |    2 ++
 7 files changed, 57 insertions(+), 6 deletions(-)

-- 
1.7.9.5


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

* [PATCH 1/2] [media] v4l2: Add settings for Horizontal and Vertical MV Search Range
  2014-02-04  9:59     ` [PATCH v3 " Amit Grover
@ 2014-02-04  9:59       ` Amit Grover
  2014-02-04 10:13         ` Hans Verkuil
  2014-02-06  8:13         ` Prabhakar Lad
  2014-02-04  9:59       ` [PATCH 2/2] [media] s5p-mfc: Add " Amit Grover
  1 sibling, 2 replies; 17+ messages in thread
From: Amit Grover @ 2014-02-04  9:59 UTC (permalink / raw)
  To: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, hverkuil, swaminath.p
  Cc: jtp.park, Rrob, andrew.smirnov, anatol.pomozov, jmccrohan, joe,
	awalls, arun.kk, amit.grover, austin.lobo

Adding V4L2 controls for horizontal and vertical search range in pixels
for motion estimation module in video encoder.

Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
Signed-off-by: Amit Grover <amit.grover@samsung.com>
---
 Documentation/DocBook/media/v4l/controls.xml |   20 ++++++++++++++++++++
 drivers/media/v4l2-core/v4l2-ctrls.c         |    6 ++++++
 include/uapi/linux/v4l2-controls.h           |    2 ++
 3 files changed, 28 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
index a5a3188..0e1770c 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2258,6 +2258,26 @@ Applicable to the MPEG1, MPEG2, MPEG4 encoders.</entry>
 VBV buffer control.</entry>
 	      </row>
 
+		  <row><entry></entry></row>
+	      <row id=""v4l2-mpeg-video-hor-search-range">
+		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE</constant>&nbsp;</entry>
+		<entry>integer</entry>
+	      </row>
+		<row><entry spanname="descr">Horizontal search range defines maximum horizontal search area in pixels
+to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
+horizontal search range for motion estimation module in video encoder.</entry>
+	      </row>
+
+		 <row><entry></entry></row>
+	      <row id="v4l2-mpeg-video-vert-search-range">
+		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE</constant>&nbsp;</entry>
+		<entry>integer</entry>
+	      </row>
+		<row><entry spanname="descr">Vertical search range defines maximum vertical search area in pixels
+to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
+vertical search range for motion estimation module in video encoder.</entry>
+	      </row>
+
 	      <row><entry></entry></row>
 	      <row>
 		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&nbsp;</entry>
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 6ff002b..e9e12c4 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return "Video Decoder PTS";
 	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return "Video Decoder Frame Count";
 	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:			return "Initial Delay for VBV Control";
+	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:		return "Horizontal MV Search Range";
+	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:		return "Vertical MV Search Range";
 	case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:		return "Repeat Sequence Header";
 
 	/* VPX controls */
@@ -910,6 +912,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 		*min = 0;
 		*max = *step = 1;
 		break;
+	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
+	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
+		*type = V4L2_CTRL_TYPE_INTEGER;
+		break;
 	case V4L2_CID_PAN_RESET:
 	case V4L2_CID_TILT_RESET:
 	case V4L2_CID_FLASH_STROBE:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 2cbe605..cda6fa0 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -376,6 +376,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_DEC_FRAME			(V4L2_CID_MPEG_BASE+224)
 #define V4L2_CID_MPEG_VIDEO_VBV_DELAY			(V4L2_CID_MPEG_BASE+225)
 #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER		(V4L2_CID_MPEG_BASE+226)
+#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+227)
+#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+228)
 
 #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP		(V4L2_CID_MPEG_BASE+300)
 #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP		(V4L2_CID_MPEG_BASE+301)
-- 
1.7.9.5


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

* [PATCH 2/2] [media] s5p-mfc: Add Horizontal and Vertical MV Search Range
  2014-02-04  9:59     ` [PATCH v3 " Amit Grover
  2014-02-04  9:59       ` [PATCH 1/2] [media] v4l2: Add settings " Amit Grover
@ 2014-02-04  9:59       ` Amit Grover
  1 sibling, 0 replies; 17+ messages in thread
From: Amit Grover @ 2014-02-04  9:59 UTC (permalink / raw)
  To: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, hverkuil, swaminath.p
  Cc: jtp.park, Rrob, andrew.smirnov, anatol.pomozov, jmccrohan, joe,
	awalls, arun.kk, amit.grover, austin.lobo

This patch adds Controls to set Horizontal and Vertical search range
for Motion Estimation block for Samsung MFC video Encoders.

Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
Signed-off-by: Amit Grover <amit.grover@samsung.com>
---
 drivers/media/platform/s5p-mfc/regs-mfc-v6.h    |    1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |    2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c    |   24 +++++++++++++++++++++++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |    8 ++------
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
index 2398cdf..8d0b686 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h
@@ -229,6 +229,7 @@
 #define S5P_FIMV_E_PADDING_CTRL_V6		0xf7a4
 #define S5P_FIMV_E_MV_HOR_RANGE_V6		0xf7ac
 #define S5P_FIMV_E_MV_VER_RANGE_V6		0xf7b0
+#define S5P_FIMV_E_MV_RANGE_V6_MASK		0x3fff
 
 #define S5P_FIMV_E_VBV_BUFFER_SIZE_V6		0xf84c
 #define S5P_FIMV_E_VBV_INIT_DELAY_V6		0xf850
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index f723f1f..5c28cc3 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -426,6 +426,8 @@ struct s5p_mfc_vp8_enc_params {
 struct s5p_mfc_enc_params {
 	u16 width;
 	u16 height;
+	u32 mv_h_range;
+	u32 mv_v_range;
 
 	u16 gop_size;
 	enum v4l2_mpeg_video_multi_slice_mode slice_mode;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 91b6e02..df83cd1 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
 		.default_value = 0,
 	},
 	{
+		.id = V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE,
+		.type = V4L2_CTRL_TYPE_INTEGER,
+		.name = "Horizontal MV Search Range",
+		.minimum = 16,
+		.maximum = 128,
+		.step = 16,
+		.default_value = 32,
+	},
+	{
+		.id = V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE,
+		.type = V4L2_CTRL_TYPE_INTEGER,
+		.name = "Vertical MV Search Range",
+		.minimum = 16,
+		.maximum = 128,
+		.step = 16,
+		.default_value = 32,
+	},
+	{
 		.id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
 		.type = V4L2_CTRL_TYPE_INTEGER,
 		.minimum = 0,
@@ -1417,6 +1435,12 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_MPEG_VIDEO_VBV_SIZE:
 		p->vbv_size = ctrl->val;
 		break;
+	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
+		p->mv_h_range = ctrl->val;
+		break;
+	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
+		p->mv_v_range = ctrl->val;
+		break;
 	case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
 		p->codec.h264.cpb_size = ctrl->val;
 		break;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index f6ff2db..f64621a 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -727,14 +727,10 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)
 	WRITEL(reg, S5P_FIMV_E_RC_CONFIG_V6);
 
 	/* setting for MV range [16, 256] */
-	reg = 0;
-	reg &= ~(0x3FFF);
-	reg = 256;
+	reg = (p->mv_h_range & S5P_FIMV_E_MV_RANGE_V6_MASK);
 	WRITEL(reg, S5P_FIMV_E_MV_HOR_RANGE_V6);
 
-	reg = 0;
-	reg &= ~(0x3FFF);
-	reg = 256;
+	reg = (p->mv_v_range & S5P_FIMV_E_MV_RANGE_V6_MASK);
 	WRITEL(reg, S5P_FIMV_E_MV_VER_RANGE_V6);
 
 	WRITEL(0x0, S5P_FIMV_E_FRAME_INSERTION_V6);
-- 
1.7.9.5


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

* Re: [PATCH 1/2] [media] v4l2: Add settings for Horizontal and Vertical MV Search Range
  2014-02-04  9:59       ` [PATCH 1/2] [media] v4l2: Add settings " Amit Grover
@ 2014-02-04 10:13         ` Hans Verkuil
  2014-02-06  8:13         ` Prabhakar Lad
  1 sibling, 0 replies; 17+ messages in thread
From: Hans Verkuil @ 2014-02-04 10:13 UTC (permalink / raw)
  To: Amit Grover
  Cc: linux-media, linux-doc, linux-kernel, linux-arm-kernel,
	kyungmin.park, k.debski, prabhakar.csengg, s.nawrocki,
	hans.verkuil, swaminath.p, jtp.park, Rrob, andrew.smirnov,
	anatol.pomozov, jmccrohan, joe, awalls, arun.kk, austin.lobo

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

On 02/04/14 10:59, Amit Grover wrote:
> Adding V4L2 controls for horizontal and vertical search range in pixels
> for motion estimation module in video encoder.
> 
> Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
> Signed-off-by: Amit Grover <amit.grover@samsung.com>
> ---
>  Documentation/DocBook/media/v4l/controls.xml |   20 ++++++++++++++++++++
>  drivers/media/v4l2-core/v4l2-ctrls.c         |    6 ++++++
>  include/uapi/linux/v4l2-controls.h           |    2 ++
>  3 files changed, 28 insertions(+)
> 
> diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
> index a5a3188..0e1770c 100644
> --- a/Documentation/DocBook/media/v4l/controls.xml
> +++ b/Documentation/DocBook/media/v4l/controls.xml
> @@ -2258,6 +2258,26 @@ Applicable to the MPEG1, MPEG2, MPEG4 encoders.</entry>
>  VBV buffer control.</entry>
>  	      </row>
>  
> +		  <row><entry></entry></row>
> +	      <row id=""v4l2-mpeg-video-hor-search-range">
> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE</constant>&nbsp;</entry>
> +		<entry>integer</entry>
> +	      </row>
> +		<row><entry spanname="descr">Horizontal search range defines maximum horizontal search area in pixels
> +to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
> +horizontal search range for motion estimation module in video encoder.</entry>
> +	      </row>
> +
> +		 <row><entry></entry></row>
> +	      <row id="v4l2-mpeg-video-vert-search-range">
> +		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE</constant>&nbsp;</entry>
> +		<entry>integer</entry>
> +	      </row>
> +		<row><entry spanname="descr">Vertical search range defines maximum vertical search area in pixels
> +to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
> +vertical search range for motion estimation module in video encoder.</entry>
> +	      </row>
> +
>  	      <row><entry></entry></row>
>  	      <row>
>  		<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&nbsp;</entry>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 6ff002b..e9e12c4 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return "Video Decoder PTS";
>  	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return "Video Decoder Frame Count";
>  	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:			return "Initial Delay for VBV Control";
> +	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:		return "Horizontal MV Search Range";
> +	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:		return "Vertical MV Search Range";
>  	case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:		return "Repeat Sequence Header";
>  
>  	/* VPX controls */
> @@ -910,6 +912,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>  		*min = 0;
>  		*max = *step = 1;
>  		break;
> +	case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
> +	case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
> +		*type = V4L2_CTRL_TYPE_INTEGER;
> +		break;
>  	case V4L2_CID_PAN_RESET:
>  	case V4L2_CID_TILT_RESET:
>  	case V4L2_CID_FLASH_STROBE:
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index 2cbe605..cda6fa0 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -376,6 +376,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
>  #define V4L2_CID_MPEG_VIDEO_DEC_FRAME			(V4L2_CID_MPEG_BASE+224)
>  #define V4L2_CID_MPEG_VIDEO_VBV_DELAY			(V4L2_CID_MPEG_BASE+225)
>  #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER		(V4L2_CID_MPEG_BASE+226)
> +#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+227)
> +#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE		(V4L2_CID_MPEG_BASE+228)
>  
>  #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP		(V4L2_CID_MPEG_BASE+300)
>  #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP		(V4L2_CID_MPEG_BASE+301)
> 


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

* Re: [PATCH 1/2] [media] v4l2: Add settings for Horizontal and Vertical MV Search Range
  2014-02-04  9:59       ` [PATCH 1/2] [media] v4l2: Add settings " Amit Grover
  2014-02-04 10:13         ` Hans Verkuil
@ 2014-02-06  8:13         ` Prabhakar Lad
  1 sibling, 0 replies; 17+ messages in thread
From: Prabhakar Lad @ 2014-02-06  8:13 UTC (permalink / raw)
  To: Amit Grover
  Cc: linux-media, LDOC, LKML, LAK, Kyungmin Park, Kamil Debski,
	Sylwester Nawrocki, Hans Verkuil, Hans Verkuil, swaminathan,
	Jeongtae Park, Rrob, Andrey Smirnov, Anatol Pomozov,
	Jonathan McCrohan, Joe Perches, Andy Walls, Arun Kumar,
	austin.lobo

On Tue, Feb 4, 2014 at 3:29 PM, Amit Grover <amit.grover@samsung.com> wrote:
> Adding V4L2 controls for horizontal and vertical search range in pixels
> for motion estimation module in video encoder.
>
> Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
> Signed-off-by: Amit Grover <amit.grover@samsung.com>

Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad

> ---
>  Documentation/DocBook/media/v4l/controls.xml |   20 ++++++++++++++++++++
>  drivers/media/v4l2-core/v4l2-ctrls.c         |    6 ++++++
>  include/uapi/linux/v4l2-controls.h           |    2 ++
>  3 files changed, 28 insertions(+)
>
> diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
> index a5a3188..0e1770c 100644
> --- a/Documentation/DocBook/media/v4l/controls.xml
> +++ b/Documentation/DocBook/media/v4l/controls.xml
> @@ -2258,6 +2258,26 @@ Applicable to the MPEG1, MPEG2, MPEG4 encoders.</entry>
>  VBV buffer control.</entry>
>               </row>
>
> +                 <row><entry></entry></row>
> +             <row id=""v4l2-mpeg-video-hor-search-range">
> +               <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE</constant>&nbsp;</entry>
> +               <entry>integer</entry>
> +             </row>
> +               <row><entry spanname="descr">Horizontal search range defines maximum horizontal search area in pixels
> +to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
> +horizontal search range for motion estimation module in video encoder.</entry>
> +             </row>
> +
> +                <row><entry></entry></row>
> +             <row id="v4l2-mpeg-video-vert-search-range">
> +               <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE</constant>&nbsp;</entry>
> +               <entry>integer</entry>
> +             </row>
> +               <row><entry spanname="descr">Vertical search range defines maximum vertical search area in pixels
> +to search and match for the present Macroblock (MB) in the reference picture. This V4L2 control macro is used to set
> +vertical search range for motion estimation module in video encoder.</entry>
> +             </row>
> +
>               <row><entry></entry></row>
>               <row>
>                 <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE</constant>&nbsp;</entry>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 6ff002b..e9e12c4 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id)
>         case V4L2_CID_MPEG_VIDEO_DEC_PTS:                       return "Video Decoder PTS";
>         case V4L2_CID_MPEG_VIDEO_DEC_FRAME:                     return "Video Decoder Frame Count";
>         case V4L2_CID_MPEG_VIDEO_VBV_DELAY:                     return "Initial Delay for VBV Control";
> +       case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:             return "Horizontal MV Search Range";
> +       case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:             return "Vertical MV Search Range";
>         case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER:             return "Repeat Sequence Header";
>
>         /* VPX controls */
> @@ -910,6 +912,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>                 *min = 0;
>                 *max = *step = 1;
>                 break;
> +       case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
> +       case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
> +               *type = V4L2_CTRL_TYPE_INTEGER;
> +               break;
>         case V4L2_CID_PAN_RESET:
>         case V4L2_CID_TILT_RESET:
>         case V4L2_CID_FLASH_STROBE:
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index 2cbe605..cda6fa0 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -376,6 +376,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
>  #define V4L2_CID_MPEG_VIDEO_DEC_FRAME                  (V4L2_CID_MPEG_BASE+224)
>  #define V4L2_CID_MPEG_VIDEO_VBV_DELAY                  (V4L2_CID_MPEG_BASE+225)
>  #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER          (V4L2_CID_MPEG_BASE+226)
> +#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE          (V4L2_CID_MPEG_BASE+227)
> +#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE          (V4L2_CID_MPEG_BASE+228)
>
>  #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP            (V4L2_CID_MPEG_BASE+300)
>  #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP            (V4L2_CID_MPEG_BASE+301)
> --
> 1.7.9.5
>

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

end of thread, other threads:[~2014-02-06  8:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-30 10:43 [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks Amit Grover
2014-01-23  5:19 ` swaminathan
2014-01-23  5:42   ` Prabhakar Lad
2014-01-23 10:11 ` Kamil Debski
2014-01-23 10:21   ` Sylwester Nawrocki
2014-01-30  5:42     ` [PATCH v2 0/2] drivers/media: Add controls for Horizontal and Vertical MV Search Range Amit Grover
2014-01-30  5:42       ` [PATCH v2 1/2] drivers/media: v4l2: Add settings " Amit Grover
2014-01-30  7:36         ` Hans Verkuil
2014-01-30 15:22           ` Kamil Debski
2014-01-30  5:42       ` [PATCH v2 2/2] drivers/media: s5p-mfc: Add " Amit Grover
2014-01-30  7:39         ` Hans Verkuil
2014-01-30  6:02       ` [PATCH v2 0/2] drivers/media: Add controls for " Sachin Kamat
2014-02-04  9:59     ` [PATCH v3 " Amit Grover
2014-02-04  9:59       ` [PATCH 1/2] [media] v4l2: Add settings " Amit Grover
2014-02-04 10:13         ` Hans Verkuil
2014-02-06  8:13         ` Prabhakar Lad
2014-02-04  9:59       ` [PATCH 2/2] [media] s5p-mfc: Add " Amit Grover

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