1 From 1af1c75a6965dd975d40e904e921d9f07395ffcb Mon Sep 17 00:00:00 2001
2 From: Jacopo Mondi <jacopo@jmondi.org>
3 Date: Sat, 9 May 2020 11:04:45 +0200
4 Subject: [PATCH] media: dt-bindings: video-interface: Replace
7 Replace the 'rotation' property description by providing a definition
8 relative to the camera sensor pixel array coordinate system and the
11 Acked-by: Rob Herring <robh@kernel.org>
12 Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
13 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
14 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
16 Commit 915bd31ce9ed328535e5ecf3ca730c5764ec1a38 upstream
18 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
20 .../bindings/media/video-interfaces.txt | 359 +++++++++++++++++-
21 1 file changed, 356 insertions(+), 3 deletions(-)
23 --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
24 +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
25 @@ -85,9 +85,362 @@ Optional properties
27 - lens-focus: A phandle to the node of the focus lens controller.
29 -- rotation: The device, typically an image sensor, is not mounted upright,
30 - but a number of degrees counter clockwise. Typical values are 0 and 180
32 +- rotation: The camera rotation is expressed as the angular difference in
33 + degrees between two reference systems, one relative to the camera module, and
34 + one defined on the external world scene to be captured when projected on the
35 + image sensor pixel array.
37 + A camera sensor has a 2-dimensional reference system 'Rc' defined by
38 + its pixel array read-out order. The origin is set to the first pixel
39 + being read out, the X-axis points along the column read-out direction
40 + towards the last columns, and the Y-axis along the row read-out
41 + direction towards the last row.
43 + A typical example for a sensor with a 2592x1944 pixel array matrix
44 + observed from the front is:
47 + <------------------------+ 0
48 + .......... ... ..........!
49 + .......... ... ..........! Y-axis
51 + .......... ... ..........!
52 + .......... ... ..........! 1943
55 + The external world scene reference system 'Rs' is a 2-dimensional
56 + reference system on the focal plane of the camera module. The origin is
57 + placed on the top-left corner of the visible scene, the X-axis points
58 + towards the right, and the Y-axis points towards the bottom of the
59 + scene. The top, bottom, left and right directions are intentionally not
60 + defined and depend on the environment in which the camera is used.
62 + A typical example of a (very common) picture of a shark swimming from
63 + left to right, as seen from the camera, is:
66 + 0 +------------------------------------->
79 + with the reference system 'Rs' placed on the camera focal plane:
85 + | (o) | ! Camera focal plane
91 + When projected on the sensor's pixel array, the image and the associated
92 + reference system 'Rs' are typically (but not always) inverted, due to
93 + the camera module's lens optical inversion effect.
95 + Assuming the above represented scene of the swimming shark, the lens
96 + inversion projects the scene and its reference system onto the sensor
97 + pixel array, seen from the front of the camera sensor, as follows:
110 + 0 +------------------------------------->
113 + Note the shark being upside-down.
115 + The resulting projected reference system is named 'Rp'.
117 + The camera rotation property is then defined as the angular difference
118 + in the counter-clockwise direction between the camera reference system
119 + 'Rc' and the projected scene reference system 'Rp'. It is expressed in
120 + degrees as a number in the range [0, 360[.
124 + 0 degrees camera rotation:
138 + ! 0 +------------------------------------->
140 + 0 +------------------------------------->
145 + <------------------------------------+ 0
147 + <------------------------------------+ 0 !
160 + 90 degrees camera rotation:
163 + 0 +-------------------->
175 + ! 0 +------------------------------------->
184 + 180 degrees camera rotation:
187 + <------------------------------------+ 0
199 + 0 +------------------------------------->
202 + 270 degrees camera rotation:
205 + 0 +-------------------->
207 + ! <-----------------------------------+ 0
227 + Example one - Webcam
229 + A camera module installed on the user facing part of a laptop screen
230 + casing used for video calls. The captured images are meant to be
231 + displayed in landscape mode (width > height) on the laptop screen.
233 + The camera is typically mounted upside-down to compensate the lens
234 + optical inversion effect:
246 + ! 0 +------------------------------------->
248 + 0 +------------------------------------->
251 + The two reference systems are aligned, the resulting camera rotation is
252 + 0 degrees, no rotation correction needs to be applied to the resulting
253 + image once captured to memory buffers to correctly display it to users:
255 + +--------------------------------------+
265 + +--------------------------------------+
267 + If the camera sensor is not mounted upside-down to compensate for the
268 + lens optical inversion, the two reference systems will not be aligned,
269 + with 'Rp' being rotated 180 degrees relatively to 'Rc':
273 + <------------------------------------+ 0
285 + 0 +------------------------------------->
288 + The image once captured to memory will then be rotated by 180 degrees:
290 + +--------------------------------------+
300 + +--------------------------------------+
302 + A software rotation correction of 180 degrees should be applied to
303 + correctly display the image:
305 + +--------------------------------------+
315 + +--------------------------------------+
317 + Example two - Phone camera
319 + A camera installed on the back side of a mobile device facing away from
320 + the user. The captured images are meant to be displayed in portrait mode
321 + (height > width) to match the device screen orientation and the device
322 + usage orientation used when taking the picture.
324 + The camera sensor is typically mounted with its pixel array longer side
325 + aligned to the device longer side, upside-down mounted to compensate for
326 + the lens optical inversion effect:
329 + 0 +-------------------->
341 + ! 0 +------------------------------------->
350 + The two reference systems are not aligned and the 'Rp' reference
351 + system is rotated by 90 degrees in the counter-clockwise direction
352 + relatively to the 'Rc' reference system.
354 + The image once captured to memory will be rotated:
356 + +-------------------------------------+
366 + +-------------------------------------+
368 + A correction of 90 degrees in counter-clockwise direction has to be
369 + applied to correctly display the image in portrait mode on the device
372 + +--------------------+
387 + +--------------------+
389 - orientation: The orientation of a device (typically an image sensor or a flash
390 LED) describing its mounting position relative to the usage orientation of the