NAME
SUNWrtvc - XIL driver for SunVideo capture/compression card
DESCRIPTION
SUNWrtvc is the XIL device driver for the SunVideo SBus
video capture/compression card. The interface to SUNWrtvc
is through the following XIL calls:
xil_device_create(3)
xil_device_set_value(3)
xil_create_from_device(3)
xil_get_device_attribute(3)
xil_set_device_attribute(3)
The compression capabilities are handled automatically
through the XIL deferred execution scheme. Deferred
execution looks for specific sequences of atomic operations
that can be grouped into molecules to reduce execution time.
The molecules that are accelerated are listed in the
"MOLECULES" section.
For xil_device_create(3), the device parameter should be
SUNWrtvc. For xil_create_from_device(3), the devicename
parameter should be SUNWrtvc, and the deviceObj parameter
can be a NULL, in which case /dev/rtvc0 is opened. To open
another device such as /dev/rtvc1, set the DEVICE_NAME
attribute with xil_device_set_value(3) before calling
xil_create_from_device(3). The image returned will be a
640x480 (768x576) 3-banded YUV image for an NTSC (PAL) video
signal.
The following device attributes are available with the
SUNWrtvc device:
DEVICE_NAME
FRAME_NUMBER
PORT_V
PORT
FIRST_SCANLINE
TIMESTAMP
FORMAT_V
FORMAT
IMAGE_SKIP
MAX_BUFFERS
NUM_BUFFERS
FULL_BUFFERS
FLUSH_BUFFERS
FILE_DESCRIPTOR
MPEG_RATE_CONTROL
MPEG_FIXED_QUANT
MPEG_WEIGHTS
The following paragraphs describe the attributes in more
detail. Note that some attributes are "set-only" and others
are "get-only." This is noted under the Access heading for
each attribute.
There are two methods for setting device attributes. The
first method is to call the xil_device_create(3) and
xil_device_set_value(3) functions prior to creating the
device image with the xil_create_from_device(3) function.
The second method is to call xil_device_set_attribute(3)
after calling xil_create_from_device(3).
The DEVICE_NAME device attribute must be set using the first
method. All other device attributes can be set using either
method.
DEVICE_NAME
Description Sets the pathname of the rtvc (SunVideo)
device.
Access set/get
Type char *
Default "/dev/rtvc0"
FRAME_NUMBER
Description Provides an ID for the last captured frame.
Access get
Type int
PORT_V
Description Defines which of the three ports video will
be captured from.
Access set/get
Type int
0 is the S_VIDEO port.
1 is the COMPOSITE VIDEO #1 port.
2 is the COMPOSITE VIDEO #2 port.
Default 1
PORT
Description A string interface to set the port.
Access set/get
Type char *
S VIDEO is the S_VIDEO port.
COMPOSITE VIDEO 1 is the COMPOSITE VIDEO #1
port.
COMPOSITE VIDEO 2 is the COMPOSITE VIDEO #2
port.
Default "COMPOSITE VIDEO 1"
FIRST_SCANLINE
Description FIRST_SCANLINE sets or gets the number of the
scanline in the first field of video that
will be the top scanline in a CIF image.
Although scanline 21 is supposed to contain
active video, some video devices may not
provide active video until line 22 or line
23. Therefore, the default FIRST_SCANLINE
value for both NTSC and PAL is line 23.
You can set the FIRST_SCANLINE attribute to
adjust an image vertically in a window. This
can be useful if you want to read a scanline
that's above or below the scanlines in a
nominally active frame. You can also change
the attribute to adjust for variations in
video devices.
Depending on the video source, some legal
values of this attribute can cause captures
after the attribute is set to return the
following error message:
XILDefaultErrorFunc:
error category: System
error string: SUNWrtvc: Data Capture failed
error id: SUNWrtvc-3
...
object info: Timer expired
The SUNWrtvc device driver also returns an
error if you set the attribute to a negative
or out-of-range number.
Access set/get
Type int
TIMESTAMP
Description Returns a pointer to a volatile hrtime_t that
always contains the timestamp for the most
recently captured frame. Therefore, this
attribute only needs to be retrieved once.
The timestamp value is updated each time a
capture operation occurs. This enables you to
associate a timestamp with each captured
frame.
The pointer points to an hrtime_t, which is
an 8 byte (long long) timestamp. The units
are expressed as "nanoseconds since boot."
See the gethrtime(3C) man page for
information about hrtime_t.
Access get
Type hrtime_t * (defined in <sys/time.h>)
FORMAT_V
Description Returns 0 if the format is unknown, 1 if
capturing from PAL, and 2 if capturing from
NTSC.
Access get
Type int
FORMAT
Description Returns the video format being captured
("NTSC," "PAL," or "UNKNOWN").
Access get
Type char *
IMAGE_SKIP
Description Sets/returns the number of images to skip
between captures. You can use the IMAGE_SKIP
attribute to pace the flow of images. For
example, an application that supports
security cameras could use the attribute to
provide images at 30 second intervals.
Another example is when you want to limit the
frame rate to match a network's bandwidth. To
capture NTSC frames at a rate of
approximately 10 fps, you would set the
IMAGE_SKIP attribute to 2. This causes the
SunVideo card to capture every third frame.
You can use the values returned by the
NUM_BUFFERS and FULL_BUFFERS attributes to
determine if the IMAGE_SKIP value should be
changed.
Access set/get
Type int
Default 0
MAX_BUFFERS
Description MAX_BUFFERS sets and returns the maximum
number of images that the SunVideo card's
DRAM can store while waiting for the host to
download the images. The value must be in the
range between 0 and 64.
The value of MAX_BUFFERS has a direct effect
on latency, and you should experiment to find
the best value for your particular
application. A value of 2 (the default)
provides double buffering, which enables the
SunVideo firmware to write a compressed image
into one buffer while the host is downloading
the image from the other buffer.
A value of zero means to buffer as many
images as possible. A higher value means that
the SunVideo card is less likely to drop
frames, but the latency may be increase as a
result of the buffering. If you are capturing
images to a file, latency isn't an issue, and
you would use the maximum number of buffers.
Access set/get
Type int
Default 2
NUM_BUFFERS
Description NUM_BUFFERS returns an integer that specifies
the number of buffers that can be used to
hold captured frames. The NUM_BUFFERS value
will be less than or equal to the value of
the MAX_BUFFERS attribute.
An application can use the NUM_BUFFERS
attribute, in conjunction with the
FULL_BUFFERS attribute, to determine whether
the IMAGE_SKIP value should be changed. The
NUM_BUFFERS attribute returns a valid value
after the first capture (or capture/compress)
operation has been performed.
Access get
Type int
FULL_BUFFERS
Description FULL_BUFFERS returns an integer that
specifies the current number of buffers that
contain valid data. An application can use
this attribute, in conjunction with the
NUM_BUFFERS attribute, to determine whether
the IMAGE_SKIP value should be changed.
Access get
Type int
FLUSH_BUFFERS
Description If the FLUSH_BUFFERS attribute is set, then
all saved buffers (see "MAX_BUFFERS") will be
flushed before the next image is captured.
After the operation completes, the value of
FULL_BUFFERS is set to zero. The input value
of the set attribute call is ignored.
Access set
Type void *
FILE_DESCRIPTOR
Description Returns the file descriptor that was used to
open the rtvc device. This file descriptor
can be used as input to the poll(2) call in
order to determine when a frame is available.
Access get
Type int
MPEG_RATE_CONTROL
Description Creates a constant bit rate MPEG-1 bitstream
when this attribute is set to TRUE.
The constant bit rate firmware cannot
compress PAL at 384 x 288. Instead, a
centered 320 x 240 image is compressed when
PAL is the source.
If an application is using xil_get_info(3) to
ask the SunVideo capture device for the type
of image it will provide, the application
should set this attribute before the call to
xil_get_info(3).
If this attribute is set to TRUE, only the
compression of an MPEG-1 CIS is valid.
Access set/get
Type Xil_boolean (defined in xil.h)
Default FALSE
MPEG_FIXED_QUANT
Description Sets the quantizer scale for the bitstream,
which effects the quality of SunVideo's
variable bit rate MPEG-1 compressor.
The integer range of values for this
attribute is 1 to 31. A value of 1 produces
the highest quality bitstream but also
produces the most bits/sec for a given frame
rate. A value of 31 produces the poorest
quality. Set values are clipped to the valid
range.
Access set/get
Type int
Default 4
MPEG_WEIGHTS
Description Sets the weights for I, P, and B frames for
SunVideo's constant bit rate MPEG-1
compressor. This attribute takes as its value
a pointer to a struct of three integers. For
example,
typedef struct {
int weight_i;
int weight_p;
int weight_b;
} RtvcMpeg1Weights;
RtvcMpeg1Weights w;
w.weight_i = 10;
w.weight_p = 6;
w.weight_b = 1;
xil_set_device_attribute(image, "MPEG_WEIGHTS", (void*) &w);
This example tells the SunVideo constant bit
rate MPEG-1 compressor to allocate six times
as many bits to a P picture than a B picture
and to allocate ten times as many bits to an
I picture than a B picture (or 1.67 times as
many bits than a P picture).
Access set/get
Type struct
Default i = 4, p = 2, b = 1
MOLECULES
XIL is a general-purpose imaging library that provides many
low-level (atomic) functions that are designed to be used as
building blocks to create higher-level functions. However,
the performance of functions built from sequences of atomic
functions may not be as good as the performance of high-
level (specific-purpose) library functions. Functions in
high-level libraries, for example, can optimize (minimize)
image-paging operations by grouping operations that work on
the same image. High-level functions can also minimize the
number of temporary images that need to be created and
destroyed during an operation.
Instead of providing directly callable high-level functions,
XIL provides a deferred execution facility that
automatically recognizes certain sequences of atomic
operations and executes the sequences as a single molecule.
An example is a sequence of XIL atoms that captures, scales,
and compresses an image. XIL defers execution of the capture
atom to see if a scale atom follows. If it does, execution
of the capture and scale atoms are deferred to see if a
compression atom follows. If it does, the three atoms are
executed together as a molecule.
Note: It's important to remember that you do not call
molecules explicitly. Molecule-based acceleration occurs
automatically when the XIL deferred execution facility
recognizes specific sets of atoms.
To determine if atomic operations are executing within
molecules, set the XIL "XIL_DEBUG" environment variable to
"show_action":
% setenv XIL_DEBUG show_action
This causes the XIL library to print a message to stderr
whenever an operation that affects an XIL image or
compressed image sequence is executed.
The first two lists that follow include the color and
grayscale molecules that the SUNWrtvc device supports
currently. The third list includes the accelerated XIL
molecules to decompress and display UYVY CIS's (see
UYVY(3)). The atoms within the molecules are presented in
the sequence that they must appear to be executed as a
molecule. Atoms in square brackets are optional. For
example, the scale8nearest atom is optional in the molecule:
capture -> [scale8nearest -> ] compress_CellB
This sequence will be executed as a molecule with all three
atoms (capture, scale8nearest, and compress_CellB) or just
the capture and compress_CellB atoms.
Color Molecules
Note: Refer to the SunVideo User's Guide for the
xil_scale(3) arguments required for acceleration.
o capture -> scale8nearest
o capture -> [scale8nearest ->] colorconvert [->
display_ioSUNWcg14]
o capture -> [rescale8 ->] [scale8nearest ->]
ordereddither8_8
o capture -> scale8nearest -> rescale8 -> ordereddither8_8
o capture -> [scale8nearest -> ] compress_CellB
o capture -> scale8nearest -> compress_Mpeg1
o capture -> scale8nearest -> compress_Jpeg
o capture -> [scale8nearest ->] compress_UYVY
Grayscale Molecules
The grayscale molecules use a Y-only image, that is a
single-banded child image from the SunVideo card with a band
offset of 0.
Note: Refer to the SunVideo User's Guide for the
xil_scale(3) and xil_threshold(3) arguments required for
acceleration.
o capture -> scale8nearest
o capture -> [scale8nearest ->] [[addconst8 ->] addconst8
->] addconst8
o capture -> [scale8nearest ->] [threshold8 ->] threshold8
o capture -> [scale8nearest ->] [threshold8 ->] threshold8
-> addconst8
UYVY Support
o decompress_UYVY -> colorconvert
o decompress_UYVY -> [rescale8 ->] [scale8nearest ->]
ordereddither8_8
ERRORS
The following list contains the SUNWrtvc device driver's
error messages, organized by Message ID number.
SUNWrtvc-1 SUNWRtvc: invalid PORT specification
The application program requested a non-
existent port (either through the PORT or
PORT_V attribute).
SUNWrtvc-4 SUNWRtvc: could not open SUNWRtvc device
The open of /dev/rtvc* or /dev/rtvcctl*
failed. The reason for the failure is printed
in the default error handler. Possible causes
include: the device is being used by another
program; the device is not installed; the
program is referencing the wrong device
number.
SUNWrtvc-5 SUNWRtvc: could not set video characteristics
Either the value of the FIRST_SCANLINE
attribute is out of range, or the program
isn't able set the port's characteristics.
SUNWrtvc-8 SUNWRtvc: could not open rtvc microcode file
The file
/usr/openwin/lib/xil/devhandlers/xilIO_SUNWrtvc_ucode.a
is either non-existent or corrupt.
SUNWrtvc-9 SUNWRtvc: problem in loading rtvc microcode
file
An expected firmware program was missing from
the microcode file.
SUNWrtvc-10 SUNWRtvc: startup of CL4000 failed
Probable failure of the CL4000 compression
engine or supporting logic.
SUNWrtvc-11 SUNWRtvc: reset of CL4000 failed
Probable failure of the CL4000 compression
engine or supporting logic.
SUNWrtvc-12 SUNWRtvc: firmware parameters not
sent/received
Either the video signal coming from the
SunVideo card is bad (the video is from a VCR
running in fast forwared, for example), or
there is a firmware problem.
SUNWrtvc-13 SUNWRtvc: Data capture failed
Either the video signal coming from the
SunVideo card is bad (the video is from a VCR
running in fast forwared, for example), or
there is a firmware problem.
SUNWrtvc-14 SUNWrtvc: could not get video characteristics
The program is not able to read video
characteristics from the SunVideo card.
SUNWrtvc-15 SUNWrtvc: Invalid IMAGE_SKIP specification
The program passed an illegal value to the
xil_device_set_attribute(3) function.
SUNWrtvc-16 SUNWrtvc: Invalid MAX_BUFFERS specification
The program passed an illegal value to the
xil_device_set_attribute(3) function.
SUNWrtvc-17 SUNWrtvc: rtvc UNIX driver does not match XIL
driver
The SUNWrtvc and SUNWrtvcu packages are not
compatible.
SUNWrtvc-18 SUNWrtvc: Internal Error: Insufficient buffer
size
This internal error indicates that the
SunVideo card has encountered an internal
error (a bug). Please report this error to
Sun Microsystems.
SUNWrtvc-19 attribute MPEG_RATE_CONTROL set to TRUE but
not compressing mpeg
When the MPEG_RATE_CONTROL attribute is set
to TRUE, only compression of an MPEG-1 CIS is
valid.
SUNWrtvc-20 UYVY: WIDTH must be a positive multiple of 2
The program tried to compress a UYVY image
whose width was not a positive multiple of 2.
For a list of XIL error messages by number, consult Appendix
B of the XIL Programmer's Guide.
EXAMPLES
Create a device image attached to a SUNWrtvc card and set
the video port to be COMPOSITE VIDEO 2.
XilImage image;
XilDevice device;
device = xil_device_create(state, "SUNWrtvc");
xil_device_set_value(device, "DEVICE_NAME", (void *) "/dev/rtvc0");
image = xil_create_from_device(state, "SUNWrtvc", device);
status = xil_set_device_attribute (image, "PORT",
(void *) "COMPOSITE VIDEO 2");
if(status == XIL_FAILURE)
fprintf(stderr, "Failed to set PORT attribute");
SEE ALSO
xil_device_create(3), xil_device_set_value(3),
xil_create_from_device(3), xil_get_device_attribute(3),
xil_set_device_attribute(3).
|
Закладки на сайте Проследить за страницей |
Created 1996-2025 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |