History

[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

Kiran AVND committed 12 years ago

Commit bbd8f3f1 parent b80cb8d6 files · +25 −4Browse files

Unified · Split

6 files
  1. Documentation/DocBook/media/v4l/controls.xml +9 −0
  2. drivers/media/platform/s5p-mfc/s5p_mfc_common.h +1 −0
  3. drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +11 −0
  4. drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +2 −4
  5. drivers/media/v4l2-core/v4l2-ctrls.c +1 −0
  6. include/uapi/linux/v4l2-controls.h +1 −0
Documentation/DocBook/media/v4l/controls.xml+9−0
@@ -3193,6 +3193,15 @@ V4L2_CID_MPEG_VIDEO_VPX_GOLDEN_FRAME_REF_PERIOD as a golden frame.</entry> · 3192 unmodified lines
3193 <row><entry spanname="descr">Quantization parameter for a P frame for VP8.</entry>3193 <row><entry spanname="descr">Quantization parameter for a P frame for VP8.</entry>
3194 </row>3194 </row>
3195 3195
3196 <row><entry></entry></row>
3197 <row>
3198 <entry spanname="id"><constant>V4L2_CID_MPEG_VIDEO_VPX_PROFILE</constant>&nbsp;</entry>
3199 <entry>integer</entry>
3200 </row>
3201 <row><entry spanname="descr">Select the desired profile for VPx encoder.
3202Acceptable values are 0, 1, 2 and 3 corresponding to encoder profiles 0, 1, 2 and 3.</entry>
3203 </row>
3204
3196 <row><entry></entry></row>3205 <row><entry></entry></row>
3197 </tbody>3206 </tbody>
3198 </tgroup>3207 </tgroup>
drivers/media/platform/s5p-mfc/s5p_mfc_common.h+1−0
@@ -417,6 +417,7 @@ struct s5p_mfc_vp8_enc_params { · 416 unmodified lines
417 u8 rc_max_qp;417 u8 rc_max_qp;
418 u8 rc_frame_qp;418 u8 rc_frame_qp;
419 u8 rc_p_frame_qp;419 u8 rc_p_frame_qp;
420 u8 profile;
420};421};
421 422
422/**423/**
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c+11−0
@@ -650,6 +650,14 @@ static struct mfc_control controls[] = { · 649 unmodified lines
650 .step = 1,650 .step = 1,
651 .default_value = 10,651 .default_value = 10,
652 },652 },
653 {
654 .id = V4L2_CID_MPEG_VIDEO_VPX_PROFILE,
655 .type = V4L2_CTRL_TYPE_INTEGER,
656 .minimum = 0,
657 .maximum = 3,
658 .step = 1,
659 .default_value = 0,
660 },
653};661};
654 662
655#define NUM_CTRLS ARRAY_SIZE(controls)663#define NUM_CTRLS ARRAY_SIZE(controls)
@@ -1601,6 +1609,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) · 945 unmodified lines
1601 case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:1609 case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:
1602 p->codec.vp8.rc_p_frame_qp = ctrl->val;1610 p->codec.vp8.rc_p_frame_qp = ctrl->val;
1603 break;1611 break;
1612 case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:
1613 p->codec.vp8.profile = ctrl->val;
1614 break;
1604 default:1615 default:
1605 v4l2_err(&dev->v4l2_dev, "Invalid control, id=%d, val=%d\n",1616 v4l2_err(&dev->v4l2_dev, "Invalid control, id=%d, val=%d\n",
1606 ctrl->id, ctrl->val);1617 ctrl->id, ctrl->val);
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c+2−4
@@ -1197,10 +1197,8 @@ static int s5p_mfc_set_enc_params_vp8(struct s5p_mfc_ctx *ctx) · 1196 unmodified lines
1197 reg |= ((p->num_b_frame & 0x3) << 16);1197 reg |= ((p->num_b_frame & 0x3) << 16);
1198 WRITEL(reg, S5P_FIMV_E_GOP_CONFIG_V6);1198 WRITEL(reg, S5P_FIMV_E_GOP_CONFIG_V6);
1199 1199
1200 /* profile & level */1200 /* profile - 0 ~ 3 */
1201 reg = 0;1201 reg = p_vp8->profile & 0x3;
1202 /** profile */
1203 reg |= (0x1 << 4);
1204 WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE_V6);1202 WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE_V6);
1205 1203
1206 /* rate control config. */1204 /* rate control config. */
drivers/media/v4l2-core/v4l2-ctrls.c+1−0
@@ -749,6 +749,7 @@ const char *v4l2_ctrl_get_name(u32 id) · 748 unmodified lines
749 case V4L2_CID_MPEG_VIDEO_VPX_MAX_QP: return "VPX Maximum QP Value";749 case V4L2_CID_MPEG_VIDEO_VPX_MAX_QP: return "VPX Maximum QP Value";
750 case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP: return "VPX I-Frame QP Value";750 case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP: return "VPX I-Frame QP Value";
751 case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP: return "VPX P-Frame QP Value";751 case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP: return "VPX P-Frame QP Value";
752 case V4L2_CID_MPEG_VIDEO_VPX_PROFILE: return "VPX Profile";
752 753
753 /* CAMERA controls */754 /* CAMERA controls */
754 /* Keep the order of the 'case's the same as in videodev2.h! */755 /* Keep the order of the 'case's the same as in videodev2.h! */
include/uapi/linux/v4l2-controls.h+1−0
@@ -562,6 +562,7 @@ enum v4l2_vp8_golden_frame_sel { · 561 unmodified lines
562#define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_MPEG_BASE+508)562#define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_MPEG_BASE+508)
563#define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE+509)563#define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE+509)
564#define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP (V4L2_CID_MPEG_BASE+510)564#define V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP (V4L2_CID_MPEG_BASE+510)
565#define V4L2_CID_MPEG_VIDEO_VPX_PROFILE (V4L2_CID_MPEG_BASE+511)
565 566
566/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */567/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
567#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)568#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)