요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
DW100 dewarp driver
===================
The Vivante DW100 Dewarp Processor IP core found on i.MX8MP SoC applies a
programmable geometrical transformation on the input image to correct distortion
introduced by lenses.
The transformation function is exposed by the hardware as a grid map with 16x16
pixel macroblocks indexed using X, Y vertex coordinates.
::
Image width
<--------------------------------------->
^ .-------.-------.-------.-------.-------.
| | 16x16 | | | | |
I | | pixel | | | | |
m | | block | | | | |
a | .-------.-------.-------.-------.-------.
g | | | | | | |
e | | | | | | |
| | | | | | |
h | .-------.-------.-------.-------.-------.
e | | | | | | |
i | | | | | | |
g | | | | | | |
h | .-------.-------.-------.-------.-------.
t | | | | | | |
| | | | | | |
| | | | | | |
v '-------'-------'-------'-------'-------'
Grid of Image Blocks for Dewarping Map
Each x, y coordinate register uses 16 bits to record the coordinate address in
an unsigned 12.4 fixed point format (UQ12.4).
::
.----------------------.--------..----------------------.--------.
| 31~20 | 19~16 || 15~4 | 3~0 |
| (integer) | (frac) || (integer) | (frac) |
'----------------------'--------''----------------------'--------'
<-------------------------------><------------------------------->
Y coordinate X coordinate
Remap Register Layout
The dewarping map is set from applications using the
V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP control. The control contains
an array of u32 values storing (x, y) destination coordinates for each
vertex of the grid. The x coordinate is stored in the 16 LSBs and the y
coordinate in the 16 MSBs.
The number of elements in the array must match the image size:
.. code-block:: C
elems = (DIV_ROUND_UP(width, 16) + 1) * (DIV_ROUND_UP(height, 16) + 1);
If the control has not been set by the application, the driver uses an identity
map.
More details on the DW100 hardware operations can be found in
*chapter 13.15 DeWarp* of IMX8MP_ reference manual.
The Vivante DW100 m2m driver implements the following driver-specific control:
``V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP (__u32 array)``
Specifies to DW100 driver its dewarping map (aka LUT) blob as described in
*chapter 13.15.2.3 Dewarping Remap* of IMX8MP_ reference manual as an U32
dynamic array. The image is divided into many small 16x16 blocks. If the
width/height of the image is not divisible by 16, the size of the
rightmost/bottommost block is the remainder. The dewarping map only saves
the vertex coordinates of the block. The dewarping grid map is comprised of
vertex coordinates for x and y. Each x, y coordinate register uses 16 bits
(UQ12.4) to record the coordinate address, with the Y coordinate in the
upper bits and X in the lower bits. The driver modifies the dimensions of
this control when the sink format is changed, to reflect the new input
resolution.
.. _IMX8MP: https://www.nxp.com/webapp/Download?colCode=IMX8MPRM
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
16×16 dewarping grid
1-37i.MX8MP SoC의 Vivante DW100 Dewarp Processor IP core는 input image에 programmable geometrical transformation을 적용해 lens distortion을 보정합니다.
hardware는 X, Y vertex coordinate로 index되는 16×16 pixel macroblock grid map으로 transformation function을 노출합니다.
원문의 ASCII grid를 image width·height 방향의 16×16 block 구조로 다시 나타냅니다.
각 output grid vertex가 source coordinate를 지정합니다.
.. SPDX-License-Identifier: GPL-2.0
DW100 dewarp driver
===================
The Vivante DW100 Dewarp Processor IP core found on i.MX8MP SoC applies a
programmable geometrical transformation on the input image to correct distortion
introduced by lenses.
The transformation function is exposed by the hardware as a grid map with 16x16
pixel macroblocks indexed using X, Y vertex coordinates.
::
Image width
<--------------------------------------->
^ .-------.-------.-------.-------.-------.
| | 16x16 | | | | |
I | | pixel | | | | |
m | | block | | | | |
a | .-------.-------.-------.-------.-------.
g | | | | | | |
e | | | | | | |
| | | | | | |
h | .-------.-------.-------.-------.-------.
e | | | | | | |
i | | | | | | |
g | | | | | | |
h | .-------.-------.-------.-------.-------.
t | | | | | | |
| | | | | | |
| | | | | | |
v '-------'-------'-------'-------'-------'
Grid of Image Blocks for Dewarping Map
UQ12.4 remap register
38-50각 X와 Y coordinate는 16-bit unsigned 12.4 fixed-point format, 즉 UQ12.4로 coordinate address를 기록합니다.
하나의 32-bit remap value에서 bits 15–0이 X, bits 31–16이 Y입니다. 각 half의 bits 15–4는 integer 12 bit, bits 3–0은 fractional 4 bit입니다.
원문의 bit ASCII diagram을 32-bit field 표로 재구성합니다.
상·하위 16 bit를 분리해 integer와 fraction을 얻습니다.
Each x, y coordinate register uses 16 bits to record the coordinate address in
an unsigned 12.4 fixed point format (UQ12.4).
::
.----------------------.--------..----------------------.--------.
| 31~20 | 19~16 || 15~4 | 3~0 |
| (integer) | (frac) || (integer) | (frac) |
'----------------------'--------''----------------------'--------'
<-------------------------------><------------------------------->
Y coordinate X coordinate
Remap Register Layout
Vertex map control과 element 수
51-68응용 프로그램은 `V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP` control로 dewarping map을 설정합니다. control은 각 grid vertex의 `(x, y)` destination coordinate를 저장하는 `u32` array입니다.
각 element의 16 LSB에 X coordinate, 16 MSB에 Y coordinate가 들어갑니다.
array element 수는 `elems = (DIV_ROUND_UP(width, 16) + 1) * (DIV_ROUND_UP(height, 16) + 1)`로 image size에 맞아야 합니다. block 수보다 vertex가 한 개 더 필요하므로 각 축에 1을 더합니다.
응용 프로그램이 control을 설정하지 않으면 driver는 identity map을 사용합니다. 자세한 hardware 동작은 i.MX8MP reference manual chapter 13.15 DeWarp를 참고합니다.
resolution에서 grid vertex array 크기를 계산합니다.
ceil block count에 경계 vertex 한 개를 더합니다.
The dewarping map is set from applications using the
V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP control. The control contains
an array of u32 values storing (x, y) destination coordinates for each
vertex of the grid. The x coordinate is stored in the 16 LSBs and the y
coordinate in the 16 MSBs.
The number of elements in the array must match the image size:
.. code-block:: C
elems = (DIV_ROUND_UP(width, 16) + 1) * (DIV_ROUND_UP(height, 16) + 1);
If the control has not been set by the application, the driver uses an identity
map.
More details on the DW100 hardware operations can be found in
*chapter 13.15 DeWarp* of IMX8MP_ reference manual.
Driver-specific dynamic array
69-84Vivante DW100 memory-to-memory driver는 `V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP` driver-specific control을 `__u32` dynamic array로 구현합니다. 이 blob은 reference manual chapter 13.15.2.3 Dewarping Remap의 LUT입니다.
image를 16×16 block으로 나누며 width나 height가 16의 배수가 아니면 가장 오른쪽 또는 아래 block 크기는 remainder가 됩니다.
map은 block 내부 pixel 전체가 아니라 block vertex의 X, Y coordinate만 저장합니다. 각 coordinate는 16-bit UQ12.4이고 Y는 상위, X는 하위 bit에 배치됩니다.
sink format이 바뀌면 driver는 새 input resolution을 반영하도록 이 control의 dimension을 변경합니다.
sink resolution과 dynamic array dimension이 함께 움직입니다.
The Vivante DW100 m2m driver implements the following driver-specific control:
``V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP (__u32 array)``
Specifies to DW100 driver its dewarping map (aka LUT) blob as described in
*chapter 13.15.2.3 Dewarping Remap* of IMX8MP_ reference manual as an U32
dynamic array. The image is divided into many small 16x16 blocks. If the
width/height of the image is not divisible by 16, the size of the
rightmost/bottommost block is the remainder. The dewarping map only saves
the vertex coordinates of the block. The dewarping grid map is comprised of
vertex coordinates for x and y. Each x, y coordinate register uses 16 bits
(UQ12.4) to record the coordinate address, with the Y coordinate in the
upper bits and X in the lower bits. The driver modifies the dimensions of
this control when the sink format is changed, to reflect the new input
resolution.
.. _IMX8MP: https://www.nxp.com/webapp/Download?colCode=IMX8MPRM
요약·해설
dw100.rst:1-84DW100은 16×16 image block의 vertex remap으로 lens distortion을 보정합니다. 각 u32에는 상위 Y와 하위 X UQ12.4 coordinate가 들어가며 sink resolution이 바뀌면 dynamic control array 크기도 갱신됩니다.