[COMMON] media: mfc: support various VP9 level
authorAyoung Sim <a.sim@samsung.com>
Fri, 13 Jul 2018 08:37:01 +0000 (17:37 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Mon, 23 Jul 2018 06:19:05 +0000 (15:19 +0900)
Change-Id: I97836c2c0df644d83467998049734a7a55e3af3a
Signed-off-by: Ayoung Sim <a.sim@samsung.com>
drivers/media/platform/exynos/mfc/exynos_mfc_media.h
drivers/media/platform/exynos/mfc/mfc_common.h
drivers/media/platform/exynos/mfc/mfc_data_struct.h
drivers/media/platform/exynos/mfc/mfc_enc_internal.h
drivers/media/platform/exynos/mfc/mfc_enc_param.c
drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c

index d032b0c0be4638dc9825121b1f1622a4d8dd3ddb..02d26f4bfec1b70715a456787c663b6509385d4b 100644 (file)
@@ -405,6 +405,8 @@ enum v4l2_mpeg_video_hevc_hierarchical_coding_type {
                                        (V4L2_CID_MPEG_MFC_BASE + 181)
 #define V4L2_CID_MPEG_VIDEO_VP9_PROFILE                                \
                                        (V4L2_CID_MPEG_MFC_BASE + 182)
+#define V4L2_CID_MPEG_VIDEO_VP9_LEVEL                          \
+                                       (V4L2_CID_MPEG_MFC_BASE + 183)
 
 /* CIDs for new common interface */
 #define V4L2_CID_MPEG_VIDEO_ROI_CONTROL                                \
index 33481ca6aa86d2410990faa9e1bf9f3639b86b10..cc0287ad64d1c60d6fdeb9e51615f058d7eb6212 100644 (file)
 #define        ENC_SET_COLOR_ASPECT            (1 << 9)
 #define        ENC_SET_HP_BITRATE_CONTROL      (1 << 10)
 #define        ENC_SET_STATIC_INFO             (1 << 11)
+#define        ENC_SET_VP9_PROFILE_LEVEL       (1 << 13)
 
 #define MFC_VER_MAJOR(dev)     ((dev->pdata->ip_ver >> 8) & 0xFF)
 #define MFC_VER_MINOR(dev)     (dev->pdata->ip_ver & 0xFF)
index b82b7e391dc56240c496128cc3c38d0a9c9eb256..a579c58ac6bdb30378b21705f88b55a5c19153b1 100644 (file)
@@ -910,8 +910,8 @@ struct mfc_mpeg4_enc_params {
  */
 struct mfc_vp9_enc_params {
        /* VP9 Only */
-       u8 vp9_version;
        u8 profile;
+       u8 level;
        u8 rc_min_qp;
        u8 rc_max_qp;
        u8 rc_min_qp_p;
index f3b7eb60698964675e1af5765a4215bdf0a4e879..0e02c5df1af1b8f792c882f69667152800624b22 100644 (file)
@@ -1087,6 +1087,24 @@ static struct v4l2_queryctrl controls[] = {
                .step = 1,
                .default_value = 0,
        },
+       {
+               .id = V4L2_CID_MPEG_VIDEO_VP9_PROFILE,
+               .type = V4L2_CTRL_TYPE_INTEGER,
+               .name = "VP9 profile",
+               .minimum = 0,
+               .maximum = 3,
+               .step = 1,
+               .default_value = 0,
+       },
+       {
+               .id = V4L2_CID_MPEG_VIDEO_VP9_LEVEL,
+               .type = V4L2_CTRL_TYPE_INTEGER,
+               .name = "VP9 level",
+               .minimum = 10,
+               .maximum = 62,
+               .step = 1,
+               .default_value = 10,
+       },
        {
                .id = V4L2_CID_MPEG_VIDEO_VP9_I_FRAME_QP,
                .type = V4L2_CTRL_TYPE_INTEGER,
index d4b903c316005cd1dce10476f3d86f1d562da2e1..e57d6f6693b4b9e7de807ee30f586697de3b5655 100644 (file)
@@ -852,7 +852,9 @@ void mfc_set_enc_params_vp9(struct mfc_ctx *ctx)
 
        /* profile*/
        reg = 0;
-       mfc_set_bits(reg, 0xF, 0, p_vp9->vp9_version);
+       mfc_set_bits(reg, 0xF, 0, p_vp9->profile);
+       /* level */
+       mfc_set_bits(reg, 0xFF, 8, p_vp9->level);
        /* bit depth minus8 */
        if (ctx->is_10bit) {
                mfc_set_bits(reg, 0x3F, 17, 0x2);
@@ -862,17 +864,17 @@ void mfc_set_enc_params_vp9(struct mfc_ctx *ctx)
 
        /* for only information about wrong setting */
        if (ctx->is_422) {
-               if ((p_vp9->vp9_version != MFC_REG_E_PROFILE_VP9_PROFILE1) &&
-                       (p_vp9->vp9_version != MFC_REG_E_PROFILE_VP9_PROFILE3)) {
+               if ((p_vp9->profile != MFC_REG_E_PROFILE_VP9_PROFILE1) &&
+                       (p_vp9->profile != MFC_REG_E_PROFILE_VP9_PROFILE3)) {
                        mfc_err_ctx("4:2:2 format is not matched with profile(%d)\n",
-                                       p_vp9->vp9_version);
+                                       p_vp9->profile);
                }
        }
        if (ctx->is_10bit) {
-               if ((p_vp9->vp9_version != MFC_REG_E_PROFILE_VP9_PROFILE2) &&
-                       (p_vp9->vp9_version != MFC_REG_E_PROFILE_VP9_PROFILE3)) {
+               if ((p_vp9->profile != MFC_REG_E_PROFILE_VP9_PROFILE2) &&
+                       (p_vp9->profile != MFC_REG_E_PROFILE_VP9_PROFILE3)) {
                        mfc_err_ctx("[10BIT] format is not matched with profile(%d)\n",
-                                       p_vp9->vp9_version);
+                                       p_vp9->profile);
                }
        }
 
index 4a216c0a22362df8cc9dadd0f3d10514fd3dfb0f..b8553692199ab0f27007df02395f6d428deea4fe 100644 (file)
@@ -892,6 +892,9 @@ static int __mfc_enc_ext_info(struct mfc_ctx *ctx)
        if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_enc))
                val |= ENC_SET_STATIC_INFO;
 
+       if (dev->pdata->support_422)
+               val |= ENC_SET_VP9_PROFILE_LEVEL;
+
        mfc_debug(5, "[CTRLS] ext info val: %#x\n", val);
 
        return val;
@@ -1456,7 +1459,7 @@ static int __mfc_enc_set_param(struct mfc_ctx *ctx, struct v4l2_control *ctrl)
                p->codec.vp8.num_hier_layer = ctrl->value;
                break;
        case V4L2_CID_MPEG_VIDEO_VP9_VERSION:
-               p->codec.vp9.vp9_version = ctrl->value;
+               p->codec.vp9.profile = ctrl->value;
                break;
        case V4L2_CID_MPEG_VIDEO_VP9_RC_FRAME_RATE:
                p->rc_framerate = ctrl->value;
@@ -1519,6 +1522,9 @@ static int __mfc_enc_set_param(struct mfc_ctx *ctx, struct v4l2_control *ctrl)
        case V4L2_CID_MPEG_VIDEO_VP9_PROFILE:
                p->codec.vp9.profile = ctrl->value;
                break;
+       case V4L2_CID_MPEG_VIDEO_VP9_LEVEL:
+               p->codec.vp9.level = ctrl->value;
+               break;
        case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP:
                p->codec.hevc.rc_frame_qp = ctrl->value;
                break;