요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
The Virtual Video Test Driver (vivid)
=====================================
This driver emulates video4linux hardware of various types: video capture, video
output, vbi capture and output, metadata capture and output, radio receivers and
transmitters, touch capture and a software defined radio receiver. In addition a
simple framebuffer device is available for testing capture and output overlays.
Up to 64 vivid instances can be created, each with up to 16 inputs and 16 outputs.
Each input can be a webcam, TV capture device, S-Video capture device or an HDMI
capture device. Each output can be an S-Video output device or an HDMI output
device.
These inputs and outputs act exactly as a real hardware device would behave. This
allows you to use this driver as a test input for application development, since
you can test the various features without requiring special hardware.
This document describes the features implemented by this driver:
- Support for read()/write(), MMAP, USERPTR and DMABUF streaming I/O.
- A large list of test patterns and variations thereof
- Working brightness, contrast, saturation and hue controls
- Support for the alpha color component
- Full colorspace support, including limited/full RGB range
- All possible control types are present
- Support for various pixel aspect ratios and video aspect ratios
- Error injection to test what happens if errors occur
- Supports crop/compose/scale in any combination for both input and output
- Can emulate up to 4K resolutions
- All Field settings are supported for testing interlaced capturing
- Supports all standard YUV and RGB formats, including two multiplanar YUV formats
- Raw and Sliced VBI capture and output support
- Radio receiver and transmitter support, including RDS support
- Software defined radio (SDR) support
- Capture and output overlay support
- Metadata capture and output support
- Touch capture support
These features will be described in more detail below.
Configuring the driver
----------------------
By default the driver will create a single instance that has a video capture
device with webcam, TV, S-Video and HDMI inputs, a video output device with
S-Video and HDMI outputs, one vbi capture device, one vbi output device, one
radio receiver device, one radio transmitter device and one SDR device.
The number of instances, devices, video inputs and outputs and their types are
all configurable using the following module options:
- n_devs:
number of driver instances to create. By default set to 1. Up to 64
instances can be created.
- node_types:
which devices should each driver instance create. An array of
hexadecimal values, one for each instance. The default is 0xe1d3d.
Each value is a bitmask with the following meaning:
- bit 0: Video Capture node
- bit 2-3: VBI Capture node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both
- bit 4: Radio Receiver node
- bit 5: Software Defined Radio Receiver node
- bit 8: Video Output node
- bit 10-11: VBI Output node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both
- bit 12: Radio Transmitter node
- bit 16: Framebuffer for testing overlays
- bit 17: Metadata Capture node
- bit 18: Metadata Output node
- bit 19: Touch Capture node
So to create four instances, the first two with just one video capture
device, the second two with just one video output device you would pass
these module options to vivid:
.. code-block:: none
n_devs=4 node_types=0x1,0x1,0x100,0x100
- num_inputs:
the number of inputs, one for each instance. By default 4 inputs
are created for each video capture device. At most 16 inputs can be created,
and there must be at least one.
- input_types:
the input types for each instance, the default is 0xe4. This defines
what the type of each input is when the inputs are created for each driver
instance. This is a hexadecimal value with up to 16 pairs of bits, each
pair gives the type and bits 0-1 map to input 0, bits 2-3 map to input 1,
30-31 map to input 15. Each pair of bits has the following meaning:
- 00: this is a webcam input
- 01: this is a TV tuner input
- 10: this is an S-Video input
- 11: this is an HDMI input
So to create a video capture device with 8 inputs where input 0 is a TV
tuner, inputs 1-3 are S-Video inputs and inputs 4-7 are HDMI inputs you
would use the following module options:
.. code-block:: none
num_inputs=8 input_types=0xffa9
- num_outputs:
the number of outputs, one for each instance. By default 2 outputs
are created for each video output device. At most 16 outputs can be
created, and there must be at least one.
- output_types:
the output types for each instance, the default is 0x02. This defines
what the type of each output is when the outputs are created for each
driver instance. This is a hexadecimal value with up to 16 bits, each bit
gives the type and bit 0 maps to output 0, bit 1 maps to output 1, bit
15 maps to output 15. The meaning of each bit is as follows:
- 0: this is an S-Video output
- 1: this is an HDMI output
So to create a video output device with 8 outputs where outputs 0-3 are
S-Video outputs and outputs 4-7 are HDMI outputs you would use the
following module options:
.. code-block:: none
num_outputs=8 output_types=0xf0
- vid_cap_nr:
give the desired videoX start number for each video capture device.
The default is -1 which will just take the first free number. This allows
you to map capture video nodes to specific videoX device nodes. Example:
.. code-block:: none
n_devs=4 vid_cap_nr=2,4,6,8
This will attempt to assign /dev/video2 for the video capture device of
the first vivid instance, video4 for the next up to video8 for the last
instance. If it can't succeed, then it will just take the next free
number.
- vid_out_nr:
give the desired videoX start number for each video output device.
The default is -1 which will just take the first free number.
- vbi_cap_nr:
give the desired vbiX start number for each vbi capture device.
The default is -1 which will just take the first free number.
- vbi_out_nr:
give the desired vbiX start number for each vbi output device.
The default is -1 which will just take the first free number.
- radio_rx_nr:
give the desired radioX start number for each radio receiver device.
The default is -1 which will just take the first free number.
- radio_tx_nr:
give the desired radioX start number for each radio transmitter
device. The default is -1 which will just take the first free number.
- sdr_cap_nr:
give the desired swradioX start number for each SDR capture device.
The default is -1 which will just take the first free number.
- meta_cap_nr:
give the desired videoX start number for each metadata capture device.
The default is -1 which will just take the first free number.
- meta_out_nr:
give the desired videoX start number for each metadata output device.
The default is -1 which will just take the first free number.
- touch_cap_nr:
give the desired v4l-touchX start number for each touch capture device.
The default is -1 which will just take the first free number.
- ccs_cap_mode:
specify the allowed video capture crop/compose/scaling combination
for each driver instance. Video capture devices can have any combination
of cropping, composing and scaling capabilities and this will tell the
vivid driver which of those is should emulate. By default the user can
select this through controls.
The value is either -1 (controlled by the user) or a set of three bits,
each enabling (1) or disabling (0) one of the features:
- bit 0:
Enable crop support. Cropping will take only part of the
incoming picture.
- bit 1:
Enable compose support. Composing will copy the incoming
picture into a larger buffer.
- bit 2:
Enable scaling support. Scaling can scale the incoming
picture. The scaler of the vivid driver can enlarge up
or down to four times the original size. The scaler is
very simple and low-quality. Simplicity and speed were
key, not quality.
Note that this value is ignored by webcam inputs: those enumerate
discrete framesizes and that is incompatible with cropping, composing
or scaling.
- ccs_out_mode:
specify the allowed video output crop/compose/scaling combination
for each driver instance. Video output devices can have any combination
of cropping, composing and scaling capabilities and this will tell the
vivid driver which of those is should emulate. By default the user can
select this through controls.
The value is either -1 (controlled by the user) or a set of three bits,
each enabling (1) or disabling (0) one of the features:
- bit 0:
Enable crop support. Cropping will take only part of the
outgoing buffer.
- bit 1:
Enable compose support. Composing will copy the incoming
buffer into a larger picture frame.
- bit 2:
Enable scaling support. Scaling can scale the incoming
buffer. The scaler of the vivid driver can enlarge up
or down to four times the original size. The scaler is
very simple and low-quality. Simplicity and speed were
key, not quality.
- multiplanar:
select whether each device instance supports multi-planar formats,
and thus the V4L2 multi-planar API. By default device instances are
single-planar.
This module option can override that for each instance. Values are:
- 1: this is a single-planar instance.
- 2: this is a multi-planar instance.
- vivid_debug:
enable driver debugging info
- no_error_inj:
if set disable the error injecting controls. This option is
needed in order to run a tool like v4l2-compliance. Tools like that
exercise all controls including a control like 'Disconnect' which
emulates a USB disconnect, making the device inaccessible and so
all tests that v4l2-compliance is doing will fail afterwards.
There may be other situations as well where you want to disable the
error injection support of vivid. When this option is set, then the
controls that select crop, compose and scale behavior are also
removed. Unless overridden by ccs_cap_mode and/or ccs_out_mode the
will default to enabling crop, compose and scaling.
- allocators:
memory allocator selection, default is 0. It specifies the way buffers
will be allocated.
- 0: vmalloc
- 1: dma-contig
- cache_hints:
specifies if the device should set queues' user-space cache and memory
consistency hint capability (V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS).
The hints are valid only when using MMAP streaming I/O. Default is 0.
- 0: forbid hints
- 1: allow hints
- supports_requests:
specifies if the device should support the Request API. There are
three possible values, default is 1:
- 0: no request
- 1: supports requests
- 2: requires requests
Taken together, all these module options allow you to precisely customize
the driver behavior and test your application with all sorts of permutations.
It is also very suitable to emulate hardware that is not yet available, e.g.
when developing software for a new upcoming device.
Video Capture
-------------
This is probably the most frequently used feature. The video capture device
can be configured by using the module options num_inputs, input_types and
ccs_cap_mode (see "Configuring the driver" for more detailed information),
but by default four inputs are configured: a webcam, a TV tuner, an S-Video
and an HDMI input, one input for each input type. Those are described in more
detail below.
Special attention has been given to the rate at which new frames become
available. The jitter will be around 1 jiffy (that depends on the HZ
configuration of your kernel, so usually 1/100, 1/250 or 1/1000 of a second),
but the long-term behavior is exactly following the framerate. So a
framerate of 59.94 Hz is really different from 60 Hz. If the framerate
exceeds your kernel's HZ value, then you will get dropped frames, but the
frame/field sequence counting will keep track of that so the sequence
count will skip whenever frames are dropped.
Webcam Input
~~~~~~~~~~~~
The webcam input supports three framesizes: 320x180, 640x360 and 1280x720. It
supports frames per second settings of 10, 15, 25, 30, 50 and 60 fps. Which ones
are available depends on the chosen framesize: the larger the framesize, the
lower the maximum frames per second.
The initially selected colorspace when you switch to the webcam input will be
sRGB.
TV and S-Video Inputs
~~~~~~~~~~~~~~~~~~~~~
The only difference between the TV and S-Video input is that the TV has a
tuner. Otherwise they behave identically.
These inputs support audio inputs as well: one TV and one Line-In. They
both support all TV standards. If the standard is queried, then the Vivid
controls 'Standard Signal Mode' and 'Standard' determine what
the result will be.
These inputs support all combinations of the field setting. Special care has
been taken to faithfully reproduce how fields are handled for the different
TV standards. This is particularly noticeable when generating a horizontally
moving image so the temporal effect of using interlaced formats becomes clearly
visible. For 50 Hz standards the top field is the oldest and the bottom field
is the newest in time. For 60 Hz standards that is reversed: the bottom field
is the oldest and the top field is the newest in time.
When you start capturing in V4L2_FIELD_ALTERNATE mode the first buffer will
contain the top field for 50 Hz standards and the bottom field for 60 Hz
standards. This is what capture hardware does as well.
Finally, for PAL/SECAM standards the first half of the top line contains noise.
This simulates the Wide Screen Signal that is commonly placed there.
The initially selected colorspace when you switch to the TV or S-Video input
will be SMPTE-170M.
The pixel aspect ratio will depend on the TV standard. The video aspect ratio
can be selected through the 'Standard Aspect Ratio' Vivid control.
Choices are '4x3', '16x9' which will give letterboxed widescreen video and
'16x9 Anamorphic' which will give full screen squashed anamorphic widescreen
video that will need to be scaled accordingly.
The TV 'tuner' supports a frequency range of 44-958 MHz. Channels are available
every 6 MHz, starting from 49.25 MHz. For each channel the generated image
will be in color for the +/- 0.25 MHz around it, and in grayscale for
+/- 1 MHz around the channel. Beyond that it is just noise. The VIDIOC_G_TUNER
ioctl will return 100% signal strength for +/- 0.25 MHz and 50% for +/- 1 MHz.
It will also return correct afc values to show whether the frequency is too
low or too high.
The audio subchannels that are returned are MONO for the +/- 1 MHz range around
a valid channel frequency. When the frequency is within +/- 0.25 MHz of the
channel it will return either MONO, STEREO, either MONO | SAP (for NTSC) or
LANG1 | LANG2 (for others), or STEREO | SAP.
Which one is returned depends on the chosen channel, each next valid channel
will cycle through the possible audio subchannel combinations. This allows
you to test the various combinations by just switching channels..
Finally, for these inputs the v4l2_timecode struct is filled in the
dequeued v4l2_buffer struct.
HDMI Input
~~~~~~~~~~
The HDMI inputs supports all CEA-861 and DMT timings, both progressive and
interlaced, for pixelclock frequencies between 25 and 600 MHz. The field
mode for interlaced formats is always V4L2_FIELD_ALTERNATE. For HDMI the
field order is always top field first, and when you start capturing an
interlaced format you will receive the top field first.
The initially selected colorspace when you switch to the HDMI input or
select an HDMI timing is based on the format resolution: for resolutions
less than or equal to 720x576 the colorspace is set to SMPTE-170M, for
others it is set to REC-709 (CEA-861 timings) or sRGB (VESA DMT timings).
The pixel aspect ratio will depend on the HDMI timing: for 720x480 is it
set as for the NTSC TV standard, for 720x576 it is set as for the PAL TV
standard, and for all others a 1:1 pixel aspect ratio is returned.
The video aspect ratio can be selected through the 'DV Timings Aspect Ratio'
Vivid control. Choices are 'Source Width x Height' (just use the
same ratio as the chosen format), '4x3' or '16x9', either of which can
result in pillarboxed or letterboxed video.
For HDMI inputs it is possible to set the EDID. By default a simple EDID
is provided. You can only set the EDID for HDMI inputs. Internally, however,
the EDID is shared between all HDMI inputs.
No interpretation is done of the EDID data with the exception of the
physical address. See the CEC section for more details.
There is a maximum of 15 HDMI inputs (if there are more, then they will be
reduced to 15) since that's the limitation of the EDID physical address.
Video Output
------------
The video output device can be configured by using the module options
num_outputs, output_types and ccs_out_mode (see "Configuring the driver"
for more detailed information), but by default two outputs are configured:
an S-Video and an HDMI input, one output for each output type. Those are
described in more detail below.
Like with video capture the framerate is also exact in the long term.
S-Video Output
~~~~~~~~~~~~~~
This output supports audio outputs as well: "Line-Out 1" and "Line-Out 2".
The S-Video output supports all TV standards.
This output supports all combinations of the field setting.
The initially selected colorspace when you switch to the TV or S-Video input
will be SMPTE-170M.
HDMI Output
~~~~~~~~~~~
The HDMI output supports all CEA-861 and DMT timings, both progressive and
interlaced, for pixelclock frequencies between 25 and 600 MHz. The field
mode for interlaced formats is always V4L2_FIELD_ALTERNATE.
The initially selected colorspace when you switch to the HDMI output or
select an HDMI timing is based on the format resolution: for resolutions
less than or equal to 720x576 the colorspace is set to SMPTE-170M, for
others it is set to REC-709 (CEA-861 timings) or sRGB (VESA DMT timings).
The pixel aspect ratio will depend on the HDMI timing: for 720x480 is it
set as for the NTSC TV standard, for 720x576 it is set as for the PAL TV
standard, and for all others a 1:1 pixel aspect ratio is returned.
An HDMI output has a valid EDID which can be obtained through VIDIOC_G_EDID.
There is a maximum of 15 HDMI outputs (if there are more, then they will be
reduced to 15) since that's the limitation of the EDID physical address. See
also the CEC section for more details.
VBI Capture
-----------
There are three types of VBI capture devices: those that only support raw
(undecoded) VBI, those that only support sliced (decoded) VBI and those that
support both. This is determined by the node_types module option. In all
cases the driver will generate valid VBI data: for 60 Hz standards it will
generate Closed Caption and XDS data. The closed caption stream will
alternate between "Hello world!" and "Closed captions test" every second.
The XDS stream will give the current time once a minute. For 50 Hz standards
it will generate the Wide Screen Signal which is based on the actual Video
Aspect Ratio control setting and teletext pages 100-159, one page per frame.
The VBI device will only work for the S-Video and TV inputs, it will give
back an error if the current input is a webcam or HDMI.
VBI Output
----------
There are three types of VBI output devices: those that only support raw
(undecoded) VBI, those that only support sliced (decoded) VBI and those that
support both. This is determined by the node_types module option.
The sliced VBI output supports the Wide Screen Signal and the teletext signal
for 50 Hz standards and Closed Captioning + XDS for 60 Hz standards.
The VBI device will only work for the S-Video output, it will give
back an error if the current output is HDMI.
Radio Receiver
--------------
The radio receiver emulates an FM/AM/SW receiver. The FM band also supports RDS.
The frequency ranges are:
- FM: 64 MHz - 108 MHz
- AM: 520 kHz - 1710 kHz
- SW: 2300 kHz - 26.1 MHz
Valid channels are emulated every 1 MHz for FM and every 100 kHz for AM and SW.
The signal strength decreases the further the frequency is from the valid
frequency until it becomes 0% at +/- 50 kHz (FM) or 5 kHz (AM/SW) from the
ideal frequency. The initial frequency when the driver is loaded is set to
95 MHz.
The FM receiver supports RDS as well, both using 'Block I/O' and 'Controls'
modes. In the 'Controls' mode the RDS information is stored in read-only
controls. These controls are updated every time the frequency is changed,
or when the tuner status is requested. The Block I/O method uses the read()
interface to pass the RDS blocks on to the application for decoding.
The RDS signal is 'detected' for +/- 12.5 kHz around the channel frequency,
and the further the frequency is away from the valid frequency the more RDS
errors are randomly introduced into the block I/O stream, up to 50% of all
blocks if you are +/- 12.5 kHz from the channel frequency. All four errors
can occur in equal proportions: blocks marked 'CORRECTED', blocks marked
'ERROR', blocks marked 'INVALID' and dropped blocks.
The generated RDS stream contains all the standard fields contained in a
0B group, and also radio text and the current time.
The receiver supports HW frequency seek, either in Bounded mode, Wrap Around
mode or both, which is configurable with the "Radio HW Seek Mode" control.
Radio Transmitter
-----------------
The radio transmitter emulates an FM/AM/SW transmitter. The FM band also supports RDS.
The frequency ranges are:
- FM: 64 MHz - 108 MHz
- AM: 520 kHz - 1710 kHz
- SW: 2300 kHz - 26.1 MHz
The initial frequency when the driver is loaded is 95.5 MHz.
The FM transmitter supports RDS as well, both using 'Block I/O' and 'Controls'
modes. In the 'Controls' mode the transmitted RDS information is configured
using controls, and in 'Block I/O' mode the blocks are passed to the driver
using write().
Software Defined Radio Receiver
-------------------------------
The SDR receiver has three frequency bands for the ADC tuner:
- 300 kHz
- 900 kHz - 2800 kHz
- 3200 kHz
The RF tuner supports 50 MHz - 2000 MHz.
The generated data contains the In-phase and Quadrature components of a
1 kHz tone that has an amplitude of sqrt(2).
Metadata Capture
----------------
The Metadata capture generates UVC format metadata. The PTS and SCR are
transmitted based on the values set in vivid controls.
The Metadata device will only work for the Webcam input, it will give
back an error for all other inputs.
Metadata Output
---------------
The Metadata output can be used to set brightness, contrast, saturation and hue.
The Metadata device will only work for the Webcam output, it will give
back an error for all other outputs.
Touch Capture
-------------
The Touch capture generates touch patterns simulating single tap, double tap,
triple tap, move from left to right, zoom in, zoom out, palm press (simulating
a large area being pressed on a touchpad), and simulating 16 simultaneous
touch points.
Controls
--------
Different devices support different controls. The sections below will describe
each control and which devices support them.
User Controls - Test Controls
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Button, Boolean, Integer 32 Bits, Integer 64 Bits, Menu, String, Bitmask and
Integer Menu are controls that represent all possible control types. The Menu
control and the Integer Menu control both have 'holes' in their menu list,
meaning that one or more menu items return EINVAL when VIDIOC_QUERYMENU is called.
Both menu controls also have a non-zero minimum control value. These features
allow you to check if your application can handle such things correctly.
These controls are supported for every device type.
User Controls - Video Capture
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following controls are specific to video capture.
The Brightness, Contrast, Saturation and Hue controls actually work and are
standard. There is one special feature with the Brightness control: each
video input has its own brightness value, so changing input will restore
the brightness for that input. In addition, each video input uses a different
brightness range (minimum and maximum control values). Switching inputs will
cause a control event to be sent with the V4L2_EVENT_CTRL_CH_RANGE flag set.
This allows you to test controls that can change their range.
The 'Gain, Automatic' and Gain controls can be used to test volatile controls:
if 'Gain, Automatic' is set, then the Gain control is volatile and changes
constantly. If 'Gain, Automatic' is cleared, then the Gain control is a normal
control.
The 'Horizontal Flip' and 'Vertical Flip' controls can be used to flip the
image. These combine with the 'Sensor Flipped Horizontally/Vertically' Vivid
controls.
The 'Alpha Component' control can be used to set the alpha component for
formats containing an alpha channel.
User Controls - Audio
~~~~~~~~~~~~~~~~~~~~~
The following controls are specific to video capture and output and radio
receivers and transmitters.
The 'Volume' and 'Mute' audio controls are typical for such devices to
control the volume and mute the audio. They don't actually do anything in
the vivid driver.
Vivid Controls
~~~~~~~~~~~~~~
These vivid custom controls control the image generation, error injection, etc.
Test Pattern Controls
^^^^^^^^^^^^^^^^^^^^^
The Test Pattern Controls are all specific to video capture.
- Test Pattern:
selects which test pattern to use. Use the CSC Colorbar for
testing colorspace conversions: the colors used in that test pattern
map to valid colors in all colorspaces. The colorspace conversion
is disabled for the other test patterns.
- OSD Text Mode:
selects whether the text superimposed on the
test pattern should be shown, and if so, whether only counters should
be displayed or the full text.
- Horizontal Movement:
selects whether the test pattern should
move to the left or right and at what speed.
- Vertical Movement:
does the same for the vertical direction.
- Show Border:
show a two-pixel wide border at the edge of the actual image,
excluding letter or pillarboxing.
- Show Square:
show a square in the middle of the image. If the image is
displayed with the correct pixel and image aspect ratio corrections,
then the width and height of the square on the monitor should be
the same.
- Insert SAV Code in Image:
adds a SAV (Start of Active Video) code to the image.
This can be used to check if such codes in the image are inadvertently
interpreted instead of being ignored.
- Insert EAV Code in Image:
does the same for the EAV (End of Active Video) code.
- Insert Video Guard Band
adds 4 columns of pixels with the HDMI Video Guard Band code at the
left hand side of the image. This only works with 3 or 4 byte RGB pixel
formats. The RGB pixel value 0xab/0x55/0xab turns out to be equivalent
to the HDMI Video Guard Band code that precedes each active video line
(see section 5.2.2.1 in the HDMI 1.3 Specification). To test if a video
receiver has correct HDMI Video Guard Band processing, enable this
control and then move the image to the left hand side of the screen.
That will result in video lines that start with multiple pixels that
have the same value as the Video Guard Band that precedes them.
Receivers that will just keep skipping Video Guard Band values will
now fail and either loose sync or these video lines will shift.
Capture Feature Selection Controls
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These controls are all specific to video capture.
- Sensor Flipped Horizontally:
the image is flipped horizontally and the
V4L2_IN_ST_HFLIP input status flag is set. This emulates the case where
a sensor is for example mounted upside down.
- Sensor Flipped Vertically:
the image is flipped vertically and the
V4L2_IN_ST_VFLIP input status flag is set. This emulates the case where
a sensor is for example mounted upside down.
- Standard Aspect Ratio:
selects if the image aspect ratio as used for the TV or
S-Video input should be 4x3, 16x9 or anamorphic widescreen. This may
introduce letterboxing.
- DV Timings Aspect Ratio:
selects if the image aspect ratio as used for the HDMI
input should be the same as the source width and height ratio, or if
it should be 4x3 or 16x9. This may introduce letter or pillarboxing.
- Timestamp Source:
selects when the timestamp for each buffer is taken.
- Colorspace:
selects which colorspace should be used when generating the image.
This only applies if the CSC Colorbar test pattern is selected,
otherwise the test pattern will go through unconverted.
This behavior is also what you want, since a 75% Colorbar
should really have 75% signal intensity and should not be affected
by colorspace conversions.
Changing the colorspace will result in the V4L2_EVENT_SOURCE_CHANGE
to be sent since it emulates a detected colorspace change.
- Transfer Function:
selects which colorspace transfer function should be used when
generating an image. This only applies if the CSC Colorbar test pattern is
selected, otherwise the test pattern will go through unconverted.
This behavior is also what you want, since a 75% Colorbar
should really have 75% signal intensity and should not be affected
by colorspace conversions.
Changing the transfer function will result in the V4L2_EVENT_SOURCE_CHANGE
to be sent since it emulates a detected colorspace change.
- Y'CbCr Encoding:
selects which Y'CbCr encoding should be used when generating
a Y'CbCr image. This only applies if the format is set to a Y'CbCr format
as opposed to an RGB format.
Changing the Y'CbCr encoding will result in the V4L2_EVENT_SOURCE_CHANGE
to be sent since it emulates a detected colorspace change.
- Quantization:
selects which quantization should be used for the RGB or Y'CbCr
encoding when generating the test pattern.
Changing the quantization will result in the V4L2_EVENT_SOURCE_CHANGE
to be sent since it emulates a detected colorspace change.
- Limited RGB Range (16-235):
selects if the RGB range of the HDMI source should
be limited or full range. This combines with the Digital Video 'Rx RGB
Quantization Range' control and can be used to test what happens if
a source provides you with the wrong quantization range information.
See the description of that control for more details.
- Apply Alpha To Red Only:
apply the alpha channel as set by the 'Alpha Component'
user control to the red color of the test pattern only.
- Enable Capture Cropping:
enables crop support. This control is only present if
the ccs_cap_mode module option is set to the default value of -1 and if
the no_error_inj module option is set to 0 (the default).
- Enable Capture Composing:
enables composing support. This control is only
present if the ccs_cap_mode module option is set to the default value of
-1 and if the no_error_inj module option is set to 0 (the default).
- Enable Capture Scaler:
enables support for a scaler (maximum 4 times upscaling
and downscaling). This control is only present if the ccs_cap_mode
module option is set to the default value of -1 and if the no_error_inj
module option is set to 0 (the default).
- Maximum EDID Blocks:
determines how many EDID blocks the driver supports.
Note that the vivid driver does not actually interpret new EDID
data, it just stores it. It allows for up to 256 EDID blocks
which is the maximum supported by the standard.
- Fill Percentage of Frame:
can be used to draw only the top X percent
of the image. Since each frame has to be drawn by the driver, this
demands a lot of the CPU. For large resolutions this becomes
problematic. By drawing only part of the image this CPU load can
be reduced.
Output Feature Selection Controls
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These controls are all specific to video output.
- Enable Output Cropping:
enables crop support. This control is only present if
the ccs_out_mode module option is set to the default value of -1 and if
the no_error_inj module option is set to 0 (the default).
- Enable Output Composing:
enables composing support. This control is only
present if the ccs_out_mode module option is set to the default value of
-1 and if the no_error_inj module option is set to 0 (the default).
- Enable Output Scaler:
enables support for a scaler (maximum 4 times upscaling
and downscaling). This control is only present if the ccs_out_mode
module option is set to the default value of -1 and if the no_error_inj
module option is set to 0 (the default).
Error Injection Controls
^^^^^^^^^^^^^^^^^^^^^^^^
The following two controls are only valid for video and vbi capture.
- Standard Signal Mode:
selects the behavior of VIDIOC_QUERYSTD: what should it return?
Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE
to be sent since it emulates a changed input condition (e.g. a cable
was plugged in or out).
- Standard:
selects the standard that VIDIOC_QUERYSTD should return if the
previous control is set to "Selected Standard".
Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE
to be sent since it emulates a changed input standard.
The following two controls are only valid for video capture.
- DV Timings Signal Mode:
selects the behavior of VIDIOC_QUERY_DV_TIMINGS: what
should it return?
Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE
to be sent since it emulates a changed input condition (e.g. a cable
was plugged in or out).
- DV Timings:
selects the timings the VIDIOC_QUERY_DV_TIMINGS should return
if the previous control is set to "Selected DV Timings".
Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE
to be sent since it emulates changed input timings.
The following controls are only present if the no_error_inj module option
is set to 0 (the default). These controls are valid for video and vbi
capture and output streams and for the SDR capture device except for the
Disconnect control which is valid for all devices.
- Wrap Sequence Number:
test what happens when you wrap the sequence number in
struct v4l2_buffer around.
- Wrap Timestamp:
test what happens when you wrap the timestamp in struct
v4l2_buffer around.
- Percentage of Dropped Buffers:
sets the percentage of buffers that
are never returned by the driver (i.e., they are dropped).
- Disconnect:
emulates a USB disconnect. The device will act as if it has
been disconnected. Only after all open filehandles to the device
node have been closed will the device become 'connected' again.
- Inject V4L2_BUF_FLAG_ERROR:
when pressed, the next frame returned by
the driver will have the error flag set (i.e. the frame is marked
corrupt).
- Inject VIDIOC_REQBUFS Error:
when pressed, the next REQBUFS or CREATE_BUFS
ioctl call will fail with an error. To be precise: the videobuf2
queue_setup() op will return -EINVAL.
- Inject VIDIOC_QBUF Error:
when pressed, the next VIDIOC_QBUF or
VIDIOC_PREPARE_BUFFER ioctl call will fail with an error. To be
precise: the videobuf2 buf_prepare() op will return -EINVAL.
- Inject VIDIOC_STREAMON Error:
when pressed, the next VIDIOC_STREAMON ioctl
call will fail with an error. To be precise: the videobuf2
start_streaming() op will return -EINVAL.
- Inject Fatal Streaming Error:
when pressed, the streaming core will be
marked as having suffered a fatal error, the only way to recover
from that is to stop streaming. To be precise: the videobuf2
vb2_queue_error() function is called.
VBI Raw Capture Controls
^^^^^^^^^^^^^^^^^^^^^^^^
- Interlaced VBI Format:
if set, then the raw VBI data will be interlaced instead
of providing it grouped by field.
Digital Video Controls
~~~~~~~~~~~~~~~~~~~~~~
- Rx RGB Quantization Range:
sets the RGB quantization detection of the HDMI
input. This combines with the Vivid 'Limited RGB Range (16-235)'
control and can be used to test what happens if a source provides
you with the wrong quantization range information. This can be tested
by selecting an HDMI input, setting this control to Full or Limited
range and selecting the opposite in the 'Limited RGB Range (16-235)'
control. The effect is easy to see if the 'Gray Ramp' test pattern
is selected.
- Tx RGB Quantization Range:
sets the RGB quantization detection of the HDMI
output. It is currently not used for anything in vivid, but most HDMI
transmitters would typically have this control.
- Transmit Mode:
sets the transmit mode of the HDMI output to HDMI or DVI-D. This
affects the reported colorspace since DVI_D outputs will always use
sRGB.
FM Radio Receiver Controls
~~~~~~~~~~~~~~~~~~~~~~~~~~
- RDS Reception:
set if the RDS receiver should be enabled.
- RDS Program Type:
- RDS PS Name:
- RDS Radio Text:
- RDS Traffic Announcement:
- RDS Traffic Program:
- RDS Music:
these are all read-only controls. If RDS Rx I/O Mode is set to
"Block I/O", then they are inactive as well. If RDS Rx I/O Mode is set
to "Controls", then these controls report the received RDS data.
.. note::
The vivid implementation of this is pretty basic: they are only
updated when you set a new frequency or when you get the tuner status
(VIDIOC_G_TUNER).
- Radio HW Seek Mode:
can be one of "Bounded", "Wrap Around" or "Both". This
determines if VIDIOC_S_HW_FREQ_SEEK will be bounded by the frequency
range or wrap-around or if it is selectable by the user.
- Radio Programmable HW Seek:
if set, then the user can provide the lower and
upper bound of the HW Seek. Otherwise the frequency range boundaries
will be used.
- Generate RBDS Instead of RDS:
if set, then generate RBDS (the US variant of
RDS) data instead of RDS (European-style RDS). This affects only the
PICODE and PTY codes.
- RDS Rx I/O Mode:
this can be "Block I/O" where the RDS blocks have to be read()
by the application, or "Controls" where the RDS data is provided by
the RDS controls mentioned above.
FM Radio Modulator Controls
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- RDS Program ID:
- RDS Program Type:
- RDS PS Name:
- RDS Radio Text:
- RDS Stereo:
- RDS Artificial Head:
- RDS Compressed:
- RDS Dynamic PTY:
- RDS Traffic Announcement:
- RDS Traffic Program:
- RDS Music:
these are all controls that set the RDS data that is transmitted by
the FM modulator.
- RDS Tx I/O Mode:
this can be "Block I/O" where the application has to use write()
to pass the RDS blocks to the driver, or "Controls" where the RDS data
is Provided by the RDS controls mentioned above.
Metadata Capture Controls
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Generate PTS
if set, then the generated metadata stream contains Presentation timestamp.
- Generate SCR
if set, then the generated metadata stream contains Source Clock information.
Video, Sliced VBI and HDMI CEC Looping
--------------------------------------
Video Looping functionality is supported for devices created by the same
vivid driver instance, as well as across multiple instances of the vivid driver.
The vivid driver supports looping of video and Sliced VBI data between an S-Video output
and an S-Video input. It also supports looping of video and HDMI CEC data between an
HDMI output and an HDMI input.
To enable looping, set the 'HDMI/S-Video XXX-N Is Connected To' control(s) to select
whether an input uses the Test Pattern Generator, or is disconnected, or is connected
to an output. An input can be connected to an output from any vivid instance.
The inputs and outputs are numbered XXX-N where XXX is the vivid instance number
(see module option n_devs). If there is only one vivid instance (the default), then
XXX will be 000. And N is the Nth S-Video/HDMI input or output of that instance.
If vivid is loaded without module options, then you can connect the S-Video 000-0 input
to the S-Video 000-0 output, or the HDMI 000-0 input to the HDMI 000-0 output.
This is the equivalent of connecting or disconnecting a cable between an input and an
output in a physical device.
If an 'HDMI/S-Video XXX-N Is Connected To' control selected an output, then the video
output will be looped to the video input provided that:
- the currently selected input matches the input indicated by the control name.
- in the vivid instance of the output connector, the currently selected output matches
the output indicated by the control's value.
- the video resolution of the video input must match that of the video output.
So it is not possible to loop a 50 Hz (720x576) S-Video output to a 60 Hz
(720x480) S-Video input, or a 720p60 HDMI output to a 1080p30 input.
- the pixel formats must be identical on both sides. Otherwise the driver would
have to do pixel format conversion as well, and that's taking things too far.
- the field settings must be identical on both sides. Same reason as above:
requiring the driver to convert from one field format to another complicated
matters too much. This also prohibits capturing with 'Field Top' or 'Field
Bottom' when the output video is set to 'Field Alternate'. This combination,
while legal, became too complicated to support. Both sides have to be 'Field
Alternate' for this to work. Also note that for this specific case the
sequence and field counting in struct v4l2_buffer on the capture side may not
be 100% accurate.
- field settings V4L2_FIELD_SEQ_TB/BT are not supported. While it is possible to
implement this, it would mean a lot of work to get this right. Since these
field values are rarely used the decision was made not to implement this for
now.
- on the input side the "Standard Signal Mode" for the S-Video input or the
"DV Timings Signal Mode" for the HDMI input should be configured so that a
valid signal is passed to the video input.
If any condition is not valid, then the 'Noise' test pattern is shown.
The framerates do not have to match, although this might change in the future.
By default you will see the OSD text superimposed on top of the looped video.
This can be turned off by changing the "OSD Text Mode" control of the video
capture device.
For VBI looping to work all of the above must be valid and in addition the vbi
output must be configured for sliced VBI. The VBI capture side can be configured
for either raw or sliced VBI. Note that at the moment only CC/XDS (60 Hz formats)
and WSS (50 Hz formats) VBI data is looped. Teletext VBI data is not looped.
Radio & RDS Looping
-------------------
The vivid driver supports looping of RDS output to RDS input.
Since radio is wireless this looping always happens if the radio receiver
frequency is close to the radio transmitter frequency. In that case the radio
transmitter will 'override' the emulated radio stations.
RDS looping is currently supported only between devices created by the same
vivid driver instance.
As mentioned in the "Radio Receiver" section, the radio receiver emulates
stations at regular frequency intervals. Depending on the frequency of the
radio receiver a signal strength value is calculated (this is returned by
VIDIOC_G_TUNER). However, it will also look at the frequency set by the radio
transmitter and if that results in a higher signal strength than the settings
of the radio transmitter will be used as if it was a valid station. This also
includes the RDS data (if any) that the transmitter 'transmits'. This is
received faithfully on the receiver side. Note that when the driver is loaded
the frequencies of the radio receiver and transmitter are not identical, so
initially no looping takes place.
Cropping, Composing, Scaling
----------------------------
This driver supports cropping, composing and scaling in any combination. Normally
which features are supported can be selected through the Vivid controls,
but it is also possible to hardcode it when the module is loaded through the
ccs_cap_mode and ccs_out_mode module options. See "Configuring the driver" on
the details of these module options.
This allows you to test your application for all these variations.
Note that the webcam input never supports cropping, composing or scaling. That
only applies to the TV/S-Video/HDMI inputs and outputs. The reason is that
webcams, including this virtual implementation, normally use
VIDIOC_ENUM_FRAMESIZES to list a set of discrete framesizes that it supports.
And that does not combine with cropping, composing or scaling. This is
primarily a limitation of the V4L2 API which is carefully reproduced here.
The minimum and maximum resolutions that the scaler can achieve are 16x16 and
(4096 * 4) x (2160 x 4), but it can only scale up or down by a factor of 4 or
less. So for a source resolution of 1280x720 the minimum the scaler can do is
320x180 and the maximum is 5120x2880. You can play around with this using the
qv4l2 test tool and you will see these dependencies.
This driver also supports larger 'bytesperline' settings, something that
VIDIOC_S_FMT allows but that few drivers implement.
The scaler is a simple scaler that uses the Coarse Bresenham algorithm. It's
designed for speed and simplicity, not quality.
If the combination of crop, compose and scaling allows it, then it is possible
to change crop and compose rectangles on the fly.
Formats
-------
The driver supports all the regular packed and planar 4:4:4, 4:2:2 and 4:2:0
YUYV formats, 8, 16, 24 and 32 RGB packed formats and various multiplanar
formats.
The alpha component can be set through the 'Alpha Component' User control
for those formats that support it. If the 'Apply Alpha To Red Only' control
is set, then the alpha component is only used for the color red and set to
0 otherwise.
The driver has to be configured to support the multiplanar formats. By default
the driver instances are single-planar. This can be changed by setting the
multiplanar module option, see "Configuring the driver" for more details on that
option.
If the driver instance is using the multiplanar formats/API, then the first
single planar format (YUYV) and the multiplanar NV16M and NV61M formats the
will have a plane that has a non-zero data_offset of 128 bytes. It is rare for
data_offset to be non-zero, so this is a useful feature for testing applications.
Video output will also honor any data_offset that the application set.
Output Overlay
--------------
Note: output overlays are primarily implemented in order to test the existing
V4L2 output overlay API. Whether this API should be used for new drivers is
questionable.
This driver has support for an output overlay and is capable of:
- bitmap clipping,
- list clipping (up to 16 rectangles)
- chromakey
- source chromakey
- global alpha
- local alpha
- local inverse alpha
Output overlays are not supported for multiplanar formats. In addition, the
pixelformat of the capture format and that of the framebuffer must be the
same for the overlay to work. Otherwise VIDIOC_OVERLAY will return an error.
Output overlays only work if the driver has been configured to create a
framebuffer by setting flag 0x10000 in the node_types module option. The
created framebuffer has a size of 720x576 and supports ARGB 1:5:5:5 and
RGB 5:6:5.
In order to see the effects of the various clipping, chromakeying or alpha
processing capabilities you need to turn on video looping and see the results
on the capture side. The use of the clipping, chromakeying or alpha processing
capabilities will slow down the video loop considerably as a lot of checks have
to be done per pixel.
CEC (Consumer Electronics Control)
----------------------------------
If there are HDMI inputs then a CEC adapter will be created that has
the same number of input ports. This is the equivalent of e.g. a TV that
has that number of inputs. Each HDMI output will also create a
CEC adapter that is hooked up to the corresponding input port, or (if there
are more outputs than inputs) is not hooked up at all. In other words,
this is the equivalent of hooking up each output device to an input port of
the TV. Any remaining output devices remain unconnected.
The EDID that each output reads reports a unique CEC physical address that is
based on the physical address of the EDID of the input. So if the EDID of the
receiver has physical address A.B.0.0, then each output will see an EDID
containing physical address A.B.C.0 where C is 1 to the number of inputs. If
there are more outputs than inputs then the remaining outputs have a CEC adapter
that is disabled and reports an invalid physical address.
Some Future Improvements
------------------------
Just as a reminder and in no particular order:
- Add a virtual alsa driver to test audio
- Add virtual sub-devices
- Some support for testing compressed video
- Add support to loop raw VBI output to raw VBI input
- Add support to loop teletext sliced VBI output to VBI input
- Fix sequence/field numbering when looping of video with alternate fields
- Add support for V4L2_CID_BG_COLOR for video outputs
- Add ARGB888 overlay support: better testing of the alpha channel
- Improve pixel aspect support in the tpg code by passing a real v4l2_fract
- Use per-queue locks and/or per-device locks to improve throughput
- The SDR radio should use the same 'frequencies' for stations as the normal
radio receiver, and give back noise if the frequency doesn't match up with
a station frequency
- Make a thread for the RDS generation, that would help in particular for the
"Controls" RDS Rx I/O Mode as the read-only RDS controls could be updated
in real-time.
- Changing the EDID doesn't wait 100 ms before setting the HPD signal.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Virtual Video Test Driver 개요
1-43이 문서는 GPL-2.0 라이선스를 따릅니다. `vivid`는 video capture/output, VBI capture/output, metadata capture/output, radio receiver/transmitter, touch capture, SDR receiver를 비롯한 여러 종류의 Video4Linux hardware를 가상으로 구현합니다. capture/output overlay 시험용 단순 framebuffer도 제공합니다.
최대 64개 인스턴스를 만들 수 있고 각 인스턴스는 최대 16개 입력과 16개 출력을 가집니다. 입력은 webcam, TV capture, S-Video capture, HDMI capture가 될 수 있고 출력은 S-Video 또는 HDMI가 될 수 있습니다.
입출력은 실제 hardware처럼 동작하므로 별도 장비 없이 application의 V4L2 기능과 예외 처리를 개발·시험할 수 있습니다. 이 driver가 구현하는 기능은 다음과 같습니다.
- read()/write(), MMAP, USERPTR, DMABUF 스트리밍 I/O 지원
- 다양한 변형을 포함한 광범위한 테스트 패턴
- 실제로 영상에 적용되는 brightness, contrast, saturation, hue 제어
- alpha 색상 성분 지원
- limited/full RGB 범위를 포함한 전체 colorspace 지원
- 가능한 모든 V4L2 control 유형 제공
- 여러 pixel aspect ratio와 video aspect ratio 지원
- 오류 발생 시 동작을 검증하는 error injection
- 입력과 출력 모두에서 crop, compose, scale의 모든 조합 지원
- 최대 4K 해상도 에뮬레이션
- interlaced capture 시험을 위한 모든 Field 설정 지원
- 두 가지 multiplanar YUV 형식을 포함한 표준 YUV/RGB 형식 지원
- raw/sliced VBI capture 및 output
- RDS를 포함한 radio receiver/transmitter 지원
- software-defined radio(SDR) 지원
- capture/output overlay
- metadata capture/output
- touch capture
드라이버 구성
44-319기본 구성은 webcam, TV, S-Video, HDMI 입력을 가진 video capture 장치, S-Video와 HDMI 출력을 가진 video output 장치, VBI capture/output, radio receiver/transmitter, SDR 장치를 각각 하나씩 포함한 인스턴스 한 개입니다.
인스턴스 수와 node, video 입출력 수·유형은 다음 module option으로 조정합니다. 배열형 option은 인스턴스 순서대로 값을 받습니다.
| Module option | 기본값·범위 | 동작 |
|---|---|---|
| n_devs | 기본 1, 최대 64 | 생성할 vivid 드라이버 인스턴스 수를 지정합니다. |
| node_types | 기본 0xe1d3d, 인스턴스별 16진수 bitmask | bit 0은 Video Capture, bit 2-3은 VBI Capture(none/raw/sliced/both), bit 4는 Radio Receiver, bit 5는 SDR Receiver, bit 8은 Video Output, bit 10-11은 VBI Output, bit 12는 Radio Transmitter, bit 16은 overlay용 framebuffer, bit 17은 Metadata Capture, bit 18은 Metadata Output, bit 19는 Touch Capture입니다. |
| num_inputs | 기본 4, 1-16 | 각 인스턴스의 video capture 입력 수를 지정합니다. |
| input_types | 기본 0xe4, 입력마다 2비트 | 각 쌍은 00 webcam, 01 TV tuner, 10 S-Video, 11 HDMI이며 bit 0-1부터 input 0에 대응합니다. |
| num_outputs | 기본 2, 1-16 | 각 인스턴스의 video output 수를 지정합니다. |
| output_types | 기본 0x02, 출력마다 1비트 | 0은 S-Video output, 1은 HDMI output이며 bit N이 output N에 대응합니다. |
| vid_cap_nr | 기본 -1 | video capture 장치마다 원하는 videoX 시작 번호를 지정합니다. 할당에 실패하면 다음 빈 번호를 사용합니다. |
| vid_out_nr | 기본 -1 | video output 장치마다 원하는 videoX 시작 번호를 지정합니다. |
| vbi_cap_nr | 기본 -1 | VBI capture 장치마다 원하는 vbiX 시작 번호를 지정합니다. |
| vbi_out_nr | 기본 -1 | VBI output 장치마다 원하는 vbiX 시작 번호를 지정합니다. |
| radio_rx_nr | 기본 -1 | radio receiver마다 원하는 radioX 시작 번호를 지정합니다. |
| radio_tx_nr | 기본 -1 | radio transmitter마다 원하는 radioX 시작 번호를 지정합니다. |
| sdr_cap_nr | 기본 -1 | SDR capture 장치마다 원하는 swradioX 시작 번호를 지정합니다. |
| meta_cap_nr | 기본 -1 | metadata capture 장치마다 원하는 videoX 시작 번호를 지정합니다. |
| meta_out_nr | 기본 -1 | metadata output 장치마다 원하는 videoX 시작 번호를 지정합니다. |
| touch_cap_nr | 기본 -1 | touch capture 장치마다 원하는 v4l-touchX 시작 번호를 지정합니다. |
| ccs_cap_mode | 기본 -1 또는 3비트 | capture의 crop/compose/scale 조합을 고정합니다. -1은 control 선택이며 bit 0 crop, bit 1 compose, bit 2 scale입니다. scaler는 원본의 1/4배부터 4배까지 단순 저품질 방식으로 처리합니다. discrete framesize를 쓰는 webcam에는 적용되지 않습니다. |
| ccs_out_mode | 기본 -1 또는 3비트 | output의 crop/compose/scale 조합을 고정합니다. bit 0은 outgoing buffer crop, bit 1은 더 큰 picture frame으로 compose, bit 2는 최대 4배 상하향 scale입니다. |
| multiplanar | 인스턴스별 1 또는 2 | 1은 single-planar, 2는 multi-planar 형식과 V4L2 multi-planar API를 사용합니다. 기본은 single-planar입니다. |
| vivid_debug | 기본 비활성 | 드라이버 디버그 정보를 활성화합니다. |
| no_error_inj | 기본 0 | 설정하면 error-injection control을 제거하여 v4l2-compliance 같은 도구가 Disconnect 뒤에 연쇄 실패하지 않게 합니다. crop/compose/scale 선택 control도 제거하며 ccs_*_mode가 별도로 지정되지 않으면 세 기능을 모두 활성화합니다. |
| allocators | 기본 0 | buffer allocator를 고릅니다. 0은 vmalloc, 1은 dma-contig입니다. |
| cache_hints | 기본 0 | MMAP streaming I/O에서 V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS를 제공할지 정합니다. 0은 금지, 1은 허용입니다. |
| supports_requests | 기본 1 | Request API 정책을 정합니다. 0은 미지원, 1은 지원, 2는 request 필수입니다. |
capture node만 두 개, output node만 두 개를 만드는 예입니다.
n_devs=4 node_types=0x1,0x1,0x100,0x100
TV 1개, S-Video 3개, HDMI 4개로 여덟 입력을 만드는 예입니다.
num_inputs=8 input_types=0xffa9
S-Video 4개와 HDMI 4개로 여덟 출력을 만드는 예입니다.
num_outputs=8 output_types=0xf0
네 인스턴스의 capture node를 `/dev/video2`, `/dev/video4`, `/dev/video6`, `/dev/video8`에 할당하려는 예입니다. 원하는 번호를 사용할 수 없으면 다음 빈 번호가 선택됩니다.
n_devs=4 vid_cap_nr=2,4,6,8
이 option들을 조합하면 여러 hardware 구성을 정밀하게 재현할 수 있으며 아직 출시되지 않은 장치를 위한 software를 미리 개발하는 데도 적합합니다.
Video Capture
320-339video capture는 가장 자주 쓰이는 기능입니다. `num_inputs`, `input_types`, `ccs_cap_mode`로 구성하며 기본은 webcam, TV tuner, S-Video, HDMI 입력 각각 하나입니다.
새 frame의 jitter는 약 1 jiffy로 kernel HZ에 따라 대개 1/100, 1/250, 1/1000초입니다. 장기적으로는 정확한 frame rate를 따르므로 59.94 Hz와 60 Hz를 구분합니다. frame rate가 HZ를 넘으면 frame을 drop하지만 frame/field sequence count는 이를 반영해 번호를 건너뜁니다.
Webcam 입력
340-351webcam 입력은 320x180, 640x360, 1280x720 세 frame size와 10, 15, 25, 30, 50, 60 fps를 지원합니다. 큰 frame일수록 최대 fps가 낮아집니다. 입력 전환 시 초기 colorspace는 sRGB입니다.
TV 및 S-Video 입력
352-407TV 입력에 tuner가 있다는 점 외에는 두 입력이 같습니다. TV와 Line-In audio 입력을 제공하고 모든 TV 표준을 지원하며 `Standard Signal Mode`와 `Standard` control이 표준 질의 결과를 정합니다.
모든 field 조합을 지원하고 interlaced 시간 순서를 재현합니다. 50 Hz 표준은 top field가 오래되고 bottom field가 새로우며 60 Hz는 반대입니다. V4L2_FIELD_ALTERNATE capture를 시작하면 50 Hz에서는 top field, 60 Hz에서는 bottom field가 첫 buffer에 들어갑니다.
PAL/SECAM에서는 top line 앞 절반에 Wide Screen Signal을 흉내 내는 noise를 넣습니다. 초기 colorspace는 SMPTE-170M이고 pixel aspect ratio는 TV 표준에 따릅니다. `Standard Aspect Ratio`에서 4x3, letterboxed 16x9, scale이 필요한 full-screen `16x9 Anamorphic`을 고릅니다.
TV tuner 범위는 44-958 MHz이며 49.25 MHz부터 6 MHz 간격으로 channel을 둡니다. 중심 ±0.25 MHz는 color와 100% signal, ±1 MHz는 grayscale와 50% signal이고 그 밖은 noise입니다. VIDIOC_G_TUNER는 주파수가 낮거나 높은지 나타내는 올바른 afc도 반환합니다.
audio subchannel은 유효 channel ±1 MHz에서 MONO이며 중심 ±0.25 MHz에서는 channel마다 MONO, STEREO, NTSC의 MONO | SAP 또는 다른 표준의 LANG1 | LANG2, STEREO | SAP 조합을 순환합니다. dequeued `v4l2_buffer`의 `v4l2_timecode`도 채웁니다.
HDMI 입력
408-441HDMI 입력은 25-600 MHz pixel clock 범위의 progressive/interlaced CEA-861 및 DMT timing을 모두 지원합니다. interlaced 형식은 항상 V4L2_FIELD_ALTERNATE이고 top field first이며 capture 첫 field도 top입니다.
해상도가 720x576 이하이면 초기 colorspace는 SMPTE-170M, 그보다 크면 CEA-861은 REC-709, VESA DMT는 sRGB입니다. pixel aspect ratio는 720x480에서 NTSC, 720x576에서 PAL과 같고 나머지는 1:1입니다.
`DV Timings Aspect Ratio`에서 source width/height, 4x3, 16x9를 선택해 pillarbox 또는 letterbox를 시험합니다. HDMI 입력에만 EDID를 설정할 수 있으며 기본 EDID가 있고 모든 HDMI 입력이 내부에서 같은 EDID를 공유합니다. physical address 외에는 EDID를 해석하지 않습니다.
EDID physical-address 제약 때문에 HDMI 입력은 최대 15개이며 더 많이 요청하면 15개로 줄입니다.
Video Output
442-453video output은 `num_outputs`, `output_types`, `ccs_out_mode`로 구성하며 기본은 S-Video와 HDMI 출력 하나씩입니다. capture와 마찬가지로 장기 frame rate는 정확합니다.
S-Video 출력
454-465S-Video output은 `Line-Out 1`, `Line-Out 2` audio output과 모든 TV 표준·field 조합을 지원합니다. 초기 colorspace는 SMPTE-170M입니다.
HDMI 출력
466-487HDMI output은 25-600 MHz pixel clock 범위의 progressive/interlaced CEA-861 및 DMT timing을 모두 지원하고 interlaced field mode는 V4L2_FIELD_ALTERNATE입니다.
720x576 이하의 초기 colorspace는 SMPTE-170M, 그보다 크면 CEA-861은 REC-709, VESA DMT는 sRGB입니다. 720x480 pixel aspect ratio는 NTSC, 720x576은 PAL, 나머지는 1:1입니다.
VIDIOC_G_EDID로 유효한 EDID를 읽을 수 있습니다. physical-address 제한으로 HDMI 출력도 최대 15개입니다.
VBI Capture
488-504`node_types`에 따라 raw VBI 전용, sliced VBI 전용, 둘 다 지원하는 capture node를 만듭니다. 60 Hz에서는 Closed Caption과 XDS를 생성하며 caption은 1초마다 `Hello world!`와 `Closed captions test`를 번갈아 내보내고 XDS는 1분마다 현재 시간을 전달합니다.
50 Hz에서는 Video Aspect Ratio control에 따른 Wide Screen Signal과 frame마다 한 페이지씩 teletext page 100-159를 생성합니다. VBI 장치는 TV/S-Video 입력에서만 동작하며 webcam이나 HDMI 입력에서는 오류를 반환합니다.
VBI Output
505-518`node_types`에 따라 raw, sliced, 둘 다 지원하는 VBI output node를 만듭니다. sliced output은 50 Hz의 WSS·teletext와 60 Hz의 Closed Captioning·XDS를 지원합니다. S-Video output에서만 동작하고 HDMI에서는 오류를 반환합니다.
Radio Receiver
519-554FM/AM/SW receiver를 흉내 내며 FM은 RDS도 지원합니다. 범위는 FM 64-108 MHz, AM 520-1710 kHz, SW 2300 kHz-26.1 MHz입니다. 유효 channel은 FM 1 MHz, AM/SW 100 kHz 간격이며 초기 주파수는 95 MHz입니다.
중심에서 멀어질수록 signal이 약해져 FM ±50 kHz, AM/SW ±5 kHz에서 0%가 됩니다. FM RDS는 read-only control을 쓰는 Controls mode와 read()로 block을 전달하는 Block I/O mode를 제공합니다.
RDS는 channel 중심 ±12.5 kHz에서 감지됩니다. 중심에서 멀수록 CORRECTED, ERROR, INVALID, dropped block 오류를 같은 비율로 무작위 삽입하며 경계에서 최대 50%에 이릅니다. stream은 0B group의 표준 field, radio text, 현재 시간을 포함합니다.
`Radio HW Seek Mode`로 bounded seek, wrap-around seek 또는 둘 다 지원하도록 설정할 수 있습니다.
Radio Transmitter
555-572FM/AM/SW transmitter의 범위는 receiver와 같고 초기 주파수는 95.5 MHz입니다. FM RDS는 control로 송신 내용을 구성하는 Controls mode와 write()로 block을 넘기는 Block I/O mode를 지원합니다.
Software Defined Radio Receiver
573-587SDR ADC tuner는 300 kHz, 900-2800 kHz, 3200 kHz의 세 대역을 가지며 RF tuner는 50-2000 MHz를 지원합니다. 생성 데이터에는 amplitude가 sqrt(2)인 1 kHz tone의 In-phase와 Quadrature 성분이 들어갑니다.
Metadata Capture
588-597UVC 형식 metadata를 생성하고 vivid control에 설정된 값으로 PTS와 SCR을 전송합니다. webcam 입력에서만 동작하고 다른 입력에서는 오류를 반환합니다.
Metadata Output
598-606metadata output으로 brightness, contrast, saturation, hue를 설정할 수 있습니다. webcam output에서만 동작하며 다른 출력에서는 오류를 반환합니다.
Touch Capture
607-614single/double/triple tap, 좌우 이동, zoom in/out, 넓은 영역을 누르는 palm press, 16개 동시 touch point를 흉내 내는 pattern을 생성합니다.
Control 구성
615-621장치 종류마다 지원하는 control이 다르며 아래 절에서 각 control과 적용 장치를 설명합니다.
User Controls - Test Controls
622-633Button, Boolean, Integer 32 Bits, Integer 64 Bits, Menu, String, Bitmask, Integer Menu로 가능한 control type을 모두 표현합니다. Menu 두 종류에는 VIDIOC_QUERYMENU가 EINVAL을 반환하는 빈 항목이 있고 minimum도 0이 아니므로 application이 이런 경우를 올바르게 다루는지 검사할 수 있습니다. 모든 장치 유형이 지원합니다.
User Controls - Video Capture
634-659Brightness, Contrast, Saturation, Hue는 실제로 영상에 적용됩니다. 입력마다 brightness 값과 min/max 범위가 달라 입력을 바꾸면 해당 값이 복원되고 V4L2_EVENT_CTRL_CH_RANGE flag가 붙은 control event가 발생합니다.
`Gain, Automatic`을 켜면 Gain이 계속 변하는 volatile control이 되고 끄면 일반 control이 됩니다. `Horizontal Flip`, `Vertical Flip`은 영상 반전에 쓰며 vivid의 sensor flip control과 조합됩니다. `Alpha Component`는 alpha channel을 가진 형식의 alpha 값을 설정합니다.
User Controls - Audio
660-670video capture/output과 radio receiver/transmitter는 전형적인 `Volume`, `Mute` control을 제공하지만 vivid 내부 동작에는 실제 영향을 주지 않습니다.
Vivid Controls
671-676vivid 전용 control은 image generation, error injection 등의 시험 동작을 제어합니다.
Test Pattern Controls
677-740다음 control은 모두 video capture 전용입니다.
| Control | 동작 |
|---|---|
| Test Pattern | 사용할 패턴을 선택합니다. CSC Colorbar는 모든 colorspace에서 유효한 색으로 변환 시험에 쓰며, 다른 패턴에는 colorspace conversion을 적용하지 않습니다. |
| OSD Text Mode | 패턴 위 텍스트 표시 여부와 counter만 표시할지 전체 텍스트를 표시할지 정합니다. |
| Horizontal Movement | 패턴의 좌우 이동 방향과 속도를 정합니다. |
| Vertical Movement | 패턴의 상하 이동 방향과 속도를 정합니다. |
| Show Border | letterbox/pillarbox를 제외한 실제 영상 가장자리에 2픽셀 테두리를 표시합니다. |
| Show Square | 영상 중앙에 정사각형을 표시합니다. pixel/image aspect ratio 보정이 맞으면 화면에서도 가로와 세로가 같아야 합니다. |
| Insert SAV Code in Image | 영상에 SAV(Start of Active Video) 코드를 넣어 수신기가 이를 실수로 해석하지 않고 무시하는지 검사합니다. |
| Insert EAV Code in Image | 영상에 EAV(End of Active Video) 코드를 넣어 같은 동작을 검사합니다. |
| Insert Video Guard Band | 3/4-byte RGB에서 영상 왼쪽에 HDMI Video Guard Band 값과 같은 0xab/0x55/0xab 픽셀 4열을 넣습니다. 영상을 왼쪽으로 옮겨 값만 계속 건너뛰는 잘못된 수신기가 sync를 잃거나 line을 이동시키는지 시험합니다. |
Capture Feature Selection Controls
741-862다음 control은 video capture의 sensor 방향, aspect ratio, timestamp, colorspace와 crop/compose/scale 기능을 선택합니다. CSC Colorbar가 아닌 패턴은 원래 75% signal intensity를 보존하도록 colorspace conversion을 거치지 않습니다.
| Control | 동작 |
|---|---|
| Sensor Flipped Horizontally | 영상을 수평 반전하고 V4L2_IN_ST_HFLIP을 설정해 뒤집혀 장착된 sensor를 흉내 냅니다. |
| Sensor Flipped Vertically | 영상을 수직 반전하고 V4L2_IN_ST_VFLIP을 설정합니다. |
| Standard Aspect Ratio | TV/S-Video 입력의 4x3, 16x9, anamorphic widescreen을 선택하며 letterbox가 생길 수 있습니다. |
| DV Timings Aspect Ratio | HDMI 입력의 source width/height 비율, 4x3, 16x9를 선택하며 letterbox나 pillarbox가 생길 수 있습니다. |
| Timestamp Source | 각 buffer의 timestamp를 취하는 시점을 선택합니다. |
| Colorspace | CSC Colorbar 생성에 사용할 colorspace를 선택합니다. 변경하면 V4L2_EVENT_SOURCE_CHANGE를 보냅니다. |
| Transfer Function | CSC Colorbar의 colorspace transfer function을 선택하며 변경 시 V4L2_EVENT_SOURCE_CHANGE를 보냅니다. |
| Y'CbCr Encoding | RGB가 아닌 Y'CbCr 형식의 encoding을 선택하며 변경 시 source-change event를 보냅니다. |
| Quantization | RGB 또는 Y'CbCr test pattern의 quantization을 선택하며 변경 시 source-change event를 보냅니다. |
| Limited RGB Range (16-235) | HDMI source의 RGB 범위를 limited/full로 지정하고 Rx RGB Quantization Range와 반대로 설정해 잘못된 source 정보 처리도 시험합니다. |
| Apply Alpha To Red Only | Alpha Component control 값을 test pattern의 빨간색에만 적용합니다. |
| Enable Capture Cropping | ccs_cap_mode=-1이고 no_error_inj=0일 때 capture crop 지원을 켭니다. |
| Enable Capture Composing | ccs_cap_mode=-1이고 no_error_inj=0일 때 capture compose 지원을 켭니다. |
| Enable Capture Scaler | ccs_cap_mode=-1이고 no_error_inj=0일 때 최대 4배 상하향 scaler를 켭니다. |
| Maximum EDID Blocks | 저장할 EDID block 수를 정합니다. 내용은 해석하지 않으며 표준 최대치인 256개까지 저장합니다. |
| Fill Percentage of Frame | 영상 상단 X%만 그려 큰 해상도에서 driver의 CPU 부하를 줄입니다. |
Output Feature Selection Controls
863-887다음 control은 video output 전용입니다.
| Control | 동작 |
|---|---|
| Enable Output Cropping | ccs_out_mode=-1이고 no_error_inj=0일 때 output crop을 켭니다. |
| Enable Output Composing | ccs_out_mode=-1이고 no_error_inj=0일 때 output compose를 켭니다. |
| Enable Output Scaler | ccs_out_mode=-1이고 no_error_inj=0일 때 최대 4배 상하향 scaler를 켭니다. |
Error Injection Controls
888-987앞 네 control 중 Standard 관련 두 개는 video/VBI capture, DV Timings 관련 두 개는 video capture에 적용됩니다. 나머지는 `no_error_inj=0`일 때만 나타나며 video/VBI capture/output과 SDR capture에 적용됩니다. Disconnect만 모든 장치에 적용됩니다.
| Control | 시험 동작 |
|---|---|
| Standard Signal Mode | video/VBI capture에서 VIDIOC_QUERYSTD의 반환 동작을 선택하고 input condition 변경을 흉내 내는 source-change event를 보냅니다. |
| Standard | 앞 control이 Selected Standard일 때 VIDIOC_QUERYSTD가 반환할 표준을 선택하고 변경 event를 보냅니다. |
| DV Timings Signal Mode | video capture에서 VIDIOC_QUERY_DV_TIMINGS의 반환 동작을 선택하고 cable 연결 상태 변경을 흉내 냅니다. |
| DV Timings | 앞 control이 Selected DV Timings일 때 반환할 timing을 선택하고 변경 event를 보냅니다. |
| Wrap Sequence Number | struct v4l2_buffer의 sequence number wraparound를 시험합니다. |
| Wrap Timestamp | struct v4l2_buffer의 timestamp wraparound를 시험합니다. |
| Percentage of Dropped Buffers | driver가 반환하지 않고 drop할 buffer 비율을 정합니다. |
| Disconnect | USB disconnect를 흉내 냅니다. 열린 filehandle을 모두 닫아야 장치가 다시 연결됩니다. |
| Inject V4L2_BUF_FLAG_ERROR | 다음 반환 frame에 error flag를 설정해 손상된 frame으로 표시합니다. |
| Inject VIDIOC_REQBUFS Error | 다음 REQBUFS/CREATE_BUFS에서 videobuf2 queue_setup()이 -EINVAL을 반환하게 합니다. |
| Inject VIDIOC_QBUF Error | 다음 VIDIOC_QBUF/VIDIOC_PREPARE_BUFFER에서 videobuf2 buf_prepare()가 -EINVAL을 반환하게 합니다. |
| Inject VIDIOC_STREAMON Error | 다음 VIDIOC_STREAMON에서 videobuf2 start_streaming()이 -EINVAL을 반환하게 합니다. |
| Inject Fatal Streaming Error | vb2_queue_error()를 호출해 streaming core를 fatal error 상태로 만들며 streaming을 중지해야 복구됩니다. |
VBI Raw Capture Controls
988-996`Interlaced VBI Format`을 설정하면 raw VBI 데이터를 field별로 묶지 않고 interlaced 형식으로 제공합니다.
Digital Video Controls
997-1023`Rx RGB Quantization Range`는 HDMI input의 RGB quantization 감지 값을 정합니다. `Limited RGB Range (16-235)`와 반대로 설정하고 `Gray Ramp`를 선택하면 source가 잘못된 범위 정보를 줄 때의 효과를 쉽게 확인할 수 있습니다.
`Tx RGB Quantization Range`는 HDMI transmitter에서 흔한 output control이지만 현재 vivid에서는 사용하지 않습니다. `Transmit Mode`는 HDMI output을 HDMI 또는 DVI-D로 정하며 DVI-D는 항상 sRGB로 보고됩니다.
FM Radio Receiver Controls
1024-1081| Control | 동작 |
|---|---|
| RDS Reception | RDS receiver 활성화 여부를 정합니다. |
| RDS Program Type | 수신한 RDS program type을 읽기 전용으로 제공합니다. |
| RDS PS Name | 수신한 program service name을 읽기 전용으로 제공합니다. |
| RDS Radio Text | 수신한 radio text를 읽기 전용으로 제공합니다. |
| RDS Traffic Announcement | 수신한 traffic-announcement 상태를 읽기 전용으로 제공합니다. |
| RDS Traffic Program | 수신한 traffic-program 상태를 읽기 전용으로 제공합니다. |
| RDS Music | 수신한 music/speech 상태를 읽기 전용으로 제공합니다. |
| Radio HW Seek Mode | VIDIOC_S_HW_FREQ_SEEK가 Bounded, Wrap Around, Both 중 어떤 방식을 지원할지 정합니다. |
| Radio Programmable HW Seek | 사용자가 HW seek 상하한을 지정할지, 주파수 대역 경계를 쓸지 정합니다. |
| Generate RBDS Instead of RDS | 유럽식 RDS 대신 미국식 RBDS를 생성하며 PICODE와 PTY code에 영향을 줍니다. |
| RDS Rx I/O Mode | application이 read()로 block을 받는 Block I/O와 위 control로 데이터를 받는 Controls 중에서 선택합니다. |
vivid의 RDS control 구현은 기본적인 수준입니다. read-only 값은 새 주파수를 설정하거나 VIDIOC_G_TUNER로 tuner status를 읽을 때만 갱신됩니다. Block I/O mode에서는 이 control들이 inactive입니다.
FM Radio Modulator Controls
1082-1125| Control | 동작 |
|---|---|
| RDS Program ID | 송신할 RDS program ID를 설정합니다. |
| RDS Program Type | 송신할 RDS program type을 설정합니다. |
| RDS PS Name | 송신할 program service name을 설정합니다. |
| RDS Radio Text | 송신할 radio text를 설정합니다. |
| RDS Stereo | 송신할 stereo 상태를 설정합니다. |
| RDS Artificial Head | 송신할 artificial-head 상태를 설정합니다. |
| RDS Compressed | 송신할 compressed 상태를 설정합니다. |
| RDS Dynamic PTY | 송신할 dynamic-PTY 상태를 설정합니다. |
| RDS Traffic Announcement | 송신할 traffic-announcement 상태를 설정합니다. |
| RDS Traffic Program | 송신할 traffic-program 상태를 설정합니다. |
| RDS Music | 송신할 music/speech 상태를 설정합니다. |
| RDS Tx I/O Mode | application이 write()로 block을 넘기는 Block I/O와 위 control 값을 쓰는 Controls 중에서 선택합니다. |
Metadata Capture Controls
1126-1137`Generate PTS`를 설정하면 metadata stream에 Presentation timestamp를 넣고 `Generate SCR`을 설정하면 Source Clock 정보를 넣습니다.
Video, Sliced VBI 및 HDMI CEC Looping
1138-1204같은 vivid 인스턴스뿐 아니라 서로 다른 인스턴스 사이에서도 video loop를 지원합니다. S-Video output/input 사이에는 video와 sliced VBI를, HDMI output/input 사이에는 video와 HDMI CEC를 loop할 수 있습니다.
`HDMI/S-Video XXX-N Is Connected To` control에서 Test Pattern Generator, disconnected, 임의 인스턴스의 output 중 하나를 입력 source로 선택합니다. XXX는 `n_devs`의 인스턴스 번호이고 N은 해당 인스턴스의 N번째 connector입니다. 기본 한 인스턴스에서는 S-Video 000-0 또는 HDMI 000-0 입출력을 연결할 수 있으며 실제 cable 연결·해제와 같습니다.
output video가 input으로 loop되려면 다음 조건을 모두 만족해야 합니다.
- 현재 선택한 input이 control 이름의 input과 같아야 합니다.
- output 인스턴스의 현재 output이 control 값의 output과 같아야 합니다.
- 입출력 해상도가 같아야 합니다. 720x576 50 Hz와 720x480 60 Hz, 720p60과 1080p30은 연결할 수 없습니다.
- pixel format이 같아야 하며 driver는 format conversion을 하지 않습니다.
- field 설정이 같아야 합니다. Field Alternate는 양쪽 모두 써야 하고 capture의 sequence/field count가 완전히 정확하지 않을 수 있습니다.
- V4L2_FIELD_SEQ_TB/BT는 구현 복잡도와 낮은 사용 빈도 때문에 지원하지 않습니다.
- S-Video의 Standard Signal Mode 또는 HDMI의 DV Timings Signal Mode가 유효한 signal을 input에 전달하도록 설정되어야 합니다.
조건을 만족하지 않으면 `Noise` pattern이 표시됩니다. frame rate는 같지 않아도 되며 기본적으로 loop video 위에 OSD가 겹쳐집니다. capture의 `OSD Text Mode`로 끌 수 있습니다.
VBI loop는 위 조건에 더해 output이 sliced VBI여야 합니다. capture는 raw 또는 sliced 모두 가능하지만 현재 loop되는 데이터는 60 Hz의 CC/XDS와 50 Hz의 WSS뿐이며 teletext는 제외됩니다.
Radio 및 RDS Looping
1205-1228vivid는 RDS output을 input으로 loop합니다. radio는 무선이므로 receiver와 transmitter 주파수가 가까우면 자동으로 발생하고 transmitter가 가상 station을 덮어씁니다. RDS loop는 현재 같은 vivid 인스턴스 안에서만 지원합니다.
receiver는 정규 간격 station에 대한 signal strength를 VIDIOC_G_TUNER로 반환하지만 transmitter 주파수가 더 강한 signal을 만들면 그 설정과 RDS 데이터를 유효 station처럼 사용합니다. driver 로드 직후에는 receiver와 transmitter 기본 주파수가 달라 loop되지 않습니다.
Cropping, Composing, Scaling
1229-1262crop, compose, scale의 모든 조합을 지원합니다. 보통 vivid control로 선택하지만 `ccs_cap_mode`, `ccs_out_mode` module option으로 고정할 수도 있습니다.
webcam은 discrete frame size를 VIDIOC_ENUM_FRAMESIZES로 열거하므로 이 세 기능을 지원하지 않습니다. 이는 V4L2 API 제약을 재현한 것이며 TV/S-Video/HDMI 입출력에만 적용됩니다.
scaler의 절대 범위는 16x16부터 (4096 * 4) x (2160 * 4)까지지만 한 번에 1/4배부터 4배까지만 변환합니다. 1280x720 source에서는 320x180부터 5120x2880까지이며 qv4l2로 관계를 시험할 수 있습니다.
VIDIOC_S_FMT가 허용하지만 많은 driver가 구현하지 않는 큰 `bytesperline`도 지원합니다. scaler는 속도와 단순성을 위한 Coarse Bresenham 방식이며 조합이 허용하면 streaming 중 crop/compose rectangle을 바꿀 수 있습니다.
Formats
1263-1287일반 packed/planar 4:4:4, 4:2:2, 4:2:0 YUYV, 8/16/24/32-bit packed RGB와 여러 multiplanar 형식을 지원합니다. alpha 형식에서는 `Alpha Component` 값을 사용하고 `Apply Alpha To Red Only`를 켜면 빨간색에만 alpha를 적용하며 나머지는 0으로 둡니다.
multiplanar 형식/API는 `multiplanar` module option으로 켭니다. 이 모드에서는 첫 single-planar YUYV와 NV16M/NV61M 형식에 `data_offset=128`인 plane이 있어 드문 non-zero offset 처리를 시험할 수 있습니다. video output은 application이 지정한 data_offset도 따릅니다.
Output Overlay
1288-1320output overlay는 기존 V4L2 output-overlay API 시험을 위해 구현되었으며 새 driver에서 이 API를 쓸지는 신중히 판단해야 합니다.
bitmap clipping, 최대 16 rectangle의 list clipping, chromakey, source chromakey, global/local alpha, local inverse alpha를 지원합니다.
multiplanar 형식에서는 지원하지 않으며 capture와 framebuffer pixel format이 같아야 합니다. 다르면 VIDIOC_OVERLAY가 오류를 반환합니다. `node_types`에 0x10000을 설정해 720x576 framebuffer를 만들어야 하고 ARGB 1:5:5:5와 RGB 5:6:5를 지원합니다.
clipping, chromakey, alpha 결과를 보려면 video loop를 켜고 capture 쪽에서 확인합니다. 각 pixel에 많은 검사가 필요하므로 이런 기능은 loop 속도를 크게 낮춥니다.
CEC (Consumer Electronics Control)
1321-1339HDMI 입력이 있으면 입력 port 수와 같은 CEC adapter를 만듭니다. 각 HDMI output도 대응 입력 port에 연결된 adapter를 만들고 output이 더 많으면 남는 adapter는 연결하지 않습니다. 이는 여러 source 장치를 TV 입력에 연결한 구성을 흉내 냅니다.
각 output이 읽는 EDID의 고유 CEC physical address는 input EDID를 바탕으로 합니다. receiver가 A.B.0.0이면 output은 A.B.C.0을 보고하며 C는 1부터 입력 수까지입니다. 입력보다 많은 output의 CEC adapter는 disabled이고 invalid physical address를 보고합니다.
향후 개선 항목
1340-1361현재 문서가 제시하는 향후 개선 후보는 다음과 같습니다.
- audio 시험용 virtual ALSA driver와 virtual sub-device 추가
- compressed video 시험 지원
- raw VBI output-input loop와 teletext sliced VBI loop 추가
- alternate-field video loop의 sequence/field numbering 수정
- video output의 V4L2_CID_BG_COLOR 지원
- alpha channel 시험을 강화하는 ARGB888 overlay 지원
- 실제 v4l2_fract를 전달하도록 TPG pixel-aspect 처리 개선
- per-queue/per-device lock으로 throughput 개선
- SDR이 일반 receiver와 같은 station 주파수를 쓰고 불일치 시 noise를 반환하도록 개선
- RDS 생성 thread로 Controls RDS Rx I/O Mode의 read-only control을 실시간 갱신
- EDID 변경 뒤 HPD signal을 설정하기 전에 100 ms를 기다리도록 수정
vivid 검증 영역
vivid.rst:1-1361vivid는 단순 영상 생성기를 넘어 node 구성, timing, colorspace, field, buffer I/O, control event, loop, CEC, 고장 복구까지 V4L2 application의 전체 동작면을 재현합니다.