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
31933193 <row><entry spanname="descr">Quantization parameter for a P frame for VP8.</entry>
31943194 </row>
31953195
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.
3202+Acceptable values are 0, 1, 2 and 3 corresponding to encoder profiles 0, 1, 2 and 3.</entry>
3203+ </row>
3204+
31963205 <row><entry></entry></row>
31973206 </tbody>
31983207 </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
417417 u8 rc_max_qp;
418418 u8 rc_frame_qp;
419419 u8 rc_p_frame_qp;
420+ u8 profile;
420421 };
421422
422423 /**
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c+11−0
@@ -650,6 +650,14 @@ static struct mfc_control controls[] = { · 649 unmodified lines
650650 .step = 1,
651651 .default_value = 10,
652652 },
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+ },
653661 };
654662
655663 #define NUM_CTRLS ARRAY_SIZE(controls)
@@ -1601,6 +1609,9 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) · 945 unmodified lines
16011609 case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:
16021610 p->codec.vp8.rc_p_frame_qp = ctrl->val;
16031611 break;
1612+ case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:
1613+ p->codec.vp8.profile = ctrl->val;
1614+ break;
16041615 default:
16051616 v4l2_err(&dev->v4l2_dev, "Invalid control, id=%d, val=%d\n",
16061617 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
11971197 reg |= ((p->num_b_frame & 0x3) << 16);
11981198 WRITEL(reg, S5P_FIMV_E_GOP_CONFIG_V6);
11991199
1200− /* profile & level */
1201− reg = 0;
1202− /** profile */
1203− reg |= (0x1 << 4);
1200+ /* profile - 0 ~ 3 */
1201+ reg = p_vp8->profile & 0x3;
12041202 WRITEL(reg, S5P_FIMV_E_PICTURE_PROFILE_V6);
12051203
12061204 /* 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
749749 case V4L2_CID_MPEG_VIDEO_VPX_MAX_QP: return "VPX Maximum QP Value";
750750 case V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP: return "VPX I-Frame QP Value";
751751 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";
752753
753754 /* CAMERA controls */
754755 /* 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
562562 #define V4L2_CID_MPEG_VIDEO_VPX_MAX_QP (V4L2_CID_MPEG_BASE+508)
563563 #define V4L2_CID_MPEG_VIDEO_VPX_I_FRAME_QP (V4L2_CID_MPEG_BASE+509)
564564 #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)
565566
566567 /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
567568 #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)