← Documents Documentation/userspace-api/media/drivers/dw100.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / Drivers

DW100 dewarp driver

i.MX8MP DW100의 16×16 grid와 UQ12.4 vertex map control을 설명합니다.

Source pathDocumentation/userspace-api/media/drivers/dw100.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

dw100.rst:1-84

DW100은 16×16 image block의 vertex remap으로 lens distortion을 보정합니다. 각 u32에는 상위 Y와 하위 X UQ12.4 coordinate가 들어가며 sink resolution이 바뀌면 dynamic control array 크기도 갱신됩니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 DW100 dewarp driver
4 ===================
5
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
8 introduced by lenses.
9
10 The transformation function is exposed by the hardware as a grid map with 16x16
11 pixel macroblocks indexed using X, Y vertex coordinates.
12 ::
13
14 Image width
15 <--------------------------------------->
16
17 ^ .-------.-------.-------.-------.-------.
18 | | 16x16 | | | | |
19 I | | pixel | | | | |
20 m | | block | | | | |
21 a | .-------.-------.-------.-------.-------.
22 g | | | | | | |
23 e | | | | | | |
24 | | | | | | |
25 h | .-------.-------.-------.-------.-------.
26 e | | | | | | |
27 i | | | | | | |
28 g | | | | | | |
29 h | .-------.-------.-------.-------.-------.
30 t | | | | | | |
31 | | | | | | |
32 | | | | | | |
33 v '-------'-------'-------'-------'-------'
34
35 Grid of Image Blocks for Dewarping Map
36
37
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).
40 ::
41
42 .----------------------.--------..----------------------.--------.
43 | 31~20 | 19~16 || 15~4 | 3~0 |
44 | (integer) | (frac) || (integer) | (frac) |
45 '----------------------'--------''----------------------'--------'
46 <-------------------------------><------------------------------->
47 Y coordinate X coordinate
48
49 Remap Register Layout
50
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.
56
57 The number of elements in the array must match the image size:
58
59 .. code-block:: C
60
61 elems = (DIV_ROUND_UP(width, 16) + 1) * (DIV_ROUND_UP(height, 16) + 1);
62
63 If the control has not been set by the application, the driver uses an identity
64 map.
65
66 More details on the DW100 hardware operations can be found in
67 *chapter 13.15 DeWarp* of IMX8MP_ reference manual.
68
69 The Vivante DW100 m2m driver implements the following driver-specific control:
70
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
82 resolution.
83
84 .. _IMX8MP: https://www.nxp.com/webapp/Download?colCode=IMX8MPRM
85

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

16×16 dewarping grid

1-37

i.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을 노출합니다.

Dewarping image grid
구성크기·방향의미
가로 축Image width16-pixel block이 왼쪽에서 오른쪽으로 반복
세로 축Image height16-pixel block row가 위에서 아래로 반복
Grid cell16×16 pixels네 모서리 vertex coordinate로 remap
Edge cell나머지 width/height16으로 나누어떨어지지 않으면 remainder

원문의 ASCII grid를 image width·height 방향의 16×16 block 구조로 다시 나타냅니다.

Dewarp grid 적용
Input image를 16×16 block grid로 분할각 grid vertex의 destination X/Y coordinate 조회인접 vertex 사이 geometrical transform 계산각 block pixel remapLens distortion이 보정된 output 생성

각 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입니다.

DW100 remap register layout
BitsFieldUQ12.4 부분
31–20Y integer12 bits
19–16Y fraction4 bits
15–4X integer12 bits
3–0X fraction4 bits

원문의 bit ASCII diagram을 32-bit field 표로 재구성합니다.

UQ12.4 coordinate decode
u32 vertex value 읽기상위 16 bit에서 Y 추출하위 16 bit에서 X 추출각 값의 상위 12 bit integer 해석하위 4 bit를 1/16 fraction으로 해석

상·하위 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를 참고합니다.

Vertex map control
항목설명
ControlV4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP
Elementu32: Y UQ12.4 in MSBs, X UQ12.4 in LSBs
Horizontal verticesDIV_ROUND_UP(width,16)+1
Vertical verticesDIV_ROUND_UP(height,16)+1
DefaultIdentity map

resolution에서 grid vertex array 크기를 계산합니다.

Vertex array 크기 계산
width를 16으로 올림 나눗셈가로 vertex 수에 1 추가height를 16으로 올림 나눗셈세로 vertex 수에 1 추가두 vertex 수를 곱해 elems 산출

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-84

Vivante 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을 변경합니다.

DW100 control 갱신
항목설명
Sink format unchanged현재 vertex array dimension 유지
Sink width/height 변경16×16 block 수 재계산
Control dimension새 vertex count로 변경
Application payload새 dimension에 맞는 U32 LUT blob

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