From patchwork Mon Dec 30 10:43:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Grover X-Patchwork-Id: 3418831 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EFC41C02DD for ; Mon, 30 Dec 2013 10:41:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 29A1320107 for ; Mon, 30 Dec 2013 10:41:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23675200E5 for ; Mon, 30 Dec 2013 10:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754420Ab3L3Kl2 (ORCPT ); Mon, 30 Dec 2013 05:41:28 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:10140 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751491Ab3L3Kl0 (ORCPT ); Mon, 30 Dec 2013 05:41:26 -0500 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MYM003688D00920@mailout3.samsung.com>; Mon, 30 Dec 2013 19:41:24 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 79.FE.09028.4DD41C25; Mon, 30 Dec 2013 19:41:24 +0900 (KST) X-AuditID: cbfee68e-b7f566d000002344-4a-52c14dd47860 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C9.69.29263.4DD41C25; Mon, 30 Dec 2013 19:41:24 +0900 (KST) Received: from user-laptop.sisodomain.com ([107.109.108.128]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MYM00LQM8CNSP40@mmp2.samsung.com>; Mon, 30 Dec 2013 19:41:24 +0900 (KST) From: Amit Grover To: m.chehab@samsung.com, linux-media@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, rob@landley.net, kyungmin.park@samsung.com, k.debski@samsung.com, jtp.park@samsung.com Cc: hans.verkuil@cisco.com, andrew.smirnov@gmail.com, s.nawrocki@samsung.com, arun.kk@samsung.com, anatol.pomozov@gmail.com, jmccrohan@gmail.com, austin.lobo@samsung.com, Swami Nathan Subject: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks Date: Mon, 30 Dec 2013 16:13:06 +0530 Message-id: <1388400186-22045-1-git-send-email-amit.grover@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCIsWRmVeSWpSXmKPExsWyRsSkTveK78Egg8kXtSxe9hZaNHfYWnw8 dZvVYv6nmywWS37uYrLof7Se0eLI2qtMFj9eX2CzONv0ht1i0+NrrBYL25awWFzeNYfNomfD VlaLGef3MVlcXCdvse7ldBaLw2/aWS3auqYyOgh5TPm9kdVj56y77B6vVs9k9di8pN6jb8sq Ro/Pm+QC2KK4bFJSczLLUov07RK4Mnac3MVasNK44saiSUwNjKu1uxg5OSQETCSOT5nMBGGL SVy4t56ti5GDQ0hgKaPESQmYki0ru9lAbCGB6YwSn5ZrQdg9TBLfphSA2GwC2hLbZywHquHi EBGYziRx8PUKMIdZ4CqjxIsjl5lBqoQFkiU2HfkEtoxFQFWiqfEkK4jNK+AuMf/NFhaQxRIC ChJzJtmA9EoIXGOXeHP1DwtEvYDEt8mHoGpkJTYdYIY4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oJBAemJJanZqakFqEcwWJg5OqQbG3pXP 7y+xsuZgVl/r064ladIauiXzYWtg0sOJbr5MfnOid9zhqHZXr/ry/UXI3kMLbuz4/vFAQVbx /T811jlTdU5PlyhY72Arc/W2U5iioUDw1OfPvPL6PP+tctTjWcuidu3N5662/CLZIIf5CRnh 6vdWOaiJL9QzWSqVzffIfHJDxgLruq1KLMUZiYZazEXFiQBsQ2jMBgMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Amit Grover --- Documentation/DocBook/media/v4l/controls.xml | 14 +++++++++++++ drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++ drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 24 +++++++++++++++++++++++ drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 8 ++------ drivers/media/v4l2-core/v4l2-ctrls.c | 14 +++++++++++++ include/uapi/linux/v4l2-controls.h | 2 ++ 6 files changed, 58 insertions(+), 6 deletions(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 7a3b49b..70a0f6f 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -2258,6 +2258,20 @@ Applicable to the MPEG1, MPEG2, MPEG4 encoders. VBV buffer control. + + + V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE  + integer + Sets the Horizontal search range for Video Macro blocks. + + + + + V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE  + integer + Sets the Vertical search range for Video Macro blocks. + + V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE  diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 6920b54..f2c13c3 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -430,6 +430,8 @@ struct s5p_mfc_vp8_enc_params { struct s5p_mfc_enc_params { u16 width; u16 height; + u32 horz_range; + u32 vert_range; u16 gop_size; enum v4l2_mpeg_video_multi_slice_mode slice_mode; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 4ff3b6c..a02e7b8 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -208,6 +208,24 @@ static struct mfc_control controls[] = { .default_value = 0, }, { + .id = V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "horizontal search range of video macro block", + .minimum = 16, + .maximum = 128, + .step = 16, + .default_value = 32, + }, + { + .id = V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "vertical search range of video macro block", + .minimum = 16, + .maximum = 128, + .step = 16, + .default_value = 32, + }, + { .id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE, .type = V4L2_CTRL_TYPE_INTEGER, .minimum = 0, @@ -1377,6 +1395,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_HORZ_SEARCH_RANGE: + p->horz_range = ctrl->val; + break; + case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE: + p->vert_range = ctrl->val; + break; case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE: p->codec.h264.cpb_size = ctrl->val; break; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index 461358c..47e1807 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -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->horz_range & 0x3fff); /* conditional check in app */ WRITEL(reg, S5P_FIMV_E_MV_HOR_RANGE_V6); - reg = 0; - reg &= ~(0x3FFF); - reg = 256; + reg = (p->vert_range & 0x3fff); /* conditional check in app */ WRITEL(reg, S5P_FIMV_E_MV_VER_RANGE_V6); WRITEL(0x0, S5P_FIMV_E_FRAME_INSERTION_V6); diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index fb46790..7cf23d5 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -735,6 +735,8 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_DEC_PTS: return "Video Decoder PTS"; case V4L2_CID_MPEG_VIDEO_DEC_FRAME: return "Video Decoder Frame Count"; case V4L2_CID_MPEG_VIDEO_VBV_DELAY: return "Initial Delay for VBV Control"; + case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE: return "hor search range of video MB"; + case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE: return "vert search range of video MB"; case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER: return "Repeat Sequence Header"; /* VPX controls */ @@ -905,6 +907,18 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, *min = 0; *max = *step = 1; break; + case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE: + *type = V4L2_CTRL_TYPE_INTEGER; + *min = 16; + *max = 128; + *step = 16; + break; + case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE: + *type = V4L2_CTRL_TYPE_INTEGER; + *min = 16; + *max = 128; + *step = 16; + break; case V4L2_CID_PAN_RESET: case V4L2_CID_TILT_RESET: case V4L2_CID_FLASH_STROBE: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 1666aab..bcce536 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -372,6 +372,8 @@ enum v4l2_mpeg_video_multi_slice_mode { #define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224) #define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225) #define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE+226) +#define V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE (V4L2_CID_MPEG_BASE+227) +#define V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)