From patchwork Tue Mar 23 14:58:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 87656 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2NEwEOc032632 for ; Tue, 23 Mar 2010 14:58:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754331Ab0CWO6N (ORCPT ); Tue, 23 Mar 2010 10:58:13 -0400 Received: from mail.gmx.net ([213.165.64.20]:38353 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754288Ab0CWO6M convert rfc822-to-8bit (ORCPT ); Tue, 23 Mar 2010 10:58:12 -0400 Received: (qmail invoked by alias); 23 Mar 2010 14:58:11 -0000 Received: from p57BD1C70.dip0.t-ipconnect.de (EHLO axis700.grange) [87.189.28.112] by mail.gmx.net (mp069) with SMTP; 23 Mar 2010 15:58:11 +0100 X-Authenticated: #20450766 X-Provags-ID: V01U2FsdGVkX1/Ba417/mDBnzEypNeuQqfwTBlh4M2G9ZoibqW0GA SrTi+nQLiMlayM Received: from lyakh (helo=localhost) by axis700.grange with local-esmtp (Exim 4.63) (envelope-from ) id 1Nu5Yj-00024j-Sn; Tue, 23 Mar 2010 15:58:21 +0100 Date: Tue, 23 Mar 2010 15:58:21 +0100 (CET) From: Guennadi Liakhovetski To: Linux Media Mailing List cc: Magnus Damm , "linux-sh@vger.kernel.org" Subject: [PATCH 2/2] sh_mobile_ceu_camera.c: update documentation to reflect the new cropping In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Y-GMX-Trusted: 0 X-FuHaFi: 0.5 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 23 Mar 2010 14:58:14 +0000 (UTC) diff --git a/Documentation/video4linux/sh_mobile_ceu_camera.txt b/Documentation/video4linux/sh_mobile_ceu_camera.txt index 2ae1634..cb47e72 100644 --- a/Documentation/video4linux/sh_mobile_ceu_camera.txt +++ b/Documentation/video4linux/sh_mobile_ceu_camera.txt @@ -17,18 +17,18 @@ Generic scaling / cropping scheme -2-- -\ | --\ | --\ -+-5-- -\ -- -3-- -| ---\ -| --- -4-- -\ -| -\ -| - -6-- ++-5-- . -- -3-- -\ +| `... -\ +| `... -4-- . - -7.. +| `. +| `. .6-- | -| - -6'- -| -/ -| --- -4'- -/ -| ---/ -+-5'- -/ -| -- -3'- +| . .6'- +| .ÂŽ +| ... -4'- .ÂŽ +| ...ÂŽ - -7'. ++-5'- .ÂŽ -/ +| -- -3'- -/ | --/ | --/ -2'- -/ @@ -36,7 +36,11 @@ Generic scaling / cropping scheme | -1'- -Produced by user requests: +In the above chart minuses and slashes represent "real" data amounts, points and +accents represent "useful" data, basically, CEU scaled amd cropped output, +mapped back onto the client's source plane. + +Such a configuration can be produced by user requests: S_CROP(left / top = (5) - (1), width / height = (5') - (5)) S_FMT(width / height = (6') - (6)) @@ -106,52 +110,30 @@ window: S_CROP ------ -If old scale applied to new crop is invalid produce nearest new scale possible - -1. Calculate current combined scales. - - scale_comb = (((4') - (4)) / ((6') - (6))) * (((2') - (2)) / ((3') - (3))) - -2. Apply iterative sensor S_CROP for new input window. - -3. If old combined scales applied to new crop produce an impossible user window, -adjust scales to produce nearest possible window. - - width_u_out = ((5') - (5)) / scale_comb +The API at http://v4l2spec.bytesex.org/spec/x1904.htm says: - if (width_u_out > max) - scale_comb = ((5') - (5)) / max; - else if (width_u_out < min) - scale_comb = ((5') - (5)) / min; +"...specification does not define an origin or units. However by convention +drivers should horizontally count unscaled samples relative to 0H." -4. Issue G_CROP to retrieve actual input window. +We choose to follow the advise and interpret cropping units as client input +pixels. -5. Using actual input window and calculated combined scales calculate sensor -target output window. - - width_s_out = ((3') - (3)) = ((2') - (2)) / scale_comb - -6. Apply iterative S_FMT for new sensor target output window. - -7. Issue G_FMT to retrieve the actual sensor output window. - -8. Calculate sensor scales. - - scale_s = ((3') - (3)) / ((2') - (2)) +Cropping is performed in the following 6 steps: -9. Calculate sensor output subwindow to be cropped on CEU by applying sensor -scales to the requested window. +1. Request exactly user rectangle from the sensor. - width_ceu = ((5') - (5)) / scale_s +2. If smaller - iterate until a larger one is obtained. Result: sensor cropped + to 2 : 2', target crop 5 : 5', current output format 6' - 6. -10. Use CEU cropping for above calculated window. +3. In the previous step the sensor has tried to preserve its output frame as + good as possible, but it could have changed. Retrieve it again. -11. Calculate CEU scales from sensor scales from results of (10) and user window -from (3) +4. Sensor scaled to 3 : 3'. Sensor's scale is (2' - 2) / (3' - 3). Calculate + intermediate window: 4' - 4 = (5' - 5) * (3' - 3) / (2' - 2) - scale_ceu = calc_scale(((5') - (5)), &width_u_out) +5. Calculate and apply host scale = (6' - 6) / (4' - 4) -12. Apply CEU scales. +6. Calculate and apply host crop: 6 - 7 = (5 - 2) * (6' - 6) / (5' - 5) -- Author: Guennadi Liakhovetski