1 .. SPDX-License-Identifier: GPL-2.0
6 The Vivante DW100 Dewarp Processor IP core found on i.MX8MP SoC applies a
7 programmable geometrical transformation on the input image to correct distortion
10 The transformation function is exposed by the hardware as a grid map with 16x16
11 pixel macroblocks indexed using X, Y vertex coordinates.
15 <--------------------------------------->
17 ^ .-------.-------.-------.-------.-------.
21 a | .-------.-------.-------.-------.-------.
25 h | .-------.-------.-------.-------.-------.
29 h | .-------.-------.-------.-------.-------.
33 v '-------'-------'-------'-------'-------'
35 Grid of Image Blocks for Dewarping Map
38 Each x, y coordinate register uses 16 bits to record the coordinate address in
39 an unsigned 12.4 fixed point format (UQ12.4).
42 .----------------------.--------..----------------------.--------.
43 | 31~20 | 19~16 || 15~4 | 3~0 |
44 | (integer) | (frac) || (integer) | (frac) |
45 '----------------------'--------''----------------------'--------'
46 <-------------------------------><------------------------------->
47 Y coordinate X coordinate
51 The dewarping map is set from applications using the
52 V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP control. The control contains
53 an array of u32 values storing (x, y) destination coordinates for each
54 vertex of the grid. The x coordinate is stored in the 16 LSBs and the y
55 coordinate in the 16 MSBs.
57 The number of elements in the array must match the image size:
61 elems = (DIV_ROUND_UP(width, 16) + 1) * (DIV_ROUND_UP(height, 16) + 1);
63 If the control has not been set by the application, the driver uses an identity
66 More details on the DW100 hardware operations can be found in
67 *chapter 13.15 DeWarp* of IMX8MP_ reference manual.
69 The Vivante DW100 m2m driver implements the following driver-specific control:
71 ``V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP (__u32 array)``
72 Specifies to DW100 driver its dewarping map (aka LUT) blob as described in
73 *chapter 13.15.2.3 Dewarping Remap* of IMX8MP_ reference manual as an U32
74 dynamic array. The image is divided into many small 16x16 blocks. If the
75 width/height of the image is not divisible by 16, the size of the
76 rightmost/bottommost block is the remainder. The dewarping map only saves
77 the vertex coordinates of the block. The dewarping grid map is comprised of
78 vertex coordinates for x and y. Each x, y coordinate register uses 16 bits
79 (UQ12.4) to record the coordinate address, with the Y coordinate in the
80 upper bits and X in the lower bits. The driver modifies the dimensions of
81 this control when the sink format is changed, to reflect the new input
84 .. _IMX8MP: https://www.nxp.com/webapp/Download?colCode=IMX8MPRM