Transferring data to or from memory requires creating a DMbuffer or VL buffer, as explained in “Transferring Video Data to and From Devices” in Chapter 5. This chapter explains how to set node controls for data transfer and consists of these sections:
To set frame data size and to convert from one video format to another, apply controls to the nodes.
Table 3-1 summarizes important data transfer controls for source and drain nodes. These controls are highly interdependent, so the order in which they are set is important; set them in the order in which they appear in the table. In most cases, the value being set takes precedence over other values that were previously set.
![]() | Note: Changes in one parameter may change the values of other parameters set earlier; for example, clipped size may change if VL_OFFSET is set after VL_SIZE. |
Table 3-1. Nodes and Data Transfer Controls
Control | Sets ... | Memory Nodes | Screen Node | Video Nodes |
---|---|---|---|---|
Format | Selects color space | Not applicable | Selects physical connector | |
Video timing | Yes | Yes | Yes | |
Type of field(s) or frame(s) to capture | Yes | Not applicable | Not applicable | |
Color space of video data in memory | Yes | Not applicable | Not applicable | |
Pixel packing (conversion) format | Changes pixel format of captured data | Not applicable | Not applicable | |
Scaling down to any size between the full field/frame size and a certain number of pixels | Yes | Scales a selected region of the graphics display from unity (1/1) to 2 pixels by 2 lines | Set only to 1/1 | |
Horizontal scale factor; used with VL_ZOOM to correct aspect ratio | Effective horizontal scale factor is VL_ZOOM * VL_ASPECT | Effective horizontal scale factor is VL_ZOOM * VL_ASPECT | Not applicable | |
Clipping size | Yes | Yes | Full size of video, read only | |
Position within larger area relative to VL_ORIGIN | Offset relative to video offset | Sets where the scaled images produced by this node are inserted into a video frame, for centering or other placement | Set only to (0,0) | |
Position within video | Not applicable | Screen position of first pixel displayed; works with VL_SIZE | Not applicable | |
Field or frame transfer speed | Yes | Not applicable | Not applicable | |
Enables or disables flicker reduction | Not applicable | Yes | Not applicable | |
Freezes the image | Not applicable | Graphic updates are not reflected in the generated video signal | Set only to FALSE for source nodes because device does not support frozen inputs |
To determine default values, use vlGetControl() to query the values on the video source or drain node before setting controls. The initial offset of the video node is the first active line of video.
Similarly, the initial size value on the video source or drain node is the full size of active video being captured by the hardware, beginning at the default offset. Because some hardware can capture more than the size given by the video node, this value should be treated as a default size.
For all these controls, it pays to track return codes. If the value returned is VLValueOutOfRange, the value set is not what you requested.
To specify the controls, use vlSetControl(), for which the function prototype is
int vlSetControl(VLServer vlSvr, VLPath vlPath, VLNode node, VLControlType type, VLControlValue * value) |
Timing type expresses the timing of video presented to a source or drain. Table 3-2 summarizes dimensions for VL_TIMING.
Table 3-2. Dimensions for Timing Choices
| Maximum Width | Maximum Height |
---|---|---|
VL_TIMING_525_SQ_PIX (12.27 MHz) | 640 | 486 |
VL_TIMING_625_SQ_PIX (14.75 MHz) | 768 | 576 |
VL_TIMING_525_CCIR601 (13.50 MHz) | 720 | 486 |
VL_TIMING_625_CCIR601 (13.50 MHz) | 720 | 576 |
VL_TIMING is applicable on all OCTANE Personal Video nodes. However, the timing standard for the O2Cam digital camera input can be only NTSC square-pixel or CCIR 525-line nonsquare-pixel timing (VL_TIMING_525_SQ_PIX or VL_TIMING_525_CCIR601).
The VL_TIMING control affects how the video signal is sampled. Internally, the OCTANE Personal Video board represents all video signals as nonsquare (CCIR601 525-line or 625-line).
Use parameters VL_TIMING_525_SQ_PIX and VL_TIMING_625_SQ_PIX, which convert nonsquare pixels to square pixels to avoid multiple filters being applied to video.
Once the aspect ratio is accounted for, square-pixel and nonsquare-pixel images have differently sized active regions. In nonsquare modes, the active region is 720 pixels across. In square modes, the active region is 640 pixels for NTSC and 768 pixels for PAL. Correcting for the aspect ratio with a 11/10 filter, the result is 640 × 11/10 = 704, or 16 pixels short of the nonsquare sampling.
The OCTANE Personal Video option software includes a memory drain and video drain control, VL_EVO_FILTER_TYPE, that selects between two methods of converting square pixel images to nonsquare pixel images, or vice versa:
VL_EVO_FILTER_TYPE_FREQ selects the frequency-preserving filter, which preserves the aspect ratio of the image exactly.
For example, a circle displayed on a nonsquare video monitor looks the same as on a square graphics display, with no distortion. However, the width of the active region is not the same: a line of 720 nonsquare pixels does not map directly to a line of 640 or 768 square pixels.
VL_EVO_FILTER_TYPE_SPAT selects the spatially preserving filter, which preserves the width of the active region.
This filter takes in 640 horizontal pixels and produces 720 horizontal pixels. In the other direction, the 720-pixel line in nonsquare mode maps directly to the 640 or 768 pixels in square mode.
Although the spatially preserving filter preserves the contents of a line, it does not preserve the frequency characteristics of the image. For example, a circle in square pixel mode is slightly distorted in nonsquare pixel mode when displayed on a video monitor; however, the entire active region in the nonsquare case is filled.
![]() | Note: When square-pixel data is sent to video out, the conversion can be either frequency-preserving or spatially preserving. When video is captured to memory, only frequency-preserving conversions are performed for NTSC square-to-nonsquare conversion and PAL nonsquare-to-square conversions (regardless of the VL_EVO_FILTER_TYPE setting). |
VL_FORMAT has two sets of parameters, depending on whether it is applied to a memory node or a video node. (It is not applicable to the screen node.) For memory nodes, VL_FORMAT specifies the color space; for video nodes, VL_FORMAT selects the connector on the board.
This section discusses
Generally, you set color space with VL_COLORSPACE. VL_FORMAT values are provided for compatibility with existing applications. Table 3-3 shows the correspondence.
Table 3-3. VL_FORMAT and VL_COLORSPACE Correspondence
VL_FORMAT Value | VL_COLORSPACE Value |
---|---|
VL_FORMAT_DIGITAL_COMPONENT_SERIAL | VL_COLORSPACE_CCIR601 |
VL_FORMAT_DIGITAL_COMPONENT_RGB_SERIAL | VL_COLORSPACE_RP175 |
VL_FORMAT_SMPTE_YUV | VL_COLORSPACE_YUV |
VL_FORMAT_RGB | VL_COLORSPACE_RGB |
VL_FORMAT works in conjunction with VL_VIDEO node parameters to select the input connector on the OCTANE Personal Video option board. Applied to video source nodes, VL_FORMAT has five parameters, as summarized in Table 3-4.
Table 3-4. Using VL_FORMAT to Select Input Connector (Video Source Nodes)
Control Parameter | Connector |
---|---|
VL_FORMAT_SVIDEO | S-Video (Y/C) |
VL_FORMAT_COMPOSITE | Composite (BNC) |
VL_FORMAT_CAMERA | O2Cam connector (68-pin D) |
None; used for loopback from analog video out to analog video in with no cable necessary | |
VL_FORMAT_DIGITAL_COMPONENT_SERIAL | O2Cam connector used as digital input, with appropriate third-party converter attached |
![]() | Note: The O2Cam connector can be a digital input when an appropriate third-party serial digital converter is connected to it. |
These control parameters must be used in conjunction with VL_VIDEO source node parameters to select the connector:
Table 3-5 summarizes how the VL_VIDEO source node parameters and the VL_FORMAT parameters work together.
Table 3-5. VL_VIDEO Source Nodes
To select ... | For Connector ... | Set VL_VIDEO Parameter ... | And VL_FORMAT Parameter ... |
---|---|---|---|
4:2:2 YCrCb | O2Cam connector with third-party serial digital converter | VL_EVO_NODE_NUMBER | VL_FORMAT_DIGITAL |
O2Cam digital camera | O2Cam connector with O2Cam digital camera attached | VL_EVO_NODE_NUMBER | VL_FORMAT_CAMERA |
Composite | Analog video BNC | VL_EVO_NODE_NUMBER | VL_FORMAT_COMPOSITE |
Y/C (S-Video) | Analog video 8-pin mini-DIN | VL_EVO_NODE_NUMBER | VL_FORMAT_SVIDEO |
Loopback from analog video out to analog video in | None | VL_EVO_NODE_NUMBER |
To select a video input format, call vlGetNode() with the video source node number of interest. After setting up a path, set the VL_FORMAT control on that node to the appropriate value. For example, to select the composite video BNC, get a node by passing node number VL_EVO_NODE_NUMBER_VIDEO_3 to vlGetNode(), set up a path, and then set VL_FORMAT to VL_FORMAT_COMPOSITE, as illustrated in this example:
src_node = vlGetNode(svr, VL_SRC, VL_VIDEO,VL_EVO_NODE_NUMBER_VIDEO_3); path = vlCreatePath(svr, dev, src_node, drain_node); vlSetupPaths(svr, (VLPathList)&path, 1, VL_SHARE, VL_SHARE); ctlVal.intVal = VL_FORMAT_COMPOSITE; vlSetControl(svr, path, src_node, VL_FORMAT, &ctlVal); |
Because there is only one VL_VIDEO drain node, it has no number parameters and drives all output connectors at once. Thus, it is not strictly necessary to set a VL_FORMAT value to select the output connector. However, Table 3-6 shows VL_FORMAT values for various connectors.
Table 3-6. Using VL_FORMAT to Select Output Connector (Optional)
To select ... | For Output Connector ... | VL_FORMAT Value |
---|---|---|
Y/C (S-Video) | Analog video 4-pin mini-DIN | VL_FORMAT_SVIDEO |
Composite | BNC | VL_FORMAT_COMPOSITE |
4:2:2 YCrCb | O2Cam connector with third-party serial digital converter | VL_FORMAT_DIGITAL_COMPONENT |
A video packing describes how a video signal is stored in memory, in contrast with a video format, which describes the characteristics of the video signal. For example, the memory source nodes accept packed video from a DMbuffer or VL buffer and output video in a given format.
Packings are specified through the VL_PACKING control on the memory nodes. This control also converts one video output format to another in memory, within the limits of the nodes.
Table 3-7 summarizes packing types for eight bits per component.
Table 3-7. Packing Types for Eight Bits per Component
Type | Use | 63-56 | 55-48 | 47-40 | 39-32 | 31-24 | 23-16 | 15-8 | 7-0 |
---|---|---|---|---|---|---|---|---|---|
YUV 4:2:2 | U0 | Y0 | V0 | Y1 | U2 | Y2 | V2 | Y3 | |
YUVA 4:4:4:4 | A0 | U0 | Y0 | V0 | A1 | U1 | Y1 | V1 | |
AUYV 4:4:4:4 | V0 | Y0 | U0 | A0 | V1 | Y1 | U1 | A1 | |
YCrCb, 8 bits per component packed into 24 bits (3 bytes) per pixel | V0 | Y0 | U0 | V1 | Y1 | U1 | V2 | Y2 | |
RGBA | A0 | B0 | G0 | R0 | A1 | B1 | G1 | R1 | |
ABGR | R0 | G0 | B0 | A0 | R1 | G1 | B1 | A1 | |
RGB; each 8-bit pixel, Pn, is shown as BBGGGRRR | P7 | P6 | P5 | P4 | P3 | P2 | P1 | P0 | |
Grayscale (luminance only) | Y7 | Y6 | Y5 | Y4 | Y3 | Y2 | Y1 | Y0 | |
RGB, 24-bit word, Xn are ignored | X0 | B0 | G0 | R0 | X1 | B1 | G1 | R1 | |
RGB | R0 | G0 | B0 | R1 | G1 | B1 | R2 | G2 |
![]() | Note: All these packings are native to the OCTANE Personal Video option, except VL_PACKING_RGB_332_P and VL_PACKING_Y_8_P, which are implemented automatically in software. |
The OCTANE Personal Video option also supports VL_PACKING_YVYU_422_10, a YUV 4:2:2 packing type for ten bits per component. The ten data bits are left-aligned within a 16-bit word; Table 3-7 summarizes this packing. The hardware sets the lower six bits to zero before it writes them to memory. In reading from memory, it ignores the lower six bits.
Table 3-8. VL_PACKING_YVYU_422_10 Bits
Bits | Component |
---|---|
63-48 | [U0]000000 |
47-32 | [Y0]000000 |
31-16 | [V0]000000 |
15-0 | [Y1]000000 |
Appendix C, “Pixel Packings and Color Spaces,” shows the layout of each packing for the OCTANE Personal Video option. It also gives the corresponding names for these packings that are used by other libraries.
For drain nodes, VL_PACKING must be set first. Note that changes in one parameter may change the values of other parameters set earlier; for example, clipped size may change if VL_PACKING is set after VL_SIZE. For example:
VLControlValue val; val.intVal = VL_PACKING_RGBA_10; vlSetControl(vlSvr, path, memdrn, VL_PACKING, &val); |
VL_ZOOM controls the scaling (decimation) of the video image, with values less than one performing the scaling. Figure 3-1 illustrates scaling.
This section explains
Applied to OCTANE Personal Video memory nodes, VL_ZOOM does not increase the size of an image, but decimates only. VL_ZOOM changes the x and y scale factors by the same amount. The effective scale size is determined by both VL_ZOOM and VL_ASPECT: the horizontal scale factor is VL_ZOOM * VL_ASPECT, and the vertical scale factor is VL_ZOOM. An example using VL_ASPECT is given later in this section.
Besides the setting of VL_ASPECT, scaling with VL_ZOOM depends on the capture type and the packing. Table 3-9 summarizes the minimum values achievable for VL_ZOOM applied to memory source and drain nodes; for these minimum values, you must also use VL_ASPECT.
Table 3-9. VL_ZOOM on Memory Nodes: Minimum Values With VL_ASPECT
Minimum Pixel Number |
|
|
---|---|---|
4 x 1 | VL_CAPTURE_NONINTERLEAVED | All but VL_PACKING_BGR_8_P or VL_PACKING_UYV_8_P |
4 x 2 | VL_CAPTURE_INTERLEAVED | All butVL_PACKING_BGR_8_P or VL_PACKING_UYV_8_P |
24 x 1 | VL_CAPTURE_NONINTERLEAVED | VL_PACKING_BGR_8_P or VL_PACKING_UYV_8_P only |
24 x 2 | VL_CAPTURE_INTERLEAVED | VL_PACKING_BGR_8_P or VL_PACKING_UYV_8_P only |
VL_ZOOM takes a nonzero fraction as its argument; do not use negative values.
To correct the x scale, use VL_ASPECT. The following example sets the horizontal scale to 1/2 and the vertical scale to 1/1:
val.fractVal.numerator=1; val.fractVal.denominator=1; vlSetControl(svr, path, memnode, VL_ZOOM, &val); val.fractVal.numeriator=1; val.fractVal.denominator=2; vlSetControl(svr, path, memnode, VL_ASPECT, &val); |
On video source and drain nodes, you can set VL_ZOOM to unity (1/1) only, because OCTANE Personal Video device does not support scaling on a video node.
On screen source nodes, if the VL_ZOOM value makes the resulting size invalid (that is, larger than a frame size), the size is constrained and a VLControlChanged event is generated. If the scaled size of the selected graphics region is smaller than the video frame size, use VL_OFFSET on the drain node to position the generated video.
Because the OCTANE Personal Video option can scale data coming from the screen source node, the minimum size (2 x 2) is the size after zooming. However, user-specified VL_SIZE numbers refer to the size before zooming. Thus, the minimum size the user can specify is the size that, when zoomed, yields 2 x 2. For example:
/* Set the (unzoomed) size to 20 pixels by 20 lines */ val.xyVal.x = 20; val.xyVal.y = 20; if (vlSetControl(server, screeen_path, screen_source_node, VL_SIZE, &val)) { vlPerror(“Unable to set size”); exit(1); } /* Set the scale factor to 1/10. This results in a scaled size of 20*1/10 by 20*1/10, or 2 pixels by 2 lines */ val.fractVal.numerator = 1; val.fractVal.denominator = 10; if (vlSetControl(server, screen_path, screen_source_node, VL_ZOOM, &val)) { vlPerror(“Unable to set zoom”); exit(1); } |
This fragment causes the screen source node to send xsize × ysize video with as much scaling as possible, assuming the size is smaller than the video stream:
if (vlGetControl(server, screen_path, screen_source, VL_SIZE, &val)) { vlPerror("Unable to get size"); exit(1); } if (val.xyVal.x/xsize < val.xyVal.y/ysize) zoom_denom = (val.xyVal.x + xsize - 1)/xsize; else zoom_denom = (val.xyVal.y + ysize - 1)/ysize; val.fractVal.numerator = 1; val.fractVal.denominator = zoom_denom; if (vlSetControl(server, screen_path, screen_source_node, VL_ZOOM, &val)) { /* allow this error to fall through */ vlPerror("Unable to set zoom"); } val.xyVal.x = xsize; val.xyVal.y = ysize; if (vlSetControl(server, screen_path, screen_source_node, VL_SIZE, &val)) { vlPerror("Unable to set size"); exit(1); |
}.
VL_SIZE controls how much of the image sent to the drain is used; that is, how much clipping takes place. This control operates on the zoomed image; for example, when the image is scaled to half size, the limits on the size control change by a factor of 2. Figure 3-2 illustrates clipping.
For example, to display PAL video in a 320 × 243 space, clip the image to that size, as shown in the following fragment:
VLControlValue value; |
value.xyVal.x=320; value.xyVal.y=243; vlSetControl(vlSvr, path, drn, VL_SIZE, &value); |
On video source and drain nodes, VL_SIZE is fixed for each timing mode:
CCIR 525: 720 x 486
CCIR 625: 720 x 576
NTSC square-pixel: 640 x 486
PAL square-pixel: 768 x 576
![]() | Note: Because this control interacts with other controls, always check the error returns. For example, if offset is set before size and an error is returned, set size before offset. |
VL_OFFSET puts the upper left corner of the video data at a specific position; it sets the beginning position for the clipping performed by VL_SIZE. The values you enter are relative to the origin.
This example places the data ten pixels down and ten pixels in from the left:
VLControlValue value; |
value.xyVal.x=10; value.xyVal.y=10; vlSetControl(vlSvr, path, drn, VL_OFFSET, &value); |
![]() | Note: To capture the blanking region, set offset to a negative value. |
Figure 3-3 shows the controls that you can apply before and after you set offset, clipping, and scaling. Once the image is clipped, you can apply VL_ZOOM to scale it further.
For memory nodes, VL_OFFSET and VL_SIZE in combination define the active region of video that is transferred to or from memory. On video source and drain nodes, VL_OFFSET can be set only to (0,0).
An application can request that the OCTANE Personal Video option capture or play back a video stream in a number of ways. For example, the application can request that each field be placed in its own buffer, that each buffer contain an interleaved frame, or that only odd or even fields be captured. This section enumerates the capture types that the OCTANE Personal Video option supports.
A field mask is useful for identifying which fields will be captured and played back and which fields will be dropped. A field mask is a bit mask of 60 bits for NTSC or 50 bits for PAL (two fields per frame). A numeral 1 in the mask indicates that a field is captured or played back; a zero indicates that no action occurs.
For example, the following field mask indicates that every other field will be captured or played back:
10101010101010101010... |
Capture types are as follows:
VL_CAPTURE_NONINTERLEAVED
VL_CAPTURE_INTERLEAVED
VL_CAPTURE_EVEN_FIELDS
VL_CAPTURE_ODD_FIELDS
VL_CAPTURE_FIELDS
These capture types apply to both VL buffers and DMbuffers.
VL_RATE determines the data transfer rate by field or frame, depending on the capture type as specified by VL_CAP_TYPE, as shown in Table 3-10.
Table 3-10. VL_RATE Values (Items per Second)
VL_CAP_TYPE Value | VL_RATE Value: NTSC | VL_RATE Value: PAL |
---|---|---|
VL_CAPTURE_NONINTERLEAVED, VL_CAPTURE_INTERLEAVED | 1-30 frames/second | 1-25 frames/second |
VL_CAPTURE_EVEN_FIELDS, | 1-30 fields/second | 1-25 frames/second |
VL_CAPTURE_FIELDS | 1-60 fields/second | 1-50 frames/second |
![]() | Note: All rates are supported on all memory nodes. The buffer size must be set in accordance with the capture type. |
The VL_CAPTURE_NONINTERLEAVED capture type specifies that frame-size units are captured noninterleaved. Each field is placed in its own buffer, with the dominant field in the first buffer. If one of the fields of a frame is dropped, all fields are dropped. Consequently, an application is guaranteed that the field order is maintained; no special synchronization is necessary to ensure that fields from different frames are mixed.
The rate (VL_RATE) for noninterleaved capture is in terms of fields and must be even. For NTSC, the capture rate may be from 2 to 60 fields per second, and for PAL 2 to 50 fields per second. Because a frame is always captured as a whole, a rate of 30 fields per second results in the following field mask:
1100110011001100... |
The first bit in the field mask corresponds to the dominant field of a frame. The OCTANE Personal Video option waits for a dominant field before it starts the transfer.
If VL_CAPTURE_NONINTERLEAVED is specified for playback, similar guarantees apply as for capture. If one field is lost during playback, it is not possible to “take back” the field. The OCTANE Personal Video option resynchronizes on the next frame boundary, although black or “garbage” video might be present between the erring field and the frame boundary.
The rate during playback also follows the rules for capture. For each 1 in the mask above, a field from the VL buffer is output. During the 0 fields, the previous frame is repeated. Note that the previous frame is output, not just the last field. If there are a pair of buffers, the dominant field is placed in the first buffer.
Interleaved capture interleaves the two fields of a frame and places them in a single buffer; the order of the frames depends on the value set for VL_EVO_DOMINANCE_FIELD (see Table B-2 or Table B-3 in Appendix B for details). The OCTANE Personal Video option guarantees that the interleaved fields are from the same frame: if one field of a frame is dropped, then both are dropped.
The rate for interleaved frames is in frames per second: 1 to 30 frames per second for NTSC and 1 to 25 frames per second for PAL. A rate of 15 frames per second results in every other frame being captured. Expressed as a field mask, the following sequence is captured:
1100110011001100.... |
As with VL_CAPTURE_NONINTERLEAVED, the OCTANE Personal Video option begins processing the field mask when a dominant field is encountered.
During playback, a frame is deinterleaved and output as two consecutive fields, with the dominant field output first. If one of the fields is lost, the OCTANE Personal Video option resynchronizes to a frame boundary before playing the next frame. During the resynchronization period, black or “garbage” data may be displayed.
Rate control follows similar rules as for capture. For each 1 in the mask above, a field from the interleaved frame is output. During 0 periods, the previous frame is repeated.
In the VL_CAPTURE_EVEN_FIELDS capture type, only even (F2) fields are captured, with each field placed in its own buffer. Expressed as a field mask, the captured fields are
1010101010101010... |
The OCTANE Personal Video option begins processing this field mask when an even field is encountered.
The rate for this capture type is expressed in even fields. For NTSC, the range is 1 to 30 fields per second, and for PAL 1 to 25 fields per second. A rate of 15 fields per second (NTSC) indicates that every other even field is captured, yielding a field mask of
1000100010001000... |
During playback, the even field is repeated as both the F1 and F2 fields, until it is time to output the next buffer. If a field is lost during playback, black or “garbage” data might be displayed until the next buffer is scheduled to be displayed.
The VL_CAPTURE_ODD_FIELDS capture type works the same way as VL_CAPTURE_EVEN_FIELDS, except that only odd (F1) fields are captured, with each field placed in its own buffer. The rate for this capture type is expressed in odd fields. A rate of 15 fields per second (NTSC) indicates that every other odd field is captured. Field masks are the same as for VL_CAPTURE_EVEN_FIELDS.
The VL_CAPTURE_FIELDS capture type captures both even and odd fields and places each in its own buffer. Unlike VL_CAPTURE_NONINTERLEAVED, there is no guarantee that fields are dropped in frame units. Field synchronization can be performed by examining the UST (Unadjusted System Time), the MSC (Media Stream Count), or the dmedia info sequence number associated with each field. These synchronization features are explained in Chapter 4, “Synchronizing Data Streams and Signals.”
The rate for this capture type is expressed in fields. For NTSC, the range is 1 to 60 fields per second, and for PAL 1 to 50 fields per second. A rate of 30 fields per second (NTSC) indicates that every other field is captured, resulting in the following field mask:
101010101010101010... |
Contrast this with the rate of 30 for VL_CAPTURE_NONINTERLEAVED, which captures every other frame.
Field mask processing begins on the first field after the transfer is started; field dominance, evenness, or oddness play no role in this capture type.
A color space is a color component encoding format, for example, RGB and YUV. Because various types of video equipment use different formats, conversion is sometimes required. The on-board OCTANE Personal Video color-space conversion capability can perform many types of image-processing operations on a video path.
This section explains
![]() | Note: For background information on color-space conversion, see Appendix D, “OCTANE Personal Video Color-Space Conversions,” later in this guide. |
Each component of an image has
a color that it represents
a canonical minimum value
a canonical maximum value
Normally, a component stays within the minimum and maximum values. For example, for a luma signal such as Y, you can think of these limits as the black level and the peak white level, respectively. For a component with n bits, there are two possibilities for [minimum value, maximum value]:
full range: [0, (2nbits)-1], which provides the maximum resolution for each component
headroom range (compressed range):
Cr and Cb: [(2n) ÷ 16, 15 × (2n) ÷ 16]
Y, A, R, G, B: [(2n) ÷ 16, 235 × (2n) ÷ 256]
This range is defined for 8 and 10 bits in ITU-R BT.601-4 (Rec. 601). For example, for 8-bit components: Cr and Cb: [16, 240]. Y, A, R, G, B: [16, 235]; for 10-bit components: Cr and Cb: [64, 960]. Y, A, R, G, and B: [64, 940].
Headroom range provides numerical headroom, which is often useful when processing video images.
Two sets of colors are commonly used together, RGB (RGBA) and YCrCb/YUV (VYUA). YCrCb (YUV), the most common representation of color from the video world, represents each color by a luma component called Y and two components of chroma, called Cr (or V), and Cb (or U). The luma component is loosely related to brightness or luminance, and the chroma components make up a quantity loosely related to hue. These components are defined rigorously in ITU-R BT.601-4 (also known as Rec. 601 and CCIR 601).
The alpha channel is not a color. For that channel, the canonical minimum value means completely transparent, and the canonical maximum value means completely opaque.
For more information about color spaces, see A Technical Introduction to Digital Video, by Charles A. Poynton (New York: Wiley, 1996).
For OpenGL, IRIS GL, and DM:
the library constant indicates whether the data is RGBA or VYUA
RGBA data is full-range by default
VYUA data in DM can be full-range or headroom-range; you must determine this from context
In the VL_PACKING tokens from IRIX 6.2, the VL_PACKING constant indicates whether the data is RGBA or VYUA (as in VL_PACKING_UYV_8_P). The VL for the OCTANE Personal Video option (for IRIX 6.4) makes all of the parameters (packing, set of colors, range of components) explicit:
Use VL_PACKING to specify only the memory layout. The new memory-only VL_PACKING tokens are disjoint from the old, and the old tokens are still honored, so this change is backward-compatible.
Use VL_COLORSPACE to specify the color space parameters, as shown in Table C-11.
Table 3-11. VL_COLORSPACE Options
Color Set | Full-Range Components | Headroom-Range (Compressed-Range) Components |
---|---|---|
RGBA | VL_COLORSPACE_RGB | VL_COLORSPACE_RP175 |
VYUA | VL_COLORSPACE_YUV | VL_COLORSPACE_CCIR601 |
The OCTANE Personal Video option performs color-space conversion if the color space implied by VL_FORMAT on the video node disagrees with that implied by VL_COLORSPACE. VL_COLORSPACE applies to memory source and drain nodes only.
In addition to the standard color-space conversion model, the OCTANE Personal Video color-space feature provides a constant-hue algorithm. This algorithm allows illegal YUV values to survive a YUV-to-RGB-to-YUV conversion. In normal conversion, YUV values that cannot be represented in the RGB color space are clamped or otherwise forced into the legal RGB range. Because the YUV (YCrCb) color space is a superset of the RGB color space, illegal RGB values can be generated when YUV is converted to RGB. If the constant-hue block is disabled, then the illegal RGB values are clipped by the output lookup table (LUT). The lost (clipped) information can result in significantly degraded quality when the image is subsequently transformed back to YUV for video output.
The constant-hue algorithm saves the normally lost information in a correction factor that can be stored in the alpha channel. To restore the original YUV image, this correction factor must be saved with the pixel data.
If the constant-hue algorithm is enabled, the illegal RGB values are converted into legal R'G'B' values. A constant-hue factor, used to restore R'G'B' to the original YUV values, can optionally be stored in the alpha channel. If the constant-hue factor is not saved, then the R'G'B' image appears as if it were range-compressed. A particular control (VL_EVO_CSC_ALPHA_CORRECTION) determines whether the alpha channel is replaced by the constant-hue factors, or if the alpha from the color-space converter's input is retained.
Note that because the correction factor computed by the algorithm is directly related to the pixel value, the correction factor is invalidated if the pixel value is recalculated (for example, during compositing).
The controls for constant hue are
VL_EVO_CSC_CONST_HUE: boolean control to enable (TRUE) or disable (FALSE) the constant-hue algorithm (memory source node only)
VL_EVO_CSC_ALPHA_CORRECTION: boolean control to select the contents of the alpha channel (memory source and drain nodes only)
If this value is set to TRUE, the constant-hue factor is saved in the alpha channel. If it is set to FALSE, the alpha value from the input is retained.
![]() | Note: VL_EVO_CSC_ALPHA_CORRECTION has no effect if VL_EVO_CSC_CONST_HUE is disabled. When both VL_EVO_CSC_CONST_HUE and VL_EVO_CSC_ALPHA_CORRECTION are enabled, it is not advisable to load the alpha LUT. |
By default, the constant-hue processing block is enabled, but the constant-hue factor is not stored in the alpha channel (the input alpha is retained).
If the constant-hue factor is not stored in the alpha channel, you might need to range-limit or expand the input alpha value. For example, when full-range RGBA is converted to YCrCbA, the range is limited from 0-255 to CCIRs (16-235). The range is altered using the output alpha LUT. The default contents of this LUT are determined by the input and output ranges.
In addition to standard conversions, the color-space converter can be loaded with user-defined input lookup tables, matrix multiplier coefficients, and output lookup tables. Applications can manipulate the tables and coefficients to perform color correction, colorization, or other image-processing functions. See Appendix D for a description of the color-space converter model and the relationships between the various internal processing blocks.
Table 3-12 summarizes image-processing controls. Access for all these controls is GST:
G: The value can be retrieved through vlGetControl().
S: The value can be set through vlSetControl() while the path is not transferring.
T: The value can be set through vlSetControl() while the path is transferring
Table 3-12. Image-Processing Controls
The control VL_EVO_CSC_COEF specifies the matrix multiplier coefficients. It has a data pointer pointing to an array of nine integers. The coefficients are stored in the following order:
data[0] = Y/G 1 data[1] = Y/G 2 data[2] = Y/G 3
data[3] = U/B 1 data[4] = U/B 2 data[5] = U/B 3
data[6] = V/R 1 data[7] = V/R 2 data[8] = V/R 3
Each coefficient is a 32-bit fractional two's complement value. The magnitude of each coefficient is from -4 to 3.999. Table 3-13 shows values.
Table 3-13. Coefficient Formats
Bit | Value |
---|---|
31 | -22(signed bit) |
30 | 21 |
29 | 20 |
28 | 2-1 |
27 | 2-2 |
26 | 2-3 |
25 | 2-4 |
24 | 2-5 |
23 | 2-6 |
... | ... |
4 | 2-25 |
3 | 2-26 |
2 | 2-27 |
1 | 2-28 |
0 | 2-29 |
For OCTANE Personal Video color-space conversion, the valid range for data[0], data[4], and data[8] is from -4 to 3.999; for the other six coefficients, the valid range is from -2 to 1.999. The 31st and 30th bits of the other six coefficients must be either all 0's or all 1's for the range from -2 to 1.999; otherwise they are clamped to the valid range.
The OCTANE Personal Video color-space feature provides for up to four input LUTs (each with YG, UB, and VR), and four alpha LUTs. Use the control VL_EVO_CSC_LUT_IN_PAGE or VL_EVO_CSC_LUT_ALPHA_PAGE in the application to select one of the four LUTs as active.
The controls for specifying the contents of the input or alpha lookup tables are VL_EVO_CSC_LUT_IN_YG, VL_EVO_CSC_LUT_IN_UB, VL_EVO_CSC_LUT_IN_VR, and VL_EVO_CSC_LUT_ALPHA.
The data pointer of the extended value points to a VL_EVOInAlphaLutValue structure, as defined in dev_evo.h. This structure contains the page number for the LUT being specified and a lookup table of 1024 integer entries (see VL_EVO_CSC_LUT_IN_PAGE and VL_EVO_CSC_LUT_ALPHA_PAGE) for selecting the LUT active during color-space conversion). The range for each entry in the lookup table is 0-1023 (10 bits).
When the O2Cam digital camera is selected—VL_VIDEO is set to VL_EVO_NODE_NUMBER_VIDEO_2—you can apply the O2Cam digital camera controls to set O2Cam features.
Most of these controls are accessible in the Pro menu of vcp: select Pro > Camera In > Coding Controls. For those controls accessible in vcp, the default value is Persistent, that is, the value set in vcp.
Table 3-14 summarizes O2Cam digital camera controls.
Table 3-14. O2Cam Digital Camera Controls
Control | Type | vcp Pro menu | Range | Use |
---|---|---|---|---|
VL_CAMERA_AUTO_GAIN | boolVal | Yes | 0-1 | Toggles automatic gain control on or off. When automatic gain control is on, the camera continually adjusts to changing lighting conditions to produce an even level of brightness. When automatic gain control is off, the user or program sets the proper gain level (VL_CAMERA_GAIN). If gain is too low, the picture appears dark; when gain is too high, it appears white or washed out. Factory default is 128. |
VL_CAMERA_BLUE | intVal | Yes | 0-255 | Controls the proportion of blue in the image. |
VL_CAMERA_BLUE | intVal | Yes | 0-255 | Sets overall blue color intensity in the image. A setting of 0 removes all blue from the image. |
VL_CAMERA_BRIGHTNESS | intVal | No | 0-255 | Specifies the brightness level when VL_CAMERA_AUTO_GAIN_CONTROL is FALSE; read-only. |
VL_CAMERA_BUTTON | boolVal | No | 0-1 | Indicates whether the button on the top of the camera is pressed or not; read-only. |
VL_CAMERA_GAIN | intVal | Yes | 0-255 | Allows manual adjustment of camera exposure when automatic gain is off (VL_CAMERA_AUTO_GAIN_CONTROL is set to FALSE). |
VL_CAMERA_GAMMA | intVal | Yes | 0-255 | Controls brightness of the dark areas in the image. Increasing the gamma value increases the brightness of dark areas. |
VL_CAMERA_RATE | intVal | No | 0-255 | Specifies the frame rate of the camera; read-only. |
VL_CAMERA_RED_BALANCE | intVal | Yes | 0-255 | Controls the proportion of red in the image. |
VL_CAMERA_RED | intVal | Yes | 0-255 | Sets overall red color intensity in the image. A setting of 0 removes all red from the image. |
VL_CAMERA_SHUTTER | intVal | Yes | 0-8 | Controls shutter speed: faster shutter speed lets in less light
and can be used when the amount of light is too high to be
compensated for by the gain control (VL_CAMERA_GAIN).
Values: |
VL_CAMERA_VENDOR_ID | stringVal | No | N/A | Returns the value VL_CAMERA_VENDOR_ID_SGI to identify the camera as a Silicon Graphics digital camera; read-only. |
VL_CAMERA_VERSION | intVal | No | N/A | Returns the value VL_CAMERA_VERSION_SGI_DVC1 to identify the camera as the O2Cam digital camera; read-only. |