Re: [PATCH] [media] s5p-mfc: Add a control for IVF format for VP8 encoder

2014-05-15 Thread Pawel Osciak
On Wed, May 14, 2014 at 11:12 PM, Kamil Debski k.deb...@samsung.com wrote:
 Hi Pawel, Hans,

 I think we talked some time ago on IRC about this patch.
 If I remember correctly, the conclusion was that it would be better to use
 a specific pixel formats for this kind of out codec output.

 Akin to:
 V4L2_PIX_FMT_H264   'H264'  H264 video elementary stream
 with start codes.
 V4L2_PIX_FMT_H264_NO_SC 'AVC1'  H264 video elementary stream without
 start codes.

 Could you confirm this?

Hi Kamil.
Yes, that was the conclusion.
Pawel


 Best wishes,
 --
 Kamil Debski
 Samsung RD Institute Poland


 -Original Message-
 From: Arun Kumar K [mailto:arunkk.sams...@gmail.com] On Behalf Of Arun
 Kumar K
 Sent: Thursday, March 06, 2014 7:04 AM
 To: linux-media@vger.kernel.org; linux-samsung-...@vger.kernel.org
 Cc: k.deb...@samsung.com; s.nawro...@samsung.com; posc...@chromium.org;
 arunkk.sams...@gmail.com
 Subject: [PATCH] [media] s5p-mfc: Add a control for IVF format for VP8
 encoder

 From: Pawel Osciak posc...@chromium.org

 Add a control to enable/disable IVF output stream format for VP8 encode.
 Set the IVF format output to disabled as default.

 Signed-off-by: Pawel Osciak posc...@chromium.org
 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
  Documentation/DocBook/media/v4l/controls.xml|8 
  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 +
  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   11 +++
  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |2 ++
  drivers/media/v4l2-core/v4l2-ctrls.c|1 +
  include/uapi/linux/v4l2-controls.h  |1 +
  6 files changed, 24 insertions(+)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml
 b/Documentation/DocBook/media/v4l/controls.xml
 index 0e1770c..07fb64a 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -3222,6 +3222,14 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD
 as a golden frame./entry  Acceptable values are 0, 1, 2 and 3
 corresponding to encoder profiles 0, 1, 2 and 3./entry
 /row

 +   rowentry/entry/row
 +   row
 + entry
 spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT/constantn
 bsp;/entry
 + entryboolean/entry
 +   /row
 +   rowentry spanname=descrOutputs the VP8 encoded stream
 in IVF file format./entry
 +   /row
 +
rowentry/entry/row
  /tbody
/tgroup
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 index 5c28cc3..4d17df9 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 @@ -418,6 +418,7 @@ struct s5p_mfc_vp8_enc_params {
   u8 rc_frame_qp;
   u8 rc_p_frame_qp;
   u8 profile;
 + bool ivf;
  };

  /**
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 index df83cd1..a67913e 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 @@ -676,6 +676,14 @@ static struct mfc_control controls[] = {
   .step = 1,
   .default_value = 0,
   },
 + {
 + .id = V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT,
 + .type = V4L2_CTRL_TYPE_BOOLEAN,
 + .minimum = 0,
 + .maximum = 1,
 + .step = 1,
 + .default_value = 0,
 + },
  };

  #define NUM_CTRLS ARRAY_SIZE(controls)
 @@ -1636,6 +1644,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl
 *ctrl)
   case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:
   p-codec.vp8.profile = ctrl-val;
   break;
 + case V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT:
 + p-codec.vp8.ivf = ctrl-val;
 + break;
   default:
   v4l2_err(dev-v4l2_dev, Invalid control, id=%d, val=%d\n,
   ctrl-id,
 ctrl-val);
 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 f64621a..90edb19 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 @@ -1243,6 +1243,8 @@ static int s5p_mfc_set_enc_params_vp8(struct
 s5p_mfc_ctx *ctx)

   /* VP8 specific params */
   reg = 0;
 + /* Bit set to 1 disables IVF stream format. */
 + reg |= p_vp8-ivf ? 0 : (0x1  12);
   reg |= (p_vp8-imd_4x4  0x1)  10;
   switch (p_vp8-num_partitions) {
   case V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION:
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-
 core/v4l2-ctrls.c
 index e9e12c4..19e78df 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -752,6 +752,7 @@ const char *v4l2_ctrl_get_name(u32 id)
   case 

RE: [PATCH] [media] s5p-mfc: Add a control for IVF format for VP8 encoder

2014-05-14 Thread Kamil Debski
Hi Pawel, Hans,

I think we talked some time ago on IRC about this patch.
If I remember correctly, the conclusion was that it would be better to use
a specific pixel formats for this kind of out codec output.

Akin to:
V4L2_PIX_FMT_H264   'H264'  H264 video elementary stream
with start codes.
V4L2_PIX_FMT_H264_NO_SC 'AVC1'  H264 video elementary stream without
start codes.

Could you confirm this?

Best wishes,
-- 
Kamil Debski
Samsung RD Institute Poland


 -Original Message-
 From: Arun Kumar K [mailto:arunkk.sams...@gmail.com] On Behalf Of Arun
 Kumar K
 Sent: Thursday, March 06, 2014 7:04 AM
 To: linux-media@vger.kernel.org; linux-samsung-...@vger.kernel.org
 Cc: k.deb...@samsung.com; s.nawro...@samsung.com; posc...@chromium.org;
 arunkk.sams...@gmail.com
 Subject: [PATCH] [media] s5p-mfc: Add a control for IVF format for VP8
 encoder
 
 From: Pawel Osciak posc...@chromium.org
 
 Add a control to enable/disable IVF output stream format for VP8 encode.
 Set the IVF format output to disabled as default.
 
 Signed-off-by: Pawel Osciak posc...@chromium.org
 Signed-off-by: Arun Kumar K arun...@samsung.com
 ---
  Documentation/DocBook/media/v4l/controls.xml|8 
  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 +
  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   11 +++
  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |2 ++
  drivers/media/v4l2-core/v4l2-ctrls.c|1 +
  include/uapi/linux/v4l2-controls.h  |1 +
  6 files changed, 24 insertions(+)
 
 diff --git a/Documentation/DocBook/media/v4l/controls.xml
 b/Documentation/DocBook/media/v4l/controls.xml
 index 0e1770c..07fb64a 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -3222,6 +3222,14 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD
 as a golden frame./entry  Acceptable values are 0, 1, 2 and 3
 corresponding to encoder profiles 0, 1, 2 and 3./entry
 /row
 
 +   rowentry/entry/row
 +   row
 + entry
 spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT/constantn
 bsp;/entry
 + entryboolean/entry
 +   /row
 +   rowentry spanname=descrOutputs the VP8 encoded stream
 in IVF file format./entry
 +   /row
 +
rowentry/entry/row
  /tbody
/tgroup
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 index 5c28cc3..4d17df9 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 @@ -418,6 +418,7 @@ struct s5p_mfc_vp8_enc_params {
   u8 rc_frame_qp;
   u8 rc_p_frame_qp;
   u8 profile;
 + bool ivf;
  };
 
  /**
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 index df83cd1..a67913e 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 @@ -676,6 +676,14 @@ static struct mfc_control controls[] = {
   .step = 1,
   .default_value = 0,
   },
 + {
 + .id = V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT,
 + .type = V4L2_CTRL_TYPE_BOOLEAN,
 + .minimum = 0,
 + .maximum = 1,
 + .step = 1,
 + .default_value = 0,
 + },
  };
 
  #define NUM_CTRLS ARRAY_SIZE(controls)
 @@ -1636,6 +1644,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl
 *ctrl)
   case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:
   p-codec.vp8.profile = ctrl-val;
   break;
 + case V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT:
 + p-codec.vp8.ivf = ctrl-val;
 + break;
   default:
   v4l2_err(dev-v4l2_dev, Invalid control, id=%d, val=%d\n,
   ctrl-id,
ctrl-val);
 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 f64621a..90edb19 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 @@ -1243,6 +1243,8 @@ static int s5p_mfc_set_enc_params_vp8(struct
 s5p_mfc_ctx *ctx)
 
   /* VP8 specific params */
   reg = 0;
 + /* Bit set to 1 disables IVF stream format. */
 + reg |= p_vp8-ivf ? 0 : (0x1  12);
   reg |= (p_vp8-imd_4x4  0x1)  10;
   switch (p_vp8-num_partitions) {
   case V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION:
 diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-
 core/v4l2-ctrls.c
 index e9e12c4..19e78df 100644
 --- a/drivers/media/v4l2-core/v4l2-ctrls.c
 +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
 @@ -752,6 +752,7 @@ const char *v4l2_ctrl_get_name(u32 id)
   case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP:return VPX
I-
 Frame QP Value;
   case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return VPX
P-

[PATCH] [media] s5p-mfc: Add a control for IVF format for VP8 encoder

2014-03-05 Thread Arun Kumar K
From: Pawel Osciak posc...@chromium.org

Add a control to enable/disable IVF output stream format for VP8 encode.
Set the IVF format output to disabled as default.

Signed-off-by: Pawel Osciak posc...@chromium.org
Signed-off-by: Arun Kumar K arun...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml|8 
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   11 +++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |2 ++
 drivers/media/v4l2-core/v4l2-ctrls.c|1 +
 include/uapi/linux/v4l2-controls.h  |1 +
 6 files changed, 24 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 0e1770c..07fb64a 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3222,6 +3222,14 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a 
golden frame./entry
 Acceptable values are 0, 1, 2 and 3 corresponding to encoder profiles 0, 1, 2 
and 3./entry
  /row
 
+ rowentry/entry/row
+ row
+   entry 
spanname=idconstantV4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT/constantnbsp;/entry
+   entryboolean/entry
+ /row
+ rowentry spanname=descrOutputs the VP8 encoded stream in 
IVF file format./entry
+ /row
+
   rowentry/entry/row
 /tbody
   /tgroup
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 5c28cc3..4d17df9 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -418,6 +418,7 @@ struct s5p_mfc_vp8_enc_params {
u8 rc_frame_qp;
u8 rc_p_frame_qp;
u8 profile;
+   bool ivf;
 };
 
 /**
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index df83cd1..a67913e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -676,6 +676,14 @@ static struct mfc_control controls[] = {
.step = 1,
.default_value = 0,
},
+   {
+   .id = V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT,
+   .type = V4L2_CTRL_TYPE_BOOLEAN,
+   .minimum = 0,
+   .maximum = 1,
+   .step = 1,
+   .default_value = 0,
+   },
 };
 
 #define NUM_CTRLS ARRAY_SIZE(controls)
@@ -1636,6 +1644,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:
p-codec.vp8.profile = ctrl-val;
break;
+   case V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT:
+   p-codec.vp8.ivf = ctrl-val;
+   break;
default:
v4l2_err(dev-v4l2_dev, Invalid control, id=%d, val=%d\n,
ctrl-id, ctrl-val);
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 f64621a..90edb19 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -1243,6 +1243,8 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx 
*ctx)
 
/* VP8 specific params */
reg = 0;
+   /* Bit set to 1 disables IVF stream format. */
+   reg |= p_vp8-ivf ? 0 : (0x1  12);
reg |= (p_vp8-imd_4x4  0x1)  10;
switch (p_vp8-num_partitions) {
case V4L2_CID_MPEG_VIDEO_VPX_1_PARTITION:
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index e9e12c4..19e78df 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -752,6 +752,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP:return VPX 
I-Frame QP Value;
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;
+   case V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT:return VPX 
Output stream in IVF format;
 
/* CAMERA controls */
/* Keep the order of the 'case's the same as in videodev2.h! */
diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index cda6fa0..b2763d6 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -565,6 +565,7 @@ enum v4l2_vp8_golden_frame_sel {
 #define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE+509)
 #define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP (V4L2_CID_MPEG_BASE+510)
 #define V4L2_CID_MPEG_VIDEO_VPX_PROFILE
(V4L2_CID_MPEG_BASE+511)
+#define V4L2_CID_MPEG_VIDEO_VPX_IVF_FORMAT (V4L2_CID_MPEG_BASE+512)
 
 /*