[media] s5p-mfc: Add Horizontal and Vertical MV Search Range
authorAmit Grover <amit.grover@samsung.com>
Tue, 4 Feb 2014 09:59:59 +0000 (06:59 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 28 Feb 2014 18:18:00 +0000 (15:18 -0300)
This patch adds Controls to set Horizontal and Vertical search range
for Motion Estimation block for Samsung MFC video Encoders.

Signed-off-by: Swami Nathan <swaminath.p@samsung.com>
Signed-off-by: Amit Grover <amit.grover@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/s5p-mfc/regs-mfc-v6.h
drivers/media/platform/s5p-mfc/s5p_mfc_common.h
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c

index 2398cdf613412dfc85c4ed45ca2ab0eef68220b2..8d0b686d9adbeecbe26c41352fe79f75cf04ff98 100644 (file)
 #define S5P_FIMV_E_PADDING_CTRL_V6             0xf7a4
 #define S5P_FIMV_E_MV_HOR_RANGE_V6             0xf7ac
 #define S5P_FIMV_E_MV_VER_RANGE_V6             0xf7b0
+#define S5P_FIMV_E_MV_RANGE_V6_MASK            0x3fff
 
 #define S5P_FIMV_E_VBV_BUFFER_SIZE_V6          0xf84c
 #define S5P_FIMV_E_VBV_INIT_DELAY_V6           0xf850
index f723f1f2f5784e4501e7b39dcb027c507523cb07..5c28cc3e699b4809238a6e6ed53efee3a253548d 100644 (file)
@@ -426,6 +426,8 @@ struct s5p_mfc_vp8_enc_params {
 struct s5p_mfc_enc_params {
        u16 width;
        u16 height;
+       u32 mv_h_range;
+       u32 mv_v_range;
 
        u16 gop_size;
        enum v4l2_mpeg_video_multi_slice_mode slice_mode;
index 91b6e020ddf3ec05d5255574f71be3b2dc86fc23..df83cd157babf953b15b4dd323f87e08e5ccb6d4 100644 (file)
@@ -207,6 +207,24 @@ static struct mfc_control controls[] = {
                .step = 1,
                .default_value = 0,
        },
+       {
+               .id = V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE,
+               .type = V4L2_CTRL_TYPE_INTEGER,
+               .name = "Horizontal MV Search Range",
+               .minimum = 16,
+               .maximum = 128,
+               .step = 16,
+               .default_value = 32,
+       },
+       {
+               .id = V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE,
+               .type = V4L2_CTRL_TYPE_INTEGER,
+               .name = "Vertical MV Search Range",
+               .minimum = 16,
+               .maximum = 128,
+               .step = 16,
+               .default_value = 32,
+       },
        {
                .id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
                .type = V4L2_CTRL_TYPE_INTEGER,
@@ -1417,6 +1435,12 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
        case V4L2_CID_MPEG_VIDEO_VBV_SIZE:
                p->vbv_size = ctrl->val;
                break;
+       case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE:
+               p->mv_h_range = ctrl->val;
+               break;
+       case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE:
+               p->mv_v_range = ctrl->val;
+               break;
        case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
                p->codec.h264.cpb_size = ctrl->val;
                break;
index f6ff2dbf3a1d5d700ad18ab74f4e89be437baf17..f64621ae9b5a563d90a23f855c837d14f30f36fb 100644 (file)
@@ -727,14 +727,10 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)
        WRITEL(reg, S5P_FIMV_E_RC_CONFIG_V6);
 
        /* setting for MV range [16, 256] */
-       reg = 0;
-       reg &= ~(0x3FFF);
-       reg = 256;
+       reg = (p->mv_h_range & S5P_FIMV_E_MV_RANGE_V6_MASK);
        WRITEL(reg, S5P_FIMV_E_MV_HOR_RANGE_V6);
 
-       reg = 0;
-       reg &= ~(0x3FFF);
-       reg = 256;
+       reg = (p->mv_v_range & S5P_FIMV_E_MV_RANGE_V6_MASK);
        WRITEL(reg, S5P_FIMV_E_MV_VER_RANGE_V6);
 
        WRITEL(0x0, S5P_FIMV_E_FRAME_INSERTION_V6);