From patchwork Fri Jul 11 15:19:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 4535291 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A58419F392 for ; Fri, 11 Jul 2014 15:29:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA54220204 for ; Fri, 11 Jul 2014 15:29:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF4C82021B for ; Fri, 11 Jul 2014 15:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754465AbaGKPU1 (ORCPT ); Fri, 11 Jul 2014 11:20:27 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:34013 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754437AbaGKPUE (ORCPT ); Fri, 11 Jul 2014 11:20:04 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8J00CHJZXFTOB0@mailout3.samsung.com> for linux-media@vger.kernel.org; Sat, 12 Jul 2014 00:20:03 +0900 (KST) X-AuditID: cbfee61a-f79e46d00000134f-1d-53c000a37142 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 3A.3D.04943.3A000C35; Sat, 12 Jul 2014 00:20:03 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8J00DPYZWYA170@mmp1.samsung.com>; Sat, 12 Jul 2014 00:20:03 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, andrzej.p@samsung.com, Jacek Anaszewski , Kyungmin Park Subject: [PATCH v2 5/9] s5p-jpeg: Assure proper crop rectangle initialization Date: Fri, 11 Jul 2014 17:19:46 +0200 Message-id: <1405091990-28567-6-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1405091990-28567-1-git-send-email-j.anaszewski@samsung.com> References: <1405091990-28567-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNJMWRmVeSWpSXmKPExsVy+t9jAd3FDAeCDeb9trKY9bKdxaL36nNG i7NNb9gtejZsZbU4/Kad1YHVo2/LKkaPz5vkApiiuGxSUnMyy1KL9O0SuDJ+nDjKVNDMXbHi 123GBsapnF2MnBwSAiYSL76fY4OwxSQu3FsPZHNxCAksYpSYsOYnE4TTziTxsPUTWBWbgKHE zxevmUBsEQF5iSe9N8A6mAV6GSXO/fvFApIQFvCVuDT5MVgDi4CqxNItv1lBbF4BD4l7V5Yy djFyAK1TkJgzyQYkzCngKXH2+gqwViGgkh/di9gnMPIuYGRYxSiaWpBcUJyUnmuoV5yYW1ya l66XnJ+7iREcJM+kdjCubLA4xCjAwajEw6uwfl+wEGtiWXFl7iFGCQ5mJRHeq2/2BwvxpiRW VqUW5ccXleakFh9ilOZgURLnPdBqHSgkkJ5YkpqdmlqQWgSTZeLglGpgVHn28NXcrul73lw4 7r/ey8Hy0Bcupv4+s5tfuKuX2bfr+oZpcrwSNG1TEZ1z+7uyxAt/XjcRhT1JIYZ6XFN0srfe ZVgmu3ndLxO/G1s8AjM9tN2U2Dr63zxmWp3POanlTESS6Ya8Y5rJPOLc+Vv53ihzah+ccvPY z16D056lEW+PvLnG6GavxFKckWioxVxUnAgAR7sNfA4CAAA= 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.5 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 Assure proper crop_rect initialization in case the user space doesn't call S_SELECTION ioctl. Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 09b59d3..2491ef8 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1367,6 +1367,21 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f) V4L2_CID_JPEG_CHROMA_SUBSAMPLING); if (ctrl_subs) v4l2_ctrl_s_ctrl(ctrl_subs, q_data->fmt->subsampling); + ct->crop_altered = false; + } + + /* + * For decoding init crop_rect with capture buffer dimmensions which + * contain aligned dimensions of the input JPEG image and do it only + * if crop rectangle hasn't been altered by the user space e.g. with + * S_SELECTION ioctl. For encoding assign output buffer dimensions. + */ + if (!ct->crop_altered && + ((ct->mode == S5P_JPEG_DECODE && f_type == FMT_TYPE_CAPTURE) || + (ct->mode == S5P_JPEG_ENCODE && f_type == FMT_TYPE_OUTPUT))) { + ct->crop_rect.width = pix->width; + ct->crop_rect.height = pix->height; + } } return 0;