From patchwork Fri Jun 7 11:25:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 2686461 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9067B3FC23 for ; Fri, 7 Jun 2013 11:25:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755412Ab3FGLZz (ORCPT ); Fri, 7 Jun 2013 07:25:55 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:62953 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755159Ab3FGLZz (ORCPT ); Fri, 7 Jun 2013 07:25:55 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MO000L8LT2XZ5A0@mailout1.w1.samsung.com> for linux-media@vger.kernel.org; Fri, 07 Jun 2013 12:25:53 +0100 (BST) X-AuditID: cbfec7f5-b7f376d000001ec6-65-51b1c341ca93 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 13.62.07878.143C1B15; Fri, 07 Jun 2013 12:25:53 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MO000CRNT2SW8B0@eusync3.samsung.com>; Fri, 07 Jun 2013 12:25:53 +0100 (BST) From: Andrzej Hajda To: linux-media@vger.kernel.org Cc: Sylwester Nawrocki , Kyungmin Park , Seung-Woo Kim , Sakari Ailus , HyungJun Choi , Andrzej Hajda Subject: [PATCH 1/2] V4L: Add auto focus selection targets Date: Fri, 07 Jun 2013 13:25:21 +0200 Message-id: <1370604322-15476-2-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.8.1.2 In-reply-to: <1370604322-15476-1-git-send-email-a.hajda@samsung.com> References: <1370604322-15476-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNJMWRmVeSWpSXmKPExsVy+t/xq7qOhzcGGlxawmZxa905VovHG68x W5xtesNu0bNhK6vF4TftrBZn9q9ks5gx+SWbA7vH4a8LWTz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoErY82mpcwFnRYV0zsnMDcwTtXrYuTkkBAwkXjZsYkFwhaTuHBvPVsXIxeHkMBSRokZ c0+wQDh9TBJn5p5kBaliE9CU+Lv5JhuILSIgL/Gk9waYzSzwk1Hi0wtREFtYwEpiyaLDQHEO DhYBVYnpk0xAwrwCzhI9V6ezQSxTkPh5+QSYzSngInGq4SMziC0EVPNp7k3GCYy8CxgZVjGK ppYmFxQnpeca6RUn5haX5qXrJefnbmKEBNDXHYxLj1kdYhTgYFTi4V24YkOgEGtiWXFl7iFG CQ5mJRHexk0bA4V4UxIrq1KL8uOLSnNSiw8xMnFwSjUwitrnZ638xH5WhGfC7/Cf7B8V7n75 uMbLmPnhIXGet8Y8P/gFuS7r7V10xXcyb4vPJrdv6kbFf8/5K17qKXk832fankV8vgnzpnYW 2Nx5M1d4JeuebNtUCX7ZqozgXVuVprUIe1UzLz22Ojvf+5bB8XIOrRnF8h/n7b6y+KVrqtF0 Kc3arVvLlFiKMxINtZiLihMBBIsTWP4BAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Sylwester Nawrocki The camera automatic focus algorithms may require setting up a spot or rectangle coordinates. The automatic focus selection targets are introduced in order to allow applications to query and set such coordinates. Those selections are intended to be used together with the automatic focus controls available in the camera control class. Signed-off-by: Sylwester Nawrocki Signed-off-by: Andrzej Hajda Signed-off-by: Kyungmin Park --- v2: - corrected description of the selection API, - selection changes are applied only by (re-)starting AF, - changed V4L2_SEL_TGT_AUTO_FOCUS* to 0x100* --- Documentation/DocBook/media/v4l/selection-api.xml | 31 +++++++++++++++++- .../DocBook/media/v4l/selections-common.xml | 37 ++++++++++++++++++++++ .../media/v4l/vidioc-subdev-g-selection.xml | 9 +++--- include/uapi/linux/v4l2-common.h | 5 +++ 4 files changed, 77 insertions(+), 5 deletions(-) diff --git a/Documentation/DocBook/media/v4l/selection-api.xml b/Documentation/DocBook/media/v4l/selection-api.xml index 4c238ce..9c19a03 100644 --- a/Documentation/DocBook/media/v4l/selection-api.xml +++ b/Documentation/DocBook/media/v4l/selection-api.xml @@ -1,6 +1,6 @@
- Experimental API for cropping, composing and scaling + Selection API Experimental @@ -9,6 +9,10 @@ interface and may change in the future. +
+ + Image cropping, composing and scaling +
Introduction @@ -321,5 +325,30 @@ V4L2_BUF_TYPE_VIDEO_OUTPUT for other devices
+
+ +
+ Automatic focus regions of interest + +The camera automatic focus algorithms may require configuration of +regions of interest in form of rectangle or spot coordinates. The automatic +focus selection targets allow applications to query and set such coordinates. +Those selections are intended to be used together with the +V4L2_CID_AUTO_FOCUS_AREA +camera class control. The V4L2_SEL_TGT_AUTO_FOCUS +target is used for querying or setting actual spot or rectangle coordinates, +while V4L2_SEL_TGT_AUTO_FOCUS_BOUNDS target determines +bounds for a single spot or rectangle. These selections are only effective when +the V4L2_CID_AUTO_FOCUS_AREA control is set to +V4L2_AUTO_FOCUS_AREA_RECTANGLE. The new coordinates shall +be applied to the hardware only by (re-)starting autofocus process +(V4L2_CID_AUTO_FOCUS_START) or starting continuous +autofocus (V4L2_CID_FOCUS_AUTO). + +When the width and +height of the selection rectangle are set to 0 the +selection determines spot coordinates, rather than a rectangle. + +
diff --git a/Documentation/DocBook/media/v4l/selections-common.xml b/Documentation/DocBook/media/v4l/selections-common.xml index 7502f78..9f0c477 100644 --- a/Documentation/DocBook/media/v4l/selections-common.xml +++ b/Documentation/DocBook/media/v4l/selections-common.xml @@ -93,6 +93,22 @@ Yes No + + V4L2_SEL_TGT_AUTO_FOCUS + 0x1001 + Actual automatic focus rectangle. + Yes + Yes + + + V4L2_SEL_TGT_AUTO_FOCUS_BOUNDS + 0x1002 + Bounds of the automatic focus region of interest. All valid + automatic focus rectangles fit inside the automatic focus bounds + rectangle. + Yes + Yes + @@ -158,7 +174,28 @@ + + +
+ Automatic focus regions of interest + + The camera automatic focus algorithms may require configuration + of a region or multiple regions of interest in form of rectangle or spot + coordinates. + + A single rectangle of interest is represented in &v4l2-rect; + by the coordinates of the top left corner and the rectangle size. Both + the coordinates and sizes are expressed in pixels. When the + width and height fields of + &v4l2-rect; are set to 0 the selection determines spot coordinates, + rather than a rectangle. + Auto focus rectangles are reset to their default values when the + output image format is modified. Drivers should use the output image size + as the auto focus rectangle default value, but hardware requirements may + prevent this. + + The auto focus selections on input pads are not defined.
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml index 1ba9e99..efbdb3f 100644 --- a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml @@ -55,10 +55,11 @@ interface and may change in the future. - The selections are used to configure various image - processing functionality performed by the subdevs which affect the - image size. This currently includes cropping, scaling and - composition. + The selections are used to configure various image processing + functionality performed by the subdevs which requires passing image + area coordinates between a driver and an application. + This currently includes cropping, scaling, composition + and automatic focus regions of interest. The selection API replaces the old subdev crop API. All diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h index 4f0667e..6db81a2 100644 --- a/include/uapi/linux/v4l2-common.h +++ b/include/uapi/linux/v4l2-common.h @@ -50,6 +50,11 @@ /* Current composing area plus all padding pixels */ #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 +/* Auto focus region of interest */ +#define V4L2_SEL_TGT_AUTO_FOCUS 0x1001 +/* Auto focus region bounds */ +#define V4L2_SEL_TGT_AUTO_FOCUS_BOUNDS 0x1002 + /* Backward compatibility target definitions --- to be removed. */ #define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP #define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE