요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
=========================
i.MX Video Capture Driver
=========================
Events
======
.. _imx_api_ipuX_csiY:
ipuX_csiY
---------
This subdev can generate the following event when enabling the second
IDMAC source pad:
- V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR
The user application can subscribe to this event from the ipuX_csiY
subdev node. This event is generated by the Frame Interval Monitor
(see below for more on the FIM).
Controls
========
.. _imx_api_FIM:
Frame Interval Monitor in ipuX_csiY
-----------------------------------
The adv718x decoders can occasionally send corrupt fields during
NTSC/PAL signal re-sync (too little or too many video lines). When
this happens, the IPU triggers a mechanism to re-establish vertical
sync by adding 1 dummy line every frame, which causes a rolling effect
from image to image, and can last a long time before a stable image is
recovered. Or sometimes the mechanism doesn't work at all, causing a
permanent split image (one frame contains lines from two consecutive
captured images).
From experiment it was found that during image rolling, the frame
intervals (elapsed time between two EOF's) drop below the nominal
value for the current standard, by about one frame time (60 usec),
and remain at that value until rolling stops.
While the reason for this observation isn't known (the IPU dummy
line mechanism should show an increase in the intervals by 1 line
time every frame, not a fixed value), we can use it to detect the
corrupt fields using a frame interval monitor. If the FIM detects a
bad frame interval, the ipuX_csiY subdev will send the event
V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR. Userland can register with
the FIM event notification on the ipuX_csiY subdev device node.
Userland can issue a streaming restart when this event is received
to correct the rolling/split image.
The ipuX_csiY subdev includes custom controls to tweak some dials for
FIM. If one of these controls is changed during streaming, the FIM will
be reset and will continue at the new settings.
- V4L2_CID_IMX_FIM_ENABLE
Enable/disable the FIM.
- V4L2_CID_IMX_FIM_NUM
How many frame interval measurements to average before comparing against
the nominal frame interval reported by the sensor. This can reduce noise
caused by interrupt latency.
- V4L2_CID_IMX_FIM_TOLERANCE_MIN
If the averaged intervals fall outside nominal by this amount, in
microseconds, the V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR event is sent.
- V4L2_CID_IMX_FIM_TOLERANCE_MAX
If any intervals are higher than this value, those samples are
discarded and do not enter into the average. This can be used to
discard really high interval errors that might be due to interrupt
latency from high system load.
- V4L2_CID_IMX_FIM_NUM_SKIP
How many frames to skip after a FIM reset or stream restart before
FIM begins to average intervals.
- V4L2_CID_IMX_FIM_ICAP_CHANNEL / V4L2_CID_IMX_FIM_ICAP_EDGE
These controls will configure an input capture channel as the method
for measuring frame intervals. This is superior to the default method
of measuring frame intervals via EOF interrupt, since it is not subject
to uncertainty errors introduced by interrupt latency.
Input capture requires hardware support. A VSYNC signal must be routed
to one of the i.MX6 input capture channel pads.
V4L2_CID_IMX_FIM_ICAP_CHANNEL configures which i.MX6 input capture
channel to use. This must be 0 or 1.
V4L2_CID_IMX_FIM_ICAP_EDGE configures which signal edge will trigger
input capture events. By default the input capture method is disabled
with a value of IRQ_TYPE_NONE. Set this control to IRQ_TYPE_EDGE_RISING,
IRQ_TYPE_EDGE_FALLING, or IRQ_TYPE_EDGE_BOTH to enable input capture,
triggered on the given signal edge(s).
When input capture is disabled, frame intervals will be measured via
EOF interrupt.
File list
---------
drivers/staging/media/imx/
include/media/imx.h
include/linux/imx-media.h
Authors
-------
- Steve Longerbeam <[email protected]>
- Philipp Zabel <[email protected]>
- Russell King <[email protected]>
Copyright (C) 2012-2017 Mentor Graphics Inc.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
ipuX_csiY event
1-23i.MX Video Capture Driver의 `ipuX_csiY` sub-device는 두 번째 IDMAC source pad를 enable할 때 `V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR` event를 생성할 수 있습니다.
userspace 응용 프로그램은 `ipuX_csiY` sub-device node에서 이 event를 subscribe합니다. event는 아래에 설명하는 Frame Interval Monitor(FIM)가 생성합니다.
event source와 userspace 구독 지점을 구분합니다.
.. SPDX-License-Identifier: GPL-2.0
=========================
i.MX Video Capture Driver
=========================
Events
======
.. _imx_api_ipuX_csiY:
ipuX_csiY
---------
This subdev can generate the following event when enabling the second
IDMAC source pad:
- V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR
The user application can subscribe to this event from the ipuX_csiY
subdev node. This event is generated by the Frame Interval Monitor
(see below for more on the FIM).
Frame Interval Monitor와 복구
24-59adv718x decoder는 NTSC/PAL signal을 다시 동기화할 때 video line이 너무 적거나 많은 corrupt field를 가끔 보낼 수 있습니다.
이때 IPU는 매 frame에 dummy line 하나를 추가해 vertical sync를 복구하려 합니다. 이 과정은 image가 frame마다 굴러가는 rolling effect를 만들고 안정된 image까지 오래 걸릴 수 있습니다. mechanism이 전혀 동작하지 않으면 두 연속 capture image의 line이 한 frame에 섞인 permanent split image가 생길 수 있습니다.
실험상 rolling 동안 두 EOF 사이 elapsed time인 frame interval은 current standard의 nominal value보다 frame time 하나, 약 60 μs만큼 낮아지고 rolling이 멈출 때까지 그 값에 머뭅니다.
dummy-line mechanism이라면 매 frame interval이 line time 하나씩 늘어야 하고 고정 감소가 관찰되는 이유는 알려져 있지 않지만, FIM은 이 현상을 이용해 corrupt field를 검출합니다.
bad frame interval을 검출하면 `ipuX_csiY`가 `V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR`를 보냅니다. userspace는 event를 받은 뒤 streaming을 restart해 rolling 또는 split image를 바로잡을 수 있습니다.
`ipuX_csiY`는 FIM을 조정하는 custom control을 제공합니다. streaming 중 control을 바꾸면 FIM이 reset되고 새 설정으로 계속 동작합니다.
비정상 interval을 event와 stream restart로 복구합니다.
문서의 실험 관찰과 예상 mechanism을 함께 보존합니다.
Controls
========
.. _imx_api_FIM:
Frame Interval Monitor in ipuX_csiY
-----------------------------------
The adv718x decoders can occasionally send corrupt fields during
NTSC/PAL signal re-sync (too little or too many video lines). When
this happens, the IPU triggers a mechanism to re-establish vertical
sync by adding 1 dummy line every frame, which causes a rolling effect
from image to image, and can last a long time before a stable image is
recovered. Or sometimes the mechanism doesn't work at all, causing a
permanent split image (one frame contains lines from two consecutive
captured images).
From experiment it was found that during image rolling, the frame
intervals (elapsed time between two EOF's) drop below the nominal
value for the current standard, by about one frame time (60 usec),
and remain at that value until rolling stops.
While the reason for this observation isn't known (the IPU dummy
line mechanism should show an increase in the intervals by 1 line
time every frame, not a fixed value), we can use it to detect the
corrupt fields using a frame interval monitor. If the FIM detects a
bad frame interval, the ipuX_csiY subdev will send the event
V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR. Userland can register with
the FIM event notification on the ipuX_csiY subdev device node.
Userland can issue a streaming restart when this event is received
to correct the rolling/split image.
The ipuX_csiY subdev includes custom controls to tweak some dials for
FIM. If one of these controls is changed during streaming, the FIM will
be reset and will continue at the new settings.
FIM control
60-86`V4L2_CID_IMX_FIM_ENABLE`은 FIM을 enable 또는 disable합니다.
`V4L2_CID_IMX_FIM_NUM`은 sensor가 보고한 nominal interval과 비교하기 전에 평균할 frame interval 측정 수입니다. 여러 sample 평균으로 interrupt latency가 만든 noise를 줄입니다.
`V4L2_CID_IMX_FIM_TOLERANCE_MIN`은 평균 interval이 nominal에서 이 microsecond 값만큼 벗어났을 때 frame-interval error event를 보내는 threshold입니다.
`V4L2_CID_IMX_FIM_TOLERANCE_MAX`보다 큰 개별 interval은 평균에서 버립니다. 높은 system load의 interrupt latency가 만든 매우 큰 오류 sample을 제거하는 데 사용합니다.
`V4L2_CID_IMX_FIM_NUM_SKIP`은 FIM reset 또는 stream restart 뒤 interval 평균을 시작하기 전에 건너뛸 frame 수입니다.
enable, averaging, threshold, outlier와 warm-up을 각각 제어합니다.
outlier를 제거하고 평균을 nominal tolerance와 비교합니다.
- V4L2_CID_IMX_FIM_ENABLE
Enable/disable the FIM.
- V4L2_CID_IMX_FIM_NUM
How many frame interval measurements to average before comparing against
the nominal frame interval reported by the sensor. This can reduce noise
caused by interrupt latency.
- V4L2_CID_IMX_FIM_TOLERANCE_MIN
If the averaged intervals fall outside nominal by this amount, in
microseconds, the V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR event is sent.
- V4L2_CID_IMX_FIM_TOLERANCE_MAX
If any intervals are higher than this value, those samples are
discarded and do not enter into the average. This can be used to
discard really high interval errors that might be due to interrupt
latency from high system load.
- V4L2_CID_IMX_FIM_NUM_SKIP
How many frames to skip after a FIM reset or stream restart before
FIM begins to average intervals.
Input capture와 EOF 측정
87-109`V4L2_CID_IMX_FIM_ICAP_CHANNEL`과 `V4L2_CID_IMX_FIM_ICAP_EDGE`는 frame interval 측정에 사용할 input capture channel을 구성합니다.
input capture는 EOF interrupt 방식과 달리 interrupt latency가 불확실성을 더하지 않아 더 정확합니다. hardware 지원이 필요하고 VSYNC signal을 i.MX6 input capture channel pad 중 하나로 route해야 합니다.
`V4L2_CID_IMX_FIM_ICAP_CHANNEL`은 channel 0 또는 1을 선택합니다.
`V4L2_CID_IMX_FIM_ICAP_EDGE`는 capture event를 trigger할 signal edge를 정합니다. 기본값 `IRQ_TYPE_NONE`은 input capture를 disable합니다. `IRQ_TYPE_EDGE_RISING`, `IRQ_TYPE_EDGE_FALLING`, `IRQ_TYPE_EDGE_BOTH`로 해당 edge를 enable합니다.
input capture가 disabled이면 EOF interrupt로 frame interval을 측정합니다.
channel과 trigger edge가 hardware timestamp path를 선택합니다.
input capture가 enable됐는지에 따라 timestamp source가 달라집니다.
- V4L2_CID_IMX_FIM_ICAP_CHANNEL / V4L2_CID_IMX_FIM_ICAP_EDGE
These controls will configure an input capture channel as the method
for measuring frame intervals. This is superior to the default method
of measuring frame intervals via EOF interrupt, since it is not subject
to uncertainty errors introduced by interrupt latency.
Input capture requires hardware support. A VSYNC signal must be routed
to one of the i.MX6 input capture channel pads.
V4L2_CID_IMX_FIM_ICAP_CHANNEL configures which i.MX6 input capture
channel to use. This must be 0 or 1.
V4L2_CID_IMX_FIM_ICAP_EDGE configures which signal edge will trigger
input capture events. By default the input capture method is disabled
with a value of IRQ_TYPE_NONE. Set this control to IRQ_TYPE_EDGE_RISING,
IRQ_TYPE_EDGE_FALLING, or IRQ_TYPE_EDGE_BOTH to enable input capture,
triggered on the given signal edge(s).
When input capture is disabled, frame intervals will be measured via
EOF interrupt.
Source file과 저자
110-125관련 source path는 `drivers/staging/media/imx/`, `include/media/imx.h`, `include/linux/imx-media.h`입니다.
저자는 Steve Longerbeam, Philipp Zabel, Russell King이며 Copyright 2012–2017 Mentor Graphics Inc.입니다.
driver implementation과 public header 위치를 보존합니다.
File list
---------
drivers/staging/media/imx/
include/media/imx.h
include/linux/imx-media.h
Authors
-------
- Steve Longerbeam <[email protected]>
- Philipp Zabel <[email protected]>
- Russell King <[email protected]>
Copyright (C) 2012-2017 Mentor Graphics Inc.
요약·해설
imx-uapi.rst:1-125i.MX FIM은 corrupt NTSC/PAL field가 만든 frame rolling·split image를 interval 이상으로 검출합니다. userspace는 event 뒤 stream을 재시작하며 input capture를 사용하면 EOF interrupt latency 없이 더 정확히 측정할 수 있습니다.