Commit bbd8f3fe authored by Kiran AVND's avatar Kiran AVND Committed by Mauro Carvalho Chehab

[media] s5p-mfc: Add controls to set vp8 enc profile

Add v4l2 controls to set desired profile for VP8 encoder.
Acceptable levels for VP8 encoder are
0: Version 0
1: Version 1
2: Version 2
3: Version 3
Signed-off-by: default avatarKiran AVND <avnd.kiran@samsung.com>
Signed-off-by: default avatarPawel Osciak <posciak@chromium.org>
Signed-off-by: default avatarArun Kumar K <arun.kk@samsung.com>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent b80cb8dc
...@@ -3193,6 +3193,15 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a golden frame.</entry> ...@@ -3193,6 +3193,15 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a golden frame.</entry>
<row><entry spanname="descr">Quantization parameter for a P frame for VP8.</entry> <row><entry spanname="descr">Quantization parameter for a P frame for VP8.</entry>
</row> </row>
<row><entry></entry></row>
<row>
<entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VPX_PROFILE</constant>&nbsp;</entry>
<entry>integer</entry>
</row>
<row><entry spanname="descr">Select the desired profile for VPx encoder.
Acceptable values are 0, 1, 2 and 3 corresponding to encoder profiles 0, 1, 2 and 3.</entry>
</row>
<row><entry></entry></row> <row><entry></entry></row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -417,6 +417,7 @@ struct s5p_mfc_vp8_enc_params { ...@@ -417,6 +417,7 @@ struct s5p_mfc_vp8_enc_params {
u8 rc_max_qp; u8 rc_max_qp;
u8 rc_frame_qp; u8 rc_frame_qp;
u8 rc_p_frame_qp; u8 rc_p_frame_qp;
u8 profile;
}; };
/** /**
......
...@@ -650,6 +650,14 @@ static struct mfc_control controls[] = { ...@@ -650,6 +650,14 @@ static struct mfc_control controls[] = {
.step = 1, .step = 1,
.default_value = 10, .default_value = 10,
}, },
{
.id = V4L2_CID_MPEG_VIDEO_VPX_PROFILE,
.type = V4L2_CTRL_TYPE_INTEGER,
.minimum = 0,
.maximum = 3,
.step = 1,
.default_value = 0,
},
}; };
#define NUM_CTRLS ARRAY_SIZE(controls) #define NUM_CTRLS ARRAY_SIZE(controls)
...@@ -1601,6 +1609,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1601,6 +1609,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP: case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:
p->codec.vp8.rc_p_frame_qp = ctrl->val; p->codec.vp8.rc_p_frame_qp = ctrl->val;
break; break;
case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:
p->codec.vp8.profile = ctrl->val;
break;
default: default:
v4l2_err(&dev->v4l2_dev, "Invalid control, id=%d, val=%d\n", v4l2_err(&dev->v4l2_dev, "Invalid control, id=%d, val=%d\n",
ctrl->id, ctrl->val); ctrl->id, ctrl->val);
......
...@@ -1197,10 +1197,8 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx *ctx) ...@@ -1197,10 +1197,8 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx *ctx)
reg |= ((p->num_b_frame & 0x3) << 16); reg |= ((p->num_b_frame & 0x3) << 16);
WRITEL(reg, S5P_FIMV_E_GOP_CONFIG_V6); WRITEL(reg, S5P_FIMV_E_GOP_CONFIG_V6);
/* profile & level */ /* profile - 0 ~ 3 */
reg = 0; reg = p_vp8->profile & 0x3;
/** profile */
reg |= (0x1 << 4);
WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE_V6); WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE_V6);
/* rate control config. */ /* rate control config. */
......
...@@ -749,6 +749,7 @@ const char *v4l2_ctrl_get_name(u32 id) ...@@ -749,6 +749,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_MPEG_VIDEO_VPX_MAX_QP: return "VPX Maximum QP Value"; case V4L2_CID_MPEG_VIDEO_VPX_MAX_QP: return "VPX Maximum QP Value";
case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP: return "VPX I-Frame QP Value"; 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_P_FRAME_QP: return "VPX P-Frame QP Value";
case V4L2_CID_MPEG_VIDEO_VPX_PROFILE: return "VPX Profile";
/* CAMERA controls */ /* CAMERA controls */
/* Keep the order of the 'case's the same as in videodev2.h! */ /* Keep the order of the 'case's the same as in videodev2.h! */
......
...@@ -562,6 +562,7 @@ enum v4l2_vp8_golden_frame_sel { ...@@ -562,6 +562,7 @@ enum v4l2_vp8_golden_frame_sel {
#define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_MPEG_BASE+508) #define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_MPEG_BASE+508)
#define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE+509) #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_P_FRAME_QP (V4L2_CID_MPEG_BASE+510)
#define V4L2_CID_MPEG_VIDEO_VPX_PROFILE (V4L2_CID_MPEG_BASE+511)
/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment