SDK Manual
SDK Manual
SOFTWARE DEVELOPER’S
KIT
USER’S GUIDE
052585-31
Foresight Imaging Software License Agreement
Version 3.1 supports the AccuStream 50, AccuStream 75, AccuStream 170,
AccuStream 50a, AccuStream 75a, AccuStream 205a, AccuStream 50+,
AccuStream 75+, and AccuStream 170+ video capture boards. Version 3.1
supports the Windows XP, Windows XP64, Windows Vista Business and Windows
Vista Business with 64-bit operating systems. For all I-Series boards (I-Color, I-
RGB, I-50, I-60, I-75) support, you must download Version 2.4 from the Foresight
Imaging website: www.fi-llc.com. Version 2.4 supports the Windows XP and
Windows 2000 operating systems.
Previous Editions
First printing: January 1999
Second Edition: August 2000
Third Edition: September 2001
Fourth Edition: November 2001
Fifth Edition: May 2002
Sixth Edition: April 2003
Seventh Edition: February 2008
Eighth Edition: February 2009
Preface
This manual is a complete user’s guide and reference for IDEA: Foresight
Imaging’s Imaging Development Environment for Applications. It consists of a C
software developer’s kit (SDK), ActiveX control, Tools Library, Video for Windows
driver, example programs with source code, and device drivers for the
appropriate operating system.
Intended Audience
This documentation has been designed for a software engineer with prior C
programming experience.
Technical Support
The goal of this manual is to provide you with documentation on the IDEA and
Tools Library functions required for producing your own programs. If you need
assistance after reading this manual, visit our web site at www.fi-llc.com. Here,
you can access FAQs, driver downloads, and an online support form.
v
Foresight Imaging Software License Agreement
vii
Software Limited Warranty
Compliance Information
FCC Compliance Information
FCC NOTICE
WARNING
Changes or modifications to this unit not expressly approved by the party
responsible for compliance could void the user’s authority to operate this
equipment.
NOTE: This equipment has been tested and found to comply with the limits for a
Class A digital device, pursuant to Part 15 of the FCC rules. The limits are
designed to provide reasonable protection against harmful interference when the
equipment is operated in a commercial environment. This equipment generates,
uses, and can radiate radio frequency energy and, if not installed and used in
accordance with the instruction manual, may cause harmful interference to radio
communications. Operation of this equipment in a residential area is likely to
cause harmful interference in which case the user will be required to correct the
interference at his/her own expense.
Shielded cables must be used with this unit to ensure compliance with the Class
A FCC limits.
CE Compliance Information
EN 55022:1998 Class B ITE emissions requirements (EU)
EN 55024:1998 Information technology equipment – immunity characteristics
WARNING: Each board has been shipped in its own "plastic" bag. This bag has
properties that prevent the board from being damaged from Electrostatic
Discharge (ESD). After you remove the board from this bag, the board becomes
very susceptible to damage from ESD. We strongly recommend that you use a
grounding strap while handling these boards. Try not to place your fingers on the
components on the boards. In other words, handle the boards by grabbing the
edges of the boards between your fingers. Also remember not to place your
fingers on the gold plated edge connectors.
xi
Compliance Information
Table of Contents
Preface ............................................................... v
Foresight Imaging Software License Agreement ............... vi
Single User Products................................................vi
Software Limited Warranty ....................................... viii
Hardware Limited Warranty ....................................... ix
Compliance Information ............................................. x
FCC Compliance Information...................................... x
Canadian Emissions Requirements ............................... x
CE Compliance Information ....................................... x
Structure of this Document ......................................... 1
IDEA Library.......................................................... 1
IDEA Tools Library .................................................. 1
CHAPTER 1: Introduction .............................................. 3
Requirements ........................................................ 3
Compiling Samples.................................................. 4
Information Update................................................. 4
Installing the IDEA SDK and Tools Libraries ..................... 4
IDEA Files............................................................. 5
CHAPTER 2: Theory of Operation .................................... 9
Using Preprocessor Statements ................................... 9
Using the Register Functions ...................................... 9
Using the Millisecond Timer Functions ......................... 10
Error Handling ...................................................... 10
Image Handles vs. Board Handles ............................... 12
Comparing the Two Types of Handles .......................... 12
Asynchronous Board Access ...................................... 13
Using an External Trigger ......................................... 14
Using “Live Video”................................................. 14
Live Display Operations ........................................... 15
Live Streaming of Data to Buffers ............................... 16
CHAPTER 3: Understanding the CHP File ......................... 20
Using the IDEA CHP File ........................................... 20
The RSET Structure and Associated Values and Macros...... 23
xiii
Table of Contents
xv
xvi IDEA SDK User’s Guide
Structure of this Document
IDEA Library
Chapter 2: Theory of Operation contains information about some of the
function types and error handling.
Chapter 3: Understanding the CHP File provides background on the Common
Hardware Profile (CHP), default settings, sample CHP, as well as descriptions
for each setting.
Chapter 4: C Function Listings contains information about the functions
available for the Foresight Imaging frame grabbers & video streamers.
Chapter 5: ActiveX Function Listings contains information concerning the
ActiveX controls available in IDEA.
CHAPTER 1:
Introduction
This manual is for users of the Foresight Imaging® IDEA™ SDK (Software
Developer's Kit). IDEA is Foresight Imaging’s Imaging Development Environment
for Applications.
It consists of a C SDK, and ActiveX control, a Tools Library, a Video for Windows
driver, example programs with source code, and device drivers for the
appropriate operating system.
The C SDK consists of a set of C/C++ callable functions that provide the
application developer with hardware-independent tools for board
configuration, video control, image capture, video streaming, memory
management, and more. The ActiveX control provides methods and properties
that abstract the functionality of the C SDK to ease application development in
such environments as Visual Basic and Delphi.
The hardware independence of IDEA allows developers to create a single
application that will support all AccuStream frame grabbers and video
streamers from Foresight Imaging. Applications written with IDEA will function
across all of the supported operating system platforms.
Several demonstration programs are included with these libraries. These
programs contain source code that utilizes common IDEA Library functions to
initialize hardware, capture, and store images. Thus, these demonstration
programs may provide a template for your application.
Requirements
The following are the compilers and/or operating systems that are supported
by the IDEA library, as well as the Tools library:
Microsoft Visual Studio 2005.
Windows XP, Windows XP64, Windows Vista Business and Windows Vista
Business with 64-bit.
Version 3.1 supports the AccuStream 50, AccuStream 75, and AccuStream
170, AccuStream 50a, AccuStream 75a, AccuStream 205a, AccuStream 50+,
AccuStream 75+, and AccuStream 170+ boards. Version 2.5 supports the
Windows XP, Windows XP64, Windows Vista Business and Windows Vista
Business with 64-bit operating systems. For all I-Series boards (I-Color, I-
RGB, I-50, I-60, I-75) support, you must download Version 2.4 from the
Foresight Imaging website: www.fi-llc.com. Version 2.4 supports the
Windows XP and Windows 2000 operating systems.
Compiling Samples
The IDEA executables for sample applications can be complied using Microsoft
Visual Studio 2005. Each demonstration application gets installed into its own
directory complete with source code, make files and Microsoft Visual Studio
compatible project files.
The make files can be linked to produce a “DEBUG” or “RELEASE” version:
RELEASE: This is the default (no symbol table included).
DEBUG: If a debug version is wanted, “DEBUG” must be chosen using the
Active Configuration pulldown list in the Developer’s Studio.
Each demonstration application supports Win32 or X64 platforms. If you are
developing a 32-bit application, whether on 32- or 64-bit Windows XP, you
should select the Win32 platform. If you are developing a 64-bit application on
Windows XP64, select the X64 platform. Note that you must have installed 64-
bit support with the Visual Studio 2005 before you attempt to compile for the
X64 platform.
Copies of the resulting *.EXE files are left in the appropriate release or debug
directories.
Information Update
There may be additional release-specific information available on the software
media. This information may be in two different locations:
README.TXT in the root directory of the software media or IDEA SDK on
your hard drive (after you have installed the software).
ASCII files (*.TXT) or Adobe Acrobat (*.PDF) in the \Foresight\Idea\Doc
directory.
2. If you have AutoRun enabled, the AutoRun.INF will invoke the installation
procedure. If you do not have AutoRun enabled, you must change to the
Setup directory on the CD and run the Setup.exe application. Follow the
directions regarding the destination and program folders.
NOTE: For 32-bit installations, the default installation directory is:
\Program Files\Foresight\IDEA
For 64-bit installations, the default installation directory is:
\Program Files (x86)\Foresight\IDEA
(The 32- and 64-bit installations are provided on separate disks. You should
only install one or the other.)
It is recommended that you select automatic restart when the installation
has finished.
3. Alternatively, you can install the software from the Control Panel by
selecting Add/Remove Programs.
4. Check the CD for version-specific release notes. These are in README.TXT
in the Setup directory. This file contains important information that
augments this documentation. This file is also installed in the destination
folder, with a shortcut to it in the IDEA application folder.
5. If this is a new hardware installation, you should now power down the
computer and install the frame grabber in an appropriate slot. If plug-and-
play is enabled on your operating system, it will tell you that you have a
new device. Follow the installation directions until you are prompted for an
installation disk. The CD contains a Drivers directory that has a
subdirectory for 32-bit Windows and a subdirectory for 64-bit Windows. The
software installation will also create a Drivers directory under your
installation directory. Select the directory that matches your operating
system. The installation procedure reads the appropriate INF file and
installs the correct device driver for your system.
IDEA Files
Directory Structure
The following table shows the \Foresight\IDEA directory structure for the IDEA
Library and Tools Library.
1
Folder Explanation
AutoSync Auto-SYNC application and associated files.
Chp Sample Common Hardware Profile (CHP) files.
1
Directory and Folder are used interchangeably throughout this guide.
Demonstration Code
There are several directories of demonstration code under the Demo directory.
Most of these applications are meant to demonstrate a particular aspect of the
IDEA software or of Foresight frame grabbers.
The other applications show a subset of this functionality for one or more board
types as summarized in the following table.
Directory Explanation
IDEA All-encompassing demonstration application.
FI_DICOM Contains sources for a DLL that allows the IDEA demo to
transfer images using the DICOM protocol. Building and using
this DLL requires that the LeadTools evaluation kit be installed
CHAPTER 2:
Theory of Operation
This chapter describes the principles of using the Preprocessor Statements,
Register Functions, Millisecond Timer Functions, IDEA CHP files, Trigger Inputs
and Live Video Display and Streaming. Error Handling is also discussed.
RSET structure are checked for validity in both of the eHD_RSET_...( ) routines.
Therefore, it is possible that erroneous changes made by the application
program to the RSET structure can be caught (and reported) by eHD_RSET_Set(
) when an attempt is made to use the data. Given a structure declared by
"RSET rset;", the version-stable elements of RSET can be represented as
follows:
(rset.dwRegSpecd &(1<<HPR_x))!=0 /* TRUE if element HPR_x is specified*/
rset.lRegs[HPR_HFREQ] /* The horizontal frequency (in hertz)*/
rset.lRegs[HPR_HTOTAL] /* The horizontal total (pixel freq/horz.freq) */
rset.lRegs[HPR_WIDTH] /* Width of image (pixels)*/
rset.lRegs[HPR_HEIGHT] /* Height of image (lines)*/
Error Handling
All library routines that take a BoardHandle as a parameter use a common error
reporting system. These routines report an error as one of the error codes
listed in HDP_ERR.H. These codes (for example, HPERR_PARAM or
HPERR_CHP_SYNTAX) are always of type ERRTYPE. When one of these errors is
reported, several items are checked:
NOTE: See the Appendix for more information on the function return values.
2. With board handles, you must specify the top left coordinate in frame
grabber memory where the acquisition starts (CHP values “XStart” and
“YStart”). These coordinates must then be retained so your application can
find the image later. With image handles, your application must keep track
of the image handle but the library generates the handle and access to the
image data is by image coordinates.
3. With board handles, the RSET is loaded directly onto the board. With image
handles, the RSET is kept with the image handle and is loaded onto the
board just before an image is grabbed. This makes it easier to work with
two different video formats connected to that same board.
typedef struct {
ImageHandle ih;
ERRTYPE e;
short nResv; /* for DWORD alignment */
FINE_TIME ftVEnd;
unsigned long dwFieldN;
} HD_ABOSTAT;
typedef struct {
typedef struct {
HCB_ABO cbABO;
void *pThis;
long lUser;
} HD_ABOCB;
If you want the data to arrive in bottom-up format that is native to Window’s
DIBs, then set the bDIBTarget to TRUE. The nDecimateX and nDecimateY
parameters are used to scale the video down. Note that the entire image is still
captured, but the smaller image is transferred to the buffer. The
nDecimateFrames can be used to reduce the frame rate by skipping frames if
the system is not capable of processing the data at full speed.
Set bFieldUpdate to TRUE if you want each buffer to receive a field of data
instead of the full, interlaced, frame.
The hLut parameter allows for a look-up-table to be applied to the data.
The top, bottom, right and left parameters affect the size of the captured
image.
pLiveVideoDescriptors is not used and should be set to zero.
The pVidHeaders is set by the library to contain one HDVID_HEADER structure
for each buffer in the buffer list. The application can interrogate this structure
to determine the currently active buffer and frame counter as a means of
determining if the library has had to drop a buffer due to system speed
constraints.
The event parameters are a way for the library to notify the application that a
streaming event has occurred. The application creates the events using the
Win32 CreateEvent call. It then uses one of the Win32 methods of waiting on
events to see if the library has encountered the condition.
When the application is ready to begin streaming data, it makes a call to
eHD_LiveStreamMode( ). The mode parameter can be one of the following as
defined in hdp_lib.h:
LVM_PAUSE Pause a currently streaming operation
LVM_RUN Begin streaming
LVM_SNAP Snap an image into the next buffer, not yet
implemented
LVM_STOP Stop the current streaming operation
The application can then use the event mechanism to count and process the
incoming video buffers.
When the application has finished streaming, it calls eHD_LiveStreamClose(). It
is imperative that an application call this function before terminating because
eHD_LiveStreamInit will cause the application buffers to be locked in memory.
Failing to call eHD_LiveStreamClose will leave these buffers locked, severely
affecting system performance and likely leading to a crash.
In this way, you can stream data while holding a trigger in a particular state.
There are a couple of caveats to using this method. The first is that it will not
begin streaming if the trigger is in the desired state when eHD_LiveStreamMode
is called. The streaming will not begin until there is a transition into the
desired state.
The second caveat is that this method is susceptible to trigger bounces, as
happens frequently with mechanical switches. If this is the case, then the
application should experiment with
eHP_SetControlValue(…, “TriggerFilterTime”,… )
to find a value that will reliably ignore such trigger bounces.
CHAPTER 3:
Understanding the CHP File
This chapter describes the CHP file and provides its settings, with information
concerning each setting
NOTE: The AccuStream boards can used predefined CHP files (especially if you are
using standard VESA inputs) or you may use Auto-SYNC to created CHP files
for your specific video input
The following are sample settings in a CHP file. The default values for each
parameter is displayed on the right side of this list:
Settings in CHP File Default Value
[HIDEFPLUS]
Video Channel = CA1 CA1
Composite Sync Source = CA1 CA1
Video Attributes = 0x49 0x0000
Signal Control = 0x00 0x0000
TTL Pixel Clock = NONE NONE
Vertical Total = 525 [Future use]
Frame Period = 34 [Not specified]
Interlace = ON OFF
Vertical Sync Type = NORMAL NORMAL
Vertical Back Porch = 17.0 0.0
Image Height = 480 0
Horizontal Frequency = 15750 15725
Horizontal Total = 800 26
Horizontal Back Porch = 122 4
[I-COLOR]
VideoFormat = NTSC NTSC
InputChannel = Composite1 Composite1
Hue =0 0
Saturation =0 0
Brightness =0 0
Contrast =0 0
HorizontalPosition =0 0
OutputFormat = YCbCr422 YCbCr422
LowPassFilter = Enable Disable
YCodeRange = Full Full
Luma_Pedestal = OFF OFF
NotchFilter = Disable Disable
YCOutRange = Full Full
Luma_Decimation =On On
Luma_Peaking =Minimal Minimal
[I-RGB]
Cable = DVI-to-VGA DVI-to-BNC
FinePhaseAdjust =0 2
ActiveInterface = Analog Analog
PixelMode = RGB RGB
ClampMode = RGB RGB
This file can automatically be created with the IDEA Auto-SYNC Utility.
Initially, all lines that are read before “[HIDEFPLUS]” is found are treated as
strictly text.
NOTE: The CHP file always has a [HIDEFPLUS], when you are using an an
AccuStream board. This was kept to maintain compatibility with older CHP
files written for the HI*DEF Plus. The CHP also refers to [I-RGB]. This also
applies to AccuStream to maintain compatibility.
Subsequent lines are data lines. The data lines are read until the end-of-file is
reached or a line that begins with "[" is encountered. Keep the following in
mind when setting up this file:
• Each data line specifies a field and is expected to include an equal sign
that separates the tag from the data.
• Fields that take integer values can accept either hexadecimal or
decimal numbers. Hexadecimal numbers must begin with "0x".
• Certain numeric fields accept values other than integers. Non-integer
values must be specified in decimal and must include a decimal point.
typedef struct {
unsigned char byaRegSpecd[8]; /* Bit=1 for each lRegs[] specified. */
long lRegs[HPR_N];
} RSET;
//
// Defines for rset element [HPR_VCHAN] and [HPR_CSYNC].
//
#define HDCHAN_CA1 0
#define HDCHAN_CA2 1
#define HDCHAN_CA3 2
#define HDCHAN_CA4 3
#define HDCHAN_SS12 4
#define HDCHAN_SS12H 5
#define HDCHAN_SS12V 6
#define HDCHAN_SS12I 7
#define HDCHAN_CT1 8
#define HDCHAN_CT2 9
#define HDCHAN_CT3 10
#define HDCHAN_CT4 11
#define HDCHAN_CT1I 12
#define HDCHAN_CT2I 13
#define HDCHAN_CT3I 14
#define HDCHAN_CT4I 15
/*
// Defines for rset element [HPR_REFPROG].
*/
#define HCHPREFP_APP_0 0
#define HCHPREFP_APP_1 1
#define HCHPREFP_APP_2 2
#define HCHPREFP_AS_TOOL 3
#define HCHPREFP_AS_DEMO 4
#define HCHPREFP_AUTOSYNC 5
#define HCHPREFP_SETUP 6
/*
// Defines for rset element [HPR_PASSMODE].
*/
#define HD_PMODE_SINGLE 0
#define HD_PMODE_DUAL 1
#define HD_PMODE_DUALODD 2
(d) = IDEA requires this value to be set, but the I-Color board does not use the setting.
Black Level
Description This is part of Stage One of video amplitude and level control.
This compensates for any difference between the video blanking
level and the voltage level corresponding to black in the picture.
The units are in terms of the specified Gain range (qv). Further
adjustments can be made to the black voltage specification using
Black Reference (qv).
As Black Level is increased, the image becomes lighter but mid-
range contrast is not affected.
Example: Assume that a video signal has a blanking level of 12
mV, a black level of 17 mV and a white level of 720 mV. Eliminate
the affects of the Black and White Reference specifications by
setting them to 0.0 and 1.0, respectively. In this case, the Gain
range is 0.703 (720-17 mV).
Black Reference
Default Value 0.0000 (As BRef is increased, the image becomes darker and has
more contrast)
Value Options Range [-0.0200 – 0.9500]
Can be specified with up to four decimal places.
Description Specifies the video signal sync source. This setting overrides
selected bits in the Video Attributes (bits 1, 2, 11, 12, and 13) and
Signal Control (bits 8, 9, and 11) values. This setting is the
preferred way to specify sync source and it is recommended that
this value be set explicitly. If not specified, Video Attributes and
Signal Control are used to select the sync source. Note that for an
I-Color board, the Composite Sync Source and Video Channel
entries are overridden by the InputChannel entry in the I-Color
section.
Required Setting Yes
Default Value CA1
Value Options Video Signal Source CHP Programming
Value Value
Composite video, channel 1 CA1 HDCHAN_CA1
Composite video, channel 2 CA2 HDCHAN_CA2
Composite video, channel 3 CA3 HDCHAN_CA3
Composite video, channel 4 CA4 HDCHAN_CA4
Separate Horizontal and Vertical sync, SS HDCHAN_SS12
neither inverted. Horizontal on CT1,
Vertical on CT2
Separate sync on CT1 and CT2, SS(-H) HDCHAN_SS12H
Horizontal inverted
Separate sync, Vertical inverted SS(-V) HDCHAN_SS12V
Separate sync, both Horizontal and -SS HDCHAN_SS12I
Vertical inverted
Composite sync, channel 1 CT1 HDCHAN_CT1
Composite sync, channel 2 CT2 HDCHAN_CT2
Composite sync, channel 3 CT3 HDCHAN_CT3
Composite sync, channel 4 CT4 HDCHAN_CT4
Inverted composite sync, channel 1 -CT1 HDCHAN_CT1I
Inverted composite sync, channel 2 -CT2 HDCHAN_CT2I
Frame Period
Description The time it takes to transmit a single frame (all scan lines) of
video signal, rounded up to the next whole number. Interlaced
format has two fields per frame. Frame Period includes both
fields.
This value is used to calculate some time-out values for video
operations. It is not recommended to specify Frame Period in a
CHP file. The only situation where you may want to specify a
value is if you are grabbing only part of the scan lines in an
image. In this case, the time-out values may be computed to be
too small, possibly resulting in a premature time-out.
Units msec
Default Value Not Specified
Value Options Range [0 – 999999]
This should always be entered as a whole number. Decimal digits
are truncated.
Gain
Description The Gain specification is part of the first stage of video amplitude
and level control. When the second video control stage is
bypassed (BRef=0.0000 and WRef=1.0000), it specifies the video
signal voltage difference between black and white.
As the Gain specification is increased, the picture becomes darker
and has less contrast.
Note The Gain value forms the units for all three of the other video
amplitude and control specifications (BLevel, BRef and WRef). For
example, if the following settings are made:
BLevel =-0.0071
BRef = 0.0078
WRef = 0.9950
Gain = 0.7030
Description Horizontal Back Porch and Horizontal Back Sync define the time
period from the beginning of the horizontal sync pulse to the
beginning of active video. This is potentially confusing, because
back porch usually refers to the time starting at the end of the
horizontal sync pulse, not the beginning.
Board electronics will alter this time period; therefore the value
sent to the board must compensate for those timings.
Compensation is different for the HI*DEF Plus and the I-Series/
HI*DEF Accura. Horizontal Back Sync is the best value to use
because it does not include this compensation:
When Horizontal Back Sync is used, the library computes
the compensation based on which board is being used.
Horizontal Back Porch includes compensation appropriate
to the HI*DEF Plus only.
When Horizontal Back Sync is not available, the library uses
Horizontal Back Porch but does not compute
compensation.
Note This setting is available for backward compatibility. Horizontal
Back Sync is the preferred setting. This value is overridden by
Horizontal Back Sync.
Required Setting Required within a major set. Must specify either this setting or
the Horizontal Back Sync.
Units Pixels
Default Value 4
Value Options Range [4 – 8191]
Description Defines the time period from the beginning of the horizontal sync
pulse to the beginning of active video. Board electronics will alter
this time period; therefore the value sent to the board must
compensate for those timings. Compensation is different for the
HI*DEF Plus and the I-Series/HI*DEF Accura boards:
When Horizontal Back Sync is used, the library computes
the compensation based on which board is being used.
Horizontal Back Porch includes compensation appropriate
to the HI*DEF Plus only.
When Horizontal Back Sync is not available, the library uses
Horizontal Back Porch but does not compute
compensation.
This value overrides the Horizontal Back Porch. More precise
adjustments can be made to this value using the Phase Delay
parameters.
Required Setting Required within a major set. Must specify either this setting or
the Horizontal Back Sync.
Units Pixels
Default Value 4
Value Options Range [4 – 8191]
Horizontal Frequency
Description The number of scan lines transmitted per second in the video
signal.
Required Setting Required within a major set.
Units Hz
Default Value 15725
Horizontal Start
Description The horizontal start address of the image data storage in frame
grabber (video board) memory. This is used for frame grabber
memory management in board handle mode only. This setting is
not used in image handle mode and is ignored if specified.
Note Specifying this setting is not recommended. If specified, it should
be set to 0.
Required Setting Required within a major set. Not required if Video Channel,
Composite Sync Source and Interlace are specified (all three).
Units Pixels (frame grabber coordinates)
Default Value 0
Value Options Defined at time of CHP creation.
Description Width of the horizontal sync portion of the video signal. This is
critical only when there are very small horizontal back porches.
Note Setting this value does not change the definition of Horizontal
Back Porch or Horizontal Back Sync.
Foresight Imaging does not recommend specifying this setting.
Required Setting No
Units Nanoseconds
Default Value Not Specified
Value Options Range [0 – 999999]
Horizontal Total
Description The total number of pixels in one video scan line (i.e. per
horizontal period). This includes active video, horizontal front
porch, horizontal back porch, and horizontal sync.
Image Height
Image Width
Interlace
Description Specifies whether or not the video signal is interlaced and, if so,
the polarity (order of the odd and even fields) of the signal.
This setting overrides bits 0 and 14 of the Video Attributes
setting. This is the preferred way to specify interlace attributes.
Required Setting Yes
Default Value OFF
Value Options Video Signal CHP Value Programming
Value
Non-interlaced OFF 0
Interlaced; Even scan line first; ON 1
odd-even field pairing
Interlaced; Odd scan line first; ODD_UP 2
odd-even field pairing
Pass Mode
Description Specifies the order in which the video pixel data will be captured.
This differs from interlacing, which specifies scan line order, not
pixel order.
Note Foresight Imaging does not recommend specifying this setting.
The IDEA application chooses the appropriate option, based on
other settings.
Required Setting No
Default Value Not Specified
Phase Delay
Phase Delay 2
Description Phase delay for the second pass of dual pass grab. This is typically
not used in practice.
Typically, this is calculated as phase delay plus one pixel period.
Specifying this value is not recommended unless absolutely
necessary. The reason it would be necessary is when lowered
accuracy due to rounding or step values during calculation causes
the second phase delay to be slightly inaccurate.
Accuracy is 0.5 nanoseconds.
Required Setting No
Units Nanoseconds
Default Value Not Specified
Value Options Range [0.0 – 127.5]
Must have 1 decimal place.
Pitch
Pixel Frequency
Description The number of pixels transmitted per second in the video signal,
typically measured in megahertz.
The pixel frequency can be calculated as the product of the
Horizontal Frequency and the Horizontal Total.
Note This setting is provided for informational purposes only. Changing
the value does not affect the frame grabber board.
Required Setting No
Units kHz
Default Value Not Specified
Value Options Range [0 – 300000]
Description Pixel value used to fill a region of frame grabber (video board)
memory during a SET command for 8-bit operations. This
operation does exactly what a grab does except the pixel set
value is used as the data source instead of the AD converter.
Note This setting is overridden by Pixel Set 10 Value.
This setting is used primarily for diagnostic purposes and other
special operations. It is not used for normal video grabs.
Required Setting No
Default Value 0x00
Value Options Range [0x00 – 0xFF]
Description Pixel value used to fill a region of frame grabber (video board)
memory during a SET command for 10 bit operations. This
operation does exactly what a grab does except the pixel set
value is used as the data source instead of the AD converter.
Note This setting overrides Pixel Set Value.
This setting is used primarily for diagnostic purposes and other
special operations. It is not used for normal video grabs.
Default Value 0x000
Value Options Range [0x000 – 0x3FF]
Description Type of video board used to create the CHP file. This setting is for
documentation purposes.
Required Setting No
Default Value Board dependent. Defined at time of CHP creation.
Value Options ACCUSTREAM 170
ACCUSTREAM 70
ACCUSTREAM 50
ACCUSTREAM 170+
ACCUSTREAM 70+
ACCUSTREAM 50+
ACCUSTREAM 205a
ACCUSTREAM 75a
ACCUSTREAM 50a
Reference Program
Description Identification of the program used to create the CHP file. This
setting is for documentation purposes.
Required Setting No
Default Value Application dependent. Defined at time of CHP creation.
Value Options APP_0
APP_1
APP_2
AS_TOOL
AS_DEMO
AUTOSYNC
SETUP
Reference Serial No
Description Serial number of the video board used to create the CHP file. This
setting is for documentation purposes.
Note The serial number is stored in coded form in the RSET structure.
IDEA library routines are supplied for encoding and decoding.
Required Setting No
Default Value 0
Value Options Serial numbers are up to 6 digits in length.
Description The number of vertical blanking lines in the video signal that does
not include any vertical sync information. This is the portion of
the video signal from the trailing edge of the vertical sync to the
beginning of active video. (Note that this differs from the
definition of the Horizontal Back Porch and Horizontal Back Sync
settings, which do include sync.)
If the video signal is interlaced, the Vertical Back Porch is on a
per field basis.
For interlaced images, it is possible for the even and odd fields to
have blanking line counts that differ by 1. The fractional part of
this setting is used to specify this situation. If the fractional digit
is 0, both even and odd fields have the same number of blanking
lines. If the fractional digit is 5, the odd field has 1 more blanking
line than the even field.
Required Setting Required within a major set.
Units Scan Lines
Default Value 0.0
Value Options Range [0.0 – 4095.0]
Must have one decimal place. Fractional digit can be 0 or 5 only.
Vertical Frequency
Vertical Start
Description The vertical start address of the image data storage in frame
grabber (video board) memory. This is used for frame grabber
memory management in board handle mode only. This setting is
not used in image handle mode and is ignored if specified.
Note Foresight Imaging does not recommend specifying this setting. If
specified, it should be set to 0.
Required Setting No
Units Scan Lines (frame grabber coordinates)
Default Value Defined at time of CHP creation.
Description Specifies the type of sync information that is available during the
vertical sync and vertical front porch periods. This setting
overrides bit 15 of the Video Attributes setting. This is the
preferred way to specify vertical sync attributes.
Required Setting Yes
Default Value NORMAL
Video Channel
White Reference
Description This specification is part of the second stage of video amplitude and
level control. See the description for the Gain range specification for
a complete explanation of this video control process. White
Reference (WRef) permits fine adjustment of the white voltage level
specification with little effect on the black voltage level.
For example, say that you have set up for acquisition with BLevel
and Gain set, BRef=O.0000 and WRef=1.0000. But based on
histogram data from actual 10-bit captures, black is yielding pixel
codes of 0 and white is yielding 1015. If the intended pixel code
range is 0 to 1023, then the correction can be made with
adjustments to either the first stage (BLevel and Gain) or the
second stage (BRef and WRef). For this case, use of the second
stage is simpler. Decreasing the WRef to 0.9922, the current
white code value (1015) divided by the pixel value range (1023-0)
makes the captures correct.
ActiveInterface
Cable
Description Specifies the cabling for the I-RGB board. Prior to revision 1D,
changes to the cable type also required modifications to the
jumpers on the board.
Default Value “DVI-to-BNC”
Value Options “DVI-to-BNC”
“DVI-to-VGA (D Shell)”
“DVI-to-VGA (5 BNC)”
“DVI-to-DVI”
“DVI-To-BNC” refers to the 7 BNC cable numbered 030083. This cable is not
compatible with the AccuStream boards. “DVI-To-VGA (D-Shell)” is the cable
numbered 030085. “DVI-to-VGA (5 BNC)” is the cable numbered 030093. Both
“DVI-to-VGA” cables are functionally equivalent. “DVI-to-DVI” should only be
used for connecting to a digital output video source.
ClampMode
Description Controls whether the A/D clamps to full scale or mid-scale. This is
used for switching between RGB and YPbPr video inputs. It is only
supported by the AccuStream boards.
FinePhaseAdjust
Description Controls the fine tuning of the phase value used to read pixel
values. The 32 values of FinePhaseAdjust are converted to degree
offsets by the frame grabber.
Default Value 0
Value Options 0 to 31
PixelMode
RED_GAIN_CALIB,
GREEN_GAIN_CALIB,
BLUE_GAIN_CALIB
RED_OFFSET_CALIB,
GREEN_OFFSET_CALIB,
BLUE_OFFSET_CALIB
Description Adjusts the “natural” offset (black level) calibration values of the
board, allowing the color range to be recentered based on the
characteristics of the video source. This value can be set using the
White Balance feature of Auto-SYNC or manually adjusted. A
value of 0 represents the factory default calibration value.
Default Value 0
Value Options 0 to 255
CHAPTER 4:
C Function Listings
This chapter describes the C functions currently available to program the
Foresight Imaging boards from the IDEA Library. The first section, called
Function Table, lists each function, alphabetically (without the prefixes), with a
brief description and the page that function is discussed further.
The second section, called Function Descriptions, discusses the functions with
more detail.
Function Table
This section lists each function with a brief description and the page that
function is discussed.
Name Description
bHD_CommandDone Returns status of Command Done.
bhHP_Claim I-Series: Sets up board at the specified slot number.
This function also sets up access to the board’s Frame
Grabber..
bHP_CommandDone Returns status of Command Done.
bHP_CommandReady Returns status of Command Ready.
bHP_CSyncDetect Reports status of video sync.
eHP_Close Prohibits IDEA access to the specified Open Data
structure.
eHP_Command Sets up specified command (wCommand) for a specified
board.
eHP_CommandDone Waits up to wTimeout_mS milliseconds for Command Done
then returns. Error condition is generated on timeout.
Timeout value may be defaulted by specifying
VIDEOTIMEOUT.
eHP_CommandReady Waits up to wTimeout_mS milliseconds for Command
Ready then returns. Error condition is generated on
timeout. Timeout value may be defaulted by specifying
VIDEOTIMEOUT.
eHP_DisableTriggerEvent Disables events on trigger signals
Name Description
eHP_EnableTriggerEvent Enables events on trigger signals
eHP_FBFastRead Copies a block of data from the IDEA frame grabber
memory into fpwBuf. Column and line numbers start at
zero.
eHP_FBHisto Accumulates histogram data from pixel values in frame
grabber memory. Column and line numbers start at zero.
The accumulation starts at column wColumn, line wLine in
frame grabber memory. This array is never zeroed by
eHP_FBHisto( ).
Name Description
eHD_DeallocateAll Invalidates all image handles assigned to the specified board.
This releases all use of the board’s memory and permits
board-handle-based calls to the board.
eHD_FBFastReadPixel Transfers any rectangular section of a captured image
from the image buffer in frame grabber memory to the
application buffer.
eHD_FBHistoPixel Accumulates pixel code histogram data from any
rectangular section of a captured image from the image
buffer in frame grabber memory to the application buffer
fpwBuf. Neither eHD_FBHistoPixel( ) nor eHP_FBHisto( )
ever initialize (zero) the histogram array.
eHD_GetStreamBuffer Retrieve the most recent buffer filled by streaming
eHD_LiveDisplayInit Prepare library to display live video in a window.
eHD_LiveDisplayMode Begin or end live video display.
eHD_LiveStreamInit Prepare Library for streaming to buffers.
eHD_LiveStreamMode Begin, end or pause live streaming operation.
eHD_LiveStreamClose Clean up and unlock streaming buffers.
eHD_ReleaseStreamBuffer Release the buffer to be filled by a subsequent streaming
operation
eHD_RSET_Check Checks an RSET structure against mode-specific criteria.
eHD_RSET_Get Gets the RSET currently in use by an image handle.
eHD_RSET_Set Configures an image handle for use with a Foresight frame
grabber board.
eHD_SetChannel Changes the channel used with a specified image handle.
eHD_SetWhiteBalance Store balanced gain and offset levels among R,G and B
channels
eHD_SnapToBuffer Grab a frame and transfer it to a user buffer.
eHD_TestWhiteBalance Survey R,G and B channels for balanced gain and offset
values.
fine_abswait Returns at a specified date and time (or very soon
thereafter – system conditions permitting).
fine_add Adds two millisecond time values. It is assumed that at
least one of the values is a time interval.
fine_ascii_local Converts absolute date/times or elapsed days/
milliseconds to an ASCII string.
Name Description
fine_delta Adds the specified number of milliseconds (either positive
or negative – the second argument) to the time value
pointed to by the first argument.
fine_later Adds the specified number of milliseconds (second
argument) to the current time and stores this value in the
first argument. Adjustments are made to accommodate
timer limitations.
fine_now Stores the current date and time at the location specified
in the first argument.
fine_subtract Subtracts the second argument from the value pointed to
by the first argument. FINE_TIME structures may refer to
absolute date/times or to elapsed days/milliseconds.
fine_wait Returns after waiting the specified number of
milliseconds.
_HP_Error Declares that Error wError has been encountered while
processing the board handle.
HP_UnClaim Releases possible claim on a board.
ihHD_Allocate Allocates frame grabber memory space for a specified image
format and assigns an image handle to it.
nHP_ClaimAll Scans for up to 15 Foresight boards and claims all of them.
This preempts all claims made by bhHP_Claim( ).
nHP_ErrMessage Formats a string to describe an error code.
nHP_GetBoardInfo Retrieves specified board information.
nHP_Report Provides a list of Foresight boards found at system start-
up. This should be called before boards are claimed or
opened.
eHD_GetMaxBuffers Return an approximation of the maximum number of
buffers that can be allocated.
Function Descriptions
This section discusses the IDEA SDK functions with more detail. Prototypes for
these functions are provided in the files called HDP_LIB.H and HP_FTIME.H.
bHD_CommandDone
bhHP_Claim
Parameters wIOAddr PCI Slot number assigned by the system BIOS. This
must be OR’d with the value of the HD_PCI slot.
dw4KMem This parameter is only kept for compatibility with
earlier software. It should be set to zero.
Returns Returns a positive value if successful. This value is the board handle
needed for subsequent access to the board.
Returns a negative value if unsuccessful and indicates the problem.
This routine is unusual in its error handling. This is necessary, since
this routine must be called before eHP_Open( ) and therefore there is
no Open Data structure for posting errors.
The possible error return values are:
HPCLAIM_ALLOC Memory Allocation error occurred while
attempting to ready board.
HPCLAIM_IN_USE The specified board is in use by another
program.
HPCLAIM_NO_HDP There is no Foresight board at the
specified I/O address.
HPCLAIM_NO_VXD Device driver not available and/or
unusable.
HPCLAIM_PARAM Invalid parameters passed to
bhHP_Claim.
HPCLAIM_TOOMANY The maximum number of boards that
can be readied is 15.
HPCLAIM_VXD_REV Device driver and DLL revision
mismatch.
bHP_CommandDone
bHP_CommandReady
bHP_CSyncDetect
eHP_Close
eHP_Command
NOTE: This function CANNOT be used in conjunction with functions that use
image handles. If image handles have been used on the board, they must
be deallocated before this function can be used. This deallocation can be
done either individually or with a call to eHD_DeallocateAll( ).
hardware trigger
occurs. Refer to the
Foresight Imaging
Installation and User’s
Guide for information
concerning triggers.
HPCMD_IDLE: Idle.
eHP_CommandDone
eHP_CommandReady
eHP_DisableTriggerEvent
Description Disables the ability for the application to receive a WIN32 event
notification when the board has received a trigger signal. See
eHP_EnableTriggerEvent.
eHP_EnableTriggerEvent
eHP_FBFastRead
NOTE: This function CANNOT be used in conjunction with functions that use
ImageHandles. If image handles have been used on the board, they must
be deallocated before this function can be used. This deallocation can be
done either individually or with a call to eHD_DeallocateAll( ).
eHP_FBHisto
eHP_GetBoardCaps
Description This function will return a 32 bit value containing a bitmap describing
the board’s capabilities. Each bit is defined in hdp_lib.h as a define
beginning with FSCAPS_. Applications can use the capabilities to
determine what action the application needs to perform. For example,
if theboard has FSCAPS_ONBOARD_YCBCR_CONV set, then it does not
need to do software conversion of a YCbCr input signal.
Parameters nBoardType The board type as returned in the report structure. For
example, HIDEF_ACCUSTREAM_170_PLUS.
Returns value The 32 bit capabilities value.
eHP_GetBoardIDString
eHP_GetControlValue
Description Gets a value depending on the control string passed. Using control
strings rather than using a separate function for each control allows
the interface to be extended without affecting backward
compatibility.
Parameters bh Handle to the specific board.
szControl Specifies what the application would like returned.
OutputSize The size, in bytes, of the output data.
pOutput A pointer to a buffer to accept the output.
Notes There are two modes in which an application can call this function:
Mode1: In the first mode, OutputSize is set to zero and pOutput is
a pointer to a DWORD. In this case, the function
determines the output size for the control value and
returns it in pOutput.
eHP_GetInfoStruct
eHP_Open
eHP_RSET_FRead
eHP_RSET_FWrite
Note Does not access the frame grabber board in any way. The first line
written by this routine is always the section identifier "[HIDEFPLUS]".
Returns HPERR_ENCODE_REG
HPERR_FILEP_PARAM
eHP_RSET_Set
NOTE: This function CANNOT be used in conjunction with functions that use
image handles. If image handles have been used on the board, they must
be deallocated before this function can be used. This deallocation can be
done either individually or with a call to eHD_DeallocateAll( ).
eHP_SetBlackLevel
NOTE: This function CANNOT be used in conjunction with functions that use
image handles. If image handles have been used on the board, they must
be deallocated before this function can be used. This deallocation can be
done either individually or with a call to eHD_DeallocateAll( ).
eHP_SetChannel
NOTE: This function CANNOT be used in conjunction with functions that use
image handles. If image handles have been used on the board, they must
be deallocated before this function can be used. This deallocation can be
done either individually or with a call to eHD_DeallocateAll( ).
eHP_SetControlValue
ActiveMode Page 94
CameraHelpFile Page 95
CameraModes Page 95
CurrentCameraMode Page 96
ExposureDelay Page 96
ExposureDelayTime Page 96
ExposureDuration Page 96
ExposureDurationTime Page 96
ExposurePolarity Page 96
FinePhaseAdjust Page 43
ForceTrigger Page 96
ForceTriggerAll Page 97
HardReset Page 97
IcolorChannel Page 98
IntegrationFrames Page 98
IntegrationTime Page 98
IO_Line (eHP_SetControl only) Page 98
IO_Syncs Page 98
IRGBCable Page 98
IRGBLut Page 98
MonoCapture Page 98
RedGain,GreenGain,BlueGain Page 99
RedOffset,GreenOffset,BlueOffset Page 99
RetriggerDelay Page 100
RetriggerDelayTime Page 100
StrobeDelay Page 101
StrobeDelayTime Page 101
StrobeDuration Page 101
StrobeDurationTime Page 101
StrobePolarity Page 101
SyncGeneratorHPolarity Page 101
SyncGeneratorHTotal Page 101
SyncGeneratorHWidth Page 101
SyncGeneratorVPolarity Page 101
SyncGeneratorVTotal Page 101
SyncGeneratorVWidth Page 101
SyncFilter Page 101
TriggerFilterTime Page 101
eHP_SetGain
NOTE: This function CANNOT be used in conjunction with functions that use
image handles. If image handles have been used on the board, they must
be deallocated before this function can be used. This deallocation can be
done either individually or with a call to eHD_DeallocateAll( ).
eHD_Command
HPERR_HANDLE
HPERR_TIMEOUT This is returned if the video signal
can not be captured in synchronous
mode.
eHD_Deallocate
eHD_DeallocateAll
eHD_FBFastReadPixel
HDXFER_YONLY_8
HDXFR_PIXEL_RGB, Performs a 32 bit transfer of RGB data with a
HDXFR_PIXEL_RGB888_32 zero fill in the alpha byte. To be compatible with
Windows bitmaps, this data is in BGR format.
Do not combine with HDXFR_PIXEL_8 or
HDXFR_PIXEL_10
HDXFR_PIXEL_RGB555_16 Performs a 16-bit transfer of RGB 555 data.
HDXFR_PIXEL_RGB565_16 Performs a 16-bit transfer of RGB 565 data.
HDXFR_PIXEL_RGB888_24 Performs a 24-bit transfer of RGB data. To be
compatible with Windows bitmaps, this data is
in BGR format.
HDXFR_PIXEL_YCBCR422_16 Performs a 16-bit transfer of the YCbCr data.
HDXFR_FGMEM_RETAIN Default.Does not allow contents of the image
buffer (in frame grabber memory) to be
destroyed. You may not want these contents to
be destroyed because they may still be
important after this transfer.
eHD_FBHistoPixel
eHD_GetStreamBuffer
Description Retrieves the next buffer header from a live streaming operation. The
application can then use this buffer header to access the image data
and the frame number. This function is used in conjunction with
eHD_ReleaseStreamBuffer to manage buffer lists used by streaming
operations.
Parameters ih The current image handle.
pBufferHeader Pointer to buffer header pointer to be filled in by
this function.
eHD_LiveDisplayInit
Description Prepares the library to display live video in a window. The frame
grabber must be capable of displaying live video, i.e. it’s an I-Series,
I-Color, I-RGB or AccuStream. Note that as of the IDEA Release 1.6,
this is the preferred method for displaying live video, as opposed to
calling LiveVideoInit()…LiveVideoMode().
pLiveDisplayInfo
Pointer to a LIVEDISPLAY_INFO structure (defined in
hdp_lib.h ) that contains information describing the video
source and destination.
Returns 0 (zero) if successful.
HPERR_HANDLE if the image handle is not valid.
HPERR_PARAM if pLiveDisplayInfo is NULL or contains invalid members.
HPERR_BOARDFEATURE if the board is an ACCURA which isn’t capable
of displaying live video.
HPERR_TIMEOUT if something is wrong with the video signal, or if no
video is connected.
eHD_LiveDisplayMode
Description Starts or stops display of live video. Note that as of the IDEA Release
1.6, this is the preferred method for displaying live video, as opposed
to calling LiveVideoInit()…LiveVideoMode().
eHD_LiveStreamInit
Description Prepares the library to stream live video to a series of buffers that
may then be saved in an AVI file. The frame grabber must be capable
of streaming live video. Note that as of the IDEA Release 1.6, this is
the preferred method for streaming live video, as opposed to calling
LiveVideoInit()…LiveVideoMode().
eHD_LiveStreamMode
Description Starts or stops streaming of live video. Note that as of the IDEA
Release 1.6, this is the preferred method for streaming live video, as
opposed to calling LiveVideoInit()…LiveVideoMode().
eHD_ReleaseStreamBuffer
eHD_LiveStreamClose
Description Cleans up internal structures after streaming live video. Note that as
of the IDEA Release 1.6, this is the preferred method for streaming
live video, as opposed to calling LiveVideoInit()…LiveVideoMode().
eHD_RSET_Check
eHD_RSET_Get
eHD_RSET_Set
eHD_SetChannel
HDCHAN_CA2
HDCHAN_CA3
HDCHAN_CA4
lCChan New horizontal and vertical sync source or –1 if the sync
sources are not to be changed. Any of the HDCHAN_*
definitions may be used for this parameter.
wControl Only one bit of this is used. It may be either of two
values:
HDSET_SYNCHR_OFF New channel values are used
the next time an operation
such as SET or GRAB is issued
but these values are not set
immediately.
HDSET_SYNCHR_ON New channel values are made
ready to use the next time a
SET or GRAB is issued. In
addition, the board is set up
using the entire RSET for this
image handle (with the new
channel settings) so that the
board indicator lights
immediately reflect the
change.
Sync detection is provided
with the board by using this
control value and checking
for HPERR_TIMEOUT.
This board set up always
completes before returning
from this routine and persists
until any other operation is
performed with the board
using this or any other image
handle.
Returns 0 (zero) if successful
HPERR_CHANNEL_RANGE Channel parameter out of valid
range.
HPERR_HANDLE
HPERR_TIMEOUT If HDSET_SYNCHR_ON is set in wControl, then this
error is returned if signal is not detected on the given channel.
eHD_SetWhiteBalance
eHD_SnapToBuffer
eHD_TestWhiteBalance
Description Retrieves the current AccuStream white balance gain and offset
register and calibration values and calculates a new set of calibration
values based on the current gain/black level values and the video
image. Original and newly calibrated data are written to the
HD_WBALDATA structure to be passed to eHD_SetWhiteBalance(). This
function should not be called while live video or streaming is active.
Parameters ih Current image handle.
prset Register set to be updated.
pWBD Pointer to the white balance data structure. This a large
structure of internally used information. An application
must set all structure members to zero before calling
eHD_TestWhiteBalance.
Returns 0 (zero) if successful.
HPERR_PARAM if any of the input parameters are NULL pointers
HPERR_HANDLE if the board handle is not valid
HPERR_MEMORY_ALLOC if there is insufficient system memory
fine_abswait
fine_add
fine_ascii_local
fine_delta
fine_later
fine_now
fine_subtract
fine_wait
_HP_Error
HP_UnClaim
ihHD_Allocate
HPCLAIM_TOOMANY
HPCLAIM_VXD_REV
nHP_ClaimAll
nHP_ErrMessage
nHP_GetBoardInfo
nHP_Report
eHD_GetMaxBuffers
The bValue member is the actual value that you want to send or retrieve from
the function, for instance to get or set the brightness. The pRSet is a pointer to
your currently active RSET. If this pointer is not null, then the function will
update your currently active RSET to hold the new value. If the RSET member
pointer is null, then the new setting will be passed to the board, but not made
persistent. If you do not pass an RSET pointer then you will be out of sync with
the current settings and will not be able to save the values in a CHP file. This
also means that the pRSet member must either be null, or point to a valid RSET
structure or undefined behavior will result.
The following sections describe each string value that can be passed to these
functional interfaces.
ActiveMode
Description This retrieves or sets the active video mode setting from the
AccuStream. This is used to determine if the incoming video is analog
or digital. In most cases, digital mode is detected automatically and
this allows an application to adjust accordingly.
The lValue member of the pUVS parameter can be an Or’d
combination of the following values:
HD_ACTIVE_INTERFACE_ANALOG
HD_ACTIVE_INTERFACE_DIGITAL
HD_ACTIVE_INTERFACE_UNSPECIFIED
HD_DIGITAL_INTERFACE_DETECTED
HD_ANALOG_SYNC_DETECTED
HD_ANALOG_VSYNC_DETECTED
HD_DIGITAL_SYNC_DETECTED
Brightness
Description Adjust or retrieve the AccuStream 50a, 75a, 205a board’s standard
video section brightness. The bValue member is a linear value from 0
to 255 in which 0 is darkest and 255 is the brightest setting.
ClampDuration
Description Sets or retrieves the duration of the mid-scale clamp. This is useful for
component YPbPr input. For such component input, set the lValue
member of pUV to a 1 to 255.
ClampPlacement
Description Sets or retrieves the positioning of the mid-scale clamp. This is useful
for component YPbPr input. For such component input, set the lValue
member of pUV to a 1 yto 255.
Contrast
Description Adjust or retrieve the AccuStream 50a, 75a, 205a board’s contrast.
The bValue member is a linear value from 0 to 255 in which 0 is the
lowest contrast and 255 is the highest contrast setting.
FinePhaseAdjust
Description Sets the phase value of the AccuStream board. This is a true pixel
phase in 11.5° increments. Values can range from 0 to 31.
ForceTrigger
ForceTriggerAll
Description This will simulate a hardware trigger event on all boards in a system.
This is useful when you have multiple boards attached to multiple
video sources and you want them all to snap the same frame.
This will only force triggers for boards under the control of the current
application. If multiple boards are under the control of multiple
applications, then each application will have to call ForceTriggerAll.
HardReset
Description Resets the frame grabber and forces a re-load of the FPGA.
Notes After calling this, the board is in an unknown state, therefore you
must re-load the RSET before attempting to capture an image.
HorizontalPosition
Hue
Description Adjust or retrieve the AccuStream 50a, 75a, 205a board’s hue. The
bValue member is a linear value from 0 to 255. These values cover the
range from -180° to +178.59°. “Normal” hue is a value of about 127.
IRGBCable
Description This sets the sync configuration for an AccuStream board for the
particular input cable type. The lValue member of the
UpdateVideoSettingLong member contains a value that will specify the
cable type as follows:
0 = DVI to BNC
1 = DVI to VGA
2 = DVI to DVI
Normally, an application will not have to alter this control setting
since it is initialized by the library according to the CABLE value in the
I-RGB section of the CHP file.
MonoCapture
RedGain,GreenGain,BlueGain
Description Provides fine tuning of the gain calibration value for each of the
channels. The lValue member of the UpdateVideoSettingLong contains
a value of 0-255 that gets scaled internally by the library.
RedOffset,GreenOffset,BlueOffset
Description Provides fine tuning of the offset calibration value for each of the
channels. The lValue member of the UpdateVideoSettingLong contains
a value of 0 to 255 that gets scaled internally by the library.
RetriggerDelay
Description Adjust or retrieve the time that the machine vision board will not
detect another trigger after one has already been detected. This time
commences at the end of the trigger pulse. The time is measured in
12.8 microsecond increments. The formula is:
Retrigger delay = Value written to this register x 12.8 microseconds.
RetriggerDelayTime
Description Adjust or retrieve the time that the machine vision board will
not detect another trigger after one has already been detected. This time
commences at the end of the trigger pulse. The time is in microseconds.
Saturation
Description Adjust or retrieve the AccuStream 50a, 75a, 205a board’s saturation.
The bValue member is a linear value from 0 to 255 in which 0 is the
lowest saturation and 255 is the highest saturation setting.
SyncFilter
TriggerFilterTime
Description Adjust or retrieve the time in which the circuitry will recognize a
trigger edge. The granularity is in microseconds.
Notes This is useful for filtering false edges if the trigger circuitry contains a
bounce.
TriggerState
Description Retrieves the current state of the trigger input. Returns a 1 for a high
level, and a zero for a low level.
YUVClamp
Description Sets or retrieves a flag controlling how the A/D converter on the
AccuStream sets its mid-scale clamp. This is useful for component
YPbPr input. For such component input, set the lValue member of pUV
to a 1. Note that the application will have to convert the resulting
YPrPb values to RGB for display.
SaturationYPbPr
Description Sets or retrieves the saturation value when capturing YPbPr video
signals.
Signalinfo
VideoHeaders
Description Retrieves the list of video headers created by the library in the call to
eHD_LiveStreamInit. By retrieving these headers, the application can
poll them to determine if a frame of video has been captured during a
streaming operation. This can be used instead of waiting for a frame-
ready event.
VideoHeaderList is defined as :
MaximumPixels
IRGBCableList
Description Returns a list of the supported cable types. An application can use this
if implementing its own version of Auto-SYNC and needs to present a
list of cable types to the user.
FSICableList is defined as:
typedef struct tagFsiCableList {
int iNumEntries;
char **pList;
} FsiCableList;
Where iNumEntries will contain the number of entries in the list. Then
each pList[i] is a pointer to a zero terminated string for the cable
type.
SoftReset
Description Performs a soft reset on the board. This merely clears the FIFO in the
PCI interface as a fast means of returning the board to a stable state.
This may be necessary if the video signal has become unstable during
a streaming or live display operation. This is much faster than the hard
reset which causes the boards FPGA to be reloaded and requires a
complete re-initialization of the board’s register set.
CHAPTER 5:
ActiveX Function Listings
This chapter describes three IDEA ActiveX controls: IdeaBoardInfo, IdeaFG and
IdeaDisplay. These are contained in IdeaCtls.ocx and are registered during the
installation program.
The ActiveX controls offer an easier-to-use, higher-level interface than direct
calls to the IDEA API. By using the ActiveX control, many common, but
complicated, operations are reduced to simple, language-independent method
calls.
If you have an existing application that used earlier versions of the IDEA
ActiveX control, you may wish to skip right to the migration sections at the end
of this chapter, in order to get your application running with the new version
first.
To update the ActiveX controls from a previous version, the procedure depends
on whether the interface has changed. If the interface has not changed, then
the new ActiveX controls need only be installed and registered. If the interface
has changed, then the applications using them must be rebuilt with the new
ActiveX controls.
Normally the interface will only change for a major release, not a point
release. The release notes will warn if, when, and how any changes are made
to the interface. While it is recognized that it is important to maintain stability
as much as possible, it is also important to continue to deliver new features
and technologies as they evolve.
For Visual Basic, simply recompile and re-make the .EXE executable if there is
one. That is all there is to do.
For MFC, delete any of these files, if they are in your project: ideadisplay.cpp,
ideadisplay.h, ideafg.cpp, ideafg.h, ideaboardinfo.cpp, and ideaboardinfo.h.
These are wrapper files and they will be regenerated when you re-import the
control(s). Delete them from both the project files list in Visual Studio and
from the project folder.
Next, re-import the ActiveX controls by following the same steps outlined
above for importing them the first time, then rebuild the application. If the
“CPicture” class appears during step 3, uncheck the checkbox for it because it
should not be re-imported.
Definitions
The definitions of some terms used in the ActiveX control interface are given
below:
sequencing Generating a lot of images, successive grabs
Include Files
There are several files located in the \Foresight\Idea\Include directory that
may be helpful for writing applications that use the ActiveX controls.
IdeaOCX.bas, which may be added to Visual Basic projects, and IdeaOCX.h,
which may be #included in Visual C++ source files both contain definitions of
some important constants, enumerations, etc. that are used in the properties
and methods of the ActiveX controls. Also, Hdp_Lib.h and Hdp_Lib.bas are
located in that directory which contain many definitions for the IDEA Library
API, many of which are also used by the properties and methods of the ActiveX
controls.
For MFC, you will need to create an EVENTSINK_MAP in order to use events.
There is a template for one of these with instructions in the IdeaOCX.h header
file for you to copy and paste into your application.
Programmer’s Guide
This section details topics for using the IDEA ActiveX controls. These are how-to
tutorials for quickly writing code to perform basic operations using the IDEA
ActiveX Controls.
The controls are designed so that the most general operations such as snapping
and displaying, snapping and saving, streaming, live display, and so on, may be
programmed very quickly and with very little code, but while still providing the
full capabilities of all of the most common features. Initialization can be as
simple as calling the “Open” method. Snapping can be as easy as calling the
“Snap” method.
For example, the Visual Basic sample application for snapping and displaying an
image contains a trivially simple form and less than twenty lines of code. Yet,
it still supports multiple boards, multiple channels, triggering, brightness and
Multiple Boards
When the IdeaFG control is first instantiated, it chooses by default the first
board it finds to be the currently selected board to be used. Normally, the
default is acceptable and the end-user may choose a board from the
Configuration Dialog.
However, if multiple boards are installed, the application may at that time
select a board prior to initializing the control (see Preselecting a Board below).
IdeaFG identifies boards by an index (the “CurrentBoardIndex” property) which
is an integer between zero and the number of installed boards (the
“BoardCount” property) minus one, inclusive.
Preselecting a Board (Multiple Boards)
If the application knows the index of the board it wants to select, it may simply
set the “CurrentBoardIndex” property to that value.
If the application knows the serial number of the board it wants to select, it
can get the index of that board by passing the serial number (a character
string) to the “GetIndex” method.
The application may also choose a board of a particular type by examining the
“NthBoardType” property for each board index from zero up to the number of
boards given by the “BoardCount” property minus one.
To let the end-user select a board prior to initialization, the application may
display a built-in dialog for doing this by calling the
“ShowBoardSelectionDialog” method. After this modal dialog returns, the
“CurrentBoardIndex” property will be already set to the user-selected board.
Custom Board Preselection (Multiple Boards)
The application may also create its own board selection dialog and populate a
list of boards from which to choose, by using information from the
“BoardCount”, “NthBoardDescription”, “NthBoardType”,
“NthBoardTypeString”, and “NthSerialNumber” properties.
User-Defined Board Names
The Board Selection Dialog, described above, has a “User-Defined Names”
button. This option will bring up another dialog that allows the user to choose a
(character string) description for the board that gets stored in the
“NthUserDefinedBoardName” property for that board’s index.
To hide this button, pass the BOARD_SELECTION_NO_NAMES flag to the
“ShowBoardSelectionDialog” method.
The Configuration Dialog also has a “User-Defined Names” button. To hide this
button, pass the CONFIG_DIALOG_NO_NAMES flag to the “ShowConfigDialog”
method.
To set a user-defined board name from the application, pass it as an ordinary
character string to the “NthUserDefinedBoardName” property for that board’s
index.
To retrieve a descriptive character string for display purposes that includes the
board type, serial number, and any user-defined name, use the
“NthBoardDescription” property for that board’s index.
About Box and Copyright Information
The application may display a modeless “About” dialog box by calling the
“AboutBox” method.
The application may retrieve copyright information as a multiline string from
the “CopyrightNotices” property.
List of Board Information Methods and Properties
A number of methods and properties are available for selecting and obtaining
information about the boards currently installed on the system. Unlike most of
the methods and properties in the IdeaFG control, all of these are allowed to
be called even before initializing. They are listed below.
Video Settings
The following table lists the methods and properties of the IdeaFG control that
can be used for retrieving and modifying video settings. There is also a
separate table listing the control settings used on our machine vision boards.
The Live page is for setting options that only pertain to live display. The Snaps
page is for setting options that only pertain to snaps; and the Streaming page is
for setting options that only pertain to streaming. There is also an About page,
which contains version, system, support, and copyright information.
The application may wish to suppress certain features, either to make the
dialog simpler or to prevent the end-user from having access to those features.
An application which does not do snaps or sequential snaps may specify the
“CONFIG_DIALOG_NO_SNAPS” flag in the Flags parameter to the
“ShowConfigDialog” method. An application which does not do streaming may
specify the “CONFIG_DIALOG_NO_STREAMING” flag. An application which
streams but does not stream to DICOM may specify the
“CONFIG_DIALOG_NO_DICOM” flag. An application which does not do live
display may specify “CONFIG_DIALOG_NO_LIVE”.
The Configuration Dialog only displays options that are possible at that time.
For example, if the “Enable Audio” checkbox is not checked, all the other
options for streaming with audio are disabled. If there is no sound card
installed, then the entire group box containing audio settings is hidden. If the
currently selected board is not capable of streaming, then the entire Streaming
page is removed.
Using the Configuration Dialog While Displaying
The Configuration Dialog is a modeless dialog. End-users may change a number
of options such as the currently selected board, channel, pixel type, area of
interest, or decimation which may change the size of the snapped or live
images or the manner in which they are displayed.
To avoid improperly displaying snapped images or live display, the application
should handle the OnNotificationMessage event and look for the MessageCode,
“IDEA_INFO_DIALOG_ACTION” with a MessageParameter equal to
“DIALOG_UPDATE_DISPLAY”, and take appropriate action when this is received.
For snapped images, the display window may need to be resized for the next
snap; and live display may need to be stopped and restarted.
Data Persistence in the IdeaFG Control
The IdeaFG control caches configuration settings in its own member variables
(i.e. properties). They are in effect until they are changed again or the
application is closed. To save these settings for the next time it is run they
must be stored in the Windows registry. The “WriteConfiguration” method
saves all of the settings at once to the registry. This method is called
automatically when the end-user clicks “Apply” or “OK” in the Configuration
Dialog.
The “ReadConfiguration” method loads all of the settings at once from the
registry into the IdeaFG member variables. This method is called automatically
• Set any other properties you may need for snaps, live, streaming, etc.
The OCX is ready to go at this point.
• Do not set the "HardwareProfile" property at any time.
To change boards when managing your own configuration, call the "Close"
method and then follow steps 2, 3, and 4 above. Also, change any properties
you may have set in step 5 above, but this is only necessary if they are
different for the new board (e.g., if using a different "AVIFile" pathname for
each board).
Snapping an Image
The IdeaFG control has a “Snap” method for snapping a single image. The
“Snap” method will not return until the snap is complete or an error has
occurred. If triggering is enabled for snaps, the “Snap” method will not return
until after the trigger.
Snap to IdeaDisplay Control
See the section, “Initializing the IdeaDisplay Control With IdeaFG” above.
Essentially, the application just needs to tell the controls about each other and
then the image goes from IdeaFG to IdeaDisplay automatically via Windows
messaging on each snap. The display control window may need to be sized for
the image.
Snap to Other Controls
After calling the “Snap” method to snap a single image, call the “GetImageDIB”
method to retrieve a handle to the image DIB, or call the “GetImagePicture”
method to retrieve an LPPICTUREDISP pointer, depending on what the display
control expects. The display control window may need to be sized for the
image.
Asynchronous Snaps With Events
The “Snap” method does not return until the snap is completed. This might be
undesirable in case, for example, if triggering is enabled. To perform a snap in
a separate thread, call the “SnapInThread” method instead. To cancel a snap
that is in progress, call the “SnapCancel” method.
If a snap is executing in a separate thread, it may be necessary to know when
the snap has completed, in order to process the image or take other actions,
such as allowing the end-user to snap again. To receive the “OnSnap” event
when the snap is completed, set the “FireSnapEvent” property to TRUE,
otherwise set it to FALSE.
Triggered Snaps
To use a hardware trigger for snaps or sequential snaps, set the “UseTriggers”
property to TRUE or check the “Enable Triggered Snaps” checkbox in the
Configuration Dialog. There is also a “TriggerMethod” property that may be set
to zero for triggering on the rising edge of the trigger pulse or one for
triggering on the falling edge of the trigger pulse.
If the triggered snap or triggered sequential snaps are running in a separate
thread (recommended), then they may be canceled by using the
“ForceTrigger”, “AbortTrigger”, or “SnapCancel” methods. The difference is
that “ForceTrigger” forces the completion of the snap and returns an image,
whereas the other two methods are for aborting the snap.
NOTE: at the time of this writing, the IDEA Native Library does not have an
abort trigger implementation, so the “AbortTrigger” function currently does
the same thing as “ForceTrigger”.
Sequential Snaps
To perform multiple snaps, set the SequenceCount property to the number of
snaps desired, then call the SnapSequence method. The SnapSequence method
does not return until all of the requested snaps are completed, or an error
occurs.
All of the methods and properties described above for triggered snaps also
apply to triggered sequential snaps.
If the FireSnapEvent property is TRUE, the application will receive the OnSnap
event after each snap.
Asynchronous Sequential Snaps With Events
To perform multiple snaps in a separate thread, call the SnapSequenceInThread
method instead of SnapSequence.
The SnapSequenceInThread method takes a single parameter called SnapEvent.
If the SnapEvent parameter is set to zero, the method will take a snap as soon
as the last snap is completed. Otherwise, it is assumed that the SnapEvent
contains an event handle created by the application to be used to indicate
when the application wishes to signal the next snap. The typical way this is
used is as follows: 1) application sets the SnapEvent event; 2) IdeaFG snaps; 3)
IdeaFG fires the OnSnap event; 4) application receives the OnSnap event and
processes the image; 5) application sets the SnapEvent event again; etc.
The application may call the SnapSequenceCancel method at any time after
calling SnapSequenceInThread to terminate the snap sequence, regardless of
the number of snaps specified in the SequenceCount property. To use
SnapSequenceCancel as the sole method of terminating the snap sequence, tell
the IdeaFG control to snap forever by setting the SequenceCount property
equal to –1.
Getting a Histogram
To get a histogram, first snap an image using one of the methods described
above, then call the GetHistogram method. The GetHistogram method returns
a VARIANT containing a reference to a SAFEARRAY of long integers (signed, 32-
bit values) which are the histogram data for each possible pixel value. The size
of the array is determined by the pixel depth, and is returned to the caller in
the NumPoints parameter, which is a pointer to a long integer.
The histogram returned is calculated from the most recently snapped image,
which could be from a single snap or the most recent of a sequence of snaps.
To manage histograms in a sequence of snaps, it would be best to do so using
asyncronous sequential snaps and to process it in the event handler for the
OnSnap event, and to use a SnapEvent event to signal IdeaFG when the
application is done with the histogram (and the image). This is because both
the image and the histogram are no longer valid once the next snap has begun.
application, or the end-user, has less control over the saved format of the
image, if it is being saved to a BMP file. For an example of this, look at the
code in the IDEA Visual Basic Demo.
The format of the image is irrelevant if it is being saved to a JPEG format file.
To specify the file format, use the third parameter. For Windows BMP format,
set it to IIF_IMAGE_FORMAT_BMP, or to IIF_IMAGE_FORMAT_JPEG for JPEG
format. Set it to –1 to let the file suffix (.jpg or .bmp) determine the format.
Getting the Snapped Image Raw Data Buffer
After an image has been snapped, call the “GetPixelData” method to retrieve a
VARIANT containing a reference to a SAFEARRAY of BYTEs that is the raw image
buffer, unconverted to DIB format. The image is valid and available after it has
been snapped, and until the next snap has begun. To ensure that the
application is using the image during the time it is valid and available,
coordinate with the IdeaFG control using events, as described above.
Saving 10-bit Images as 16-bit PNG
Since the Windows DIB, Windows Bitmap (BMP) and JPEG format files, and
standard display software and hardware, do not allow 10-bit images, the image
pixel data in 10-bit format is only available in the raw buffer. The IdeaFG
control provides a method for saving 10-bit monochrome to 16-bit monochrome
(where the least significant 6 bits are zero) in the PNG file format.
To save to PNG, call the SavePixelDataToFile method with the PixelData buffer
returned from the “GetPixelData” method, the image dimensions (from the
“GetSnapWidth” and “GetSnapHeight” methods and the “BitsPerPixel”
property), the save file pathname, and the file type (ignored for now – only
PNG is allowed).
This method will also save 8-bit monochrome as 8-bit monochrome PNG.
For an example of saving images to PNG format, see the sample code in
VbSnapAndSave.
Live Display
that dimension). To set decimation using the Configuration Dialog, check the
“2x Width Decimation” and/or “2x Height Decimation” checkboxes on the
“Live” property page.
Note that area of interest is always applied before horizontal and vertical
decimation. Also, note that color boards cannot decimate in the horizontal
direction for live display.
To set frame decimation, set the “DecimateFrameRate” property to a value
between 1 and 256, or set this value in the “Frame Rate Decimation” edit box
on the “Video” property page of the Configuration Dialog. The source frame
rate will be divided by this value to produce the decimated frame rate.
Note that the decimated frame rate applies to both Direct Draw live display
and streaming – frame rate decimation cannot be set independently for these
two operations.
Updating the Live Display Window
To force an update of the live display surface in IdeaDisplay, call the IdeaFG
method, “LiveVideo” with the “StartLive” parameter set equal to TRUE while
the live display is running, as if starting the live video again.
To receive notification of updates such as a change of selected board, CHP file,
etc., see the above section, “Using the Configuration Dialog While Displaying”.
The application will handle the OnNotificationMessage event and respond to
certain codes by stopping and restarting live display, and possibly resizing the
display window in between.
Multiple Monitor Direct Draw
Direct Draw live display to multiple monitors on the same computer is possible
by using separate application instances accessing different IDEA frame grabber
boards. Certain system requirements also apply. First, the system must be
Windows XP and must be running at least Direct Draw 8.1. A multi-monitor
graphics display card supporting Direct Draw 8.1 on these operating systems is
also required. Also, a special version of the IDEA ActiveX controls with multiple
monitor support is required; this version will not run on earlier operating
systems such as Windows 98 or NT, so it is not part of the general release.
Finally, there may be other restrictions imposed by the particular multi-
monitor graphics card. Contact Foresight Imaging’s sales department for more
information if you are interested in this feature.
GDI Live Display
While most people prefer Direct Draw live display for its performance and
other features, GDI live display is also available for IDEA frame grabber boards
that are not capable of Direct Draw, or other reasons for choosing GDI. The
IDEA ActiveX controls implements GDI live display, sometimes called “pseudo-
live display”, essentially as a threaded sequence of snaps that are sent directly
from IdeaFG to IdeaDisplay (in fact, you could do that yourself using the
SnapSequenceInThread method, but this is a bit easier).
To do GDI live display, follow the steps in the above section, “Direct Draw Live
Display”, except that instead of setting IdeaDisplay’s property “LiveDisplay” to
TRUE, set it to FALSE. IdeaDisplay will then prepare a GDI window instead of a
Direct Draw window and tell IdeaFG to send it sequential snaps instead of
initiating Direct Draw live mode. For an example of this code, which does both
Direct Draw and GDI live mode, see the IDEA Visual Basic demo.
Live Display
Streaming
simply not enough bandwidth to stream into the buffers, or there are not
enough buffers, and then frames will be dropped.
In this case, it is recommended that frame rate decimation be used to reduce
the frame rate to the point where frames are not dropped. To set frame
decimation, set the “DecimateFrameRate” property to a value between 1 and
256, or set this value in the “Frame Rate Decimation” edit box on the “Video”
property page of the Configuration Dialog. The source frame rate will be
divided by this value to produce the decimated frame rate.
Note that the decimated frame rate applies to both Direct Draw live display
and streaming – frame rate decimation cannot be set independently for these
two operations.
Another option available for streaming is the “StreamingLogFile” property,
which corresponds to the “Log File” edit box on the “Streaming” property page
in the Configuration Dialog. Setting this value to the pathname of a text file
will cause a human-readable log file to be generated during streaming. This log
file will be necessary if any streaming-related problems are to be reported to
Technical Support. Setting this property to an empty string will cause IdeaFG to
not generate a log file.
Streaming to AVI Files
To stream to an AVI file, the pathname of the file must first be set either by
setting the “AVIFile” property, or by setting the pathname in the “AVI File”
edit box in the Configuration Dialog on the “Streaming” property page. Then,
call the “StreamToAvi” method passing the number of frames to stream.
For examples of streaming to an AVI file, see the sample code in VbStream or
CppStream.
Streaming to Memory Buffers
There may be cases where an application needs to implement its own
“StreamToAvi” or “StreamToDicom”; or it needs to stream to some other
format; or for some other reason needs to receive streamed image buffers and
process them itself. For these cases, a “StreamToMemory” method is provided
which does essentially what “StreamToAvi” and “StreamToDicom” do, except it
does not output to a file and it does not delete the buffers when it is finished.
For streaming to memory, some additional methods are added to give the
application control over the video buffers in a flexible manner. A
“MemoryHandle” parameter is returned from each call to “StreamToMemory”
which identifies the set of video buffers from that particular stream. Keep in
mind that if the number of frames streamed exceeds the number of buffers
allocated, then the buffers are treated as a ring (i.e., after they are all filled
the streaming reuses them starting again with the first buffer). In other words,
the application will need to be fast enough to keep up with the streaming.
To access a buffer, the application can use the “FramePointer” parameter in
the OnFrameReady event, which is a pointer to a VARIANT containing a
reference to a SAFEARRAY of BYTEs. This event also returns a “FrameNumber”
parameter. This is most useful for an application doing a long stream and
processing every frame sequentially (as it is ready).
Additionally, there is a “GetBuffer” method which takes a “MemoryHandle”
and a “FrameNumber” parameter. This is most useful for an application that
will stream N frames into N buffers, perhaps several times, and then go back
and access the buffers in any order.
When the application is finished with the buffers from a particular stream, it
should call the “ReleaseBuffers” method to free the buffers’ memory that is
associated with a particular memory handle, or call “ReleaseAllBuffers” to free
all buffer memory.
For an example of streaming to memory, see the code in the IDEA Visual Basic
Demo.
Triggered Streaming
To control streaming using a hardware trigger, set the “TriggeredStreaming”
property to one of the values TRIGGER_START_STOP_LOW,
TRIGGER_START_STOP_HIGH, TRIGGER_RUN_LOW, TRIGGER_RUN_HIGH,
depending on the trigger polarity and whether it is desired to start and stop
streaming with a trigger click, or while holding or releasing the trigger.
The “TriggerFilterTime” property is useful for debouncing trigger switches to
eliminate double triggers.
Streaming to Multiple Files
With triggered streaming it is possible to redirect the output to different AVI
files with each change in trigger state by ORing the “Flags” parameter of the
“StreamToAvi” method with the STREAMING_TERMINATE_ON_TRIGGER_STOP
flag. This flag will cause streaming to terminate after a single trigger. Then, in
the “OnStreamingTermination” event handler, the application can change the
“AVIFile” parameter to the pathname of a different AVI file, and call
“StreamToAvi” again.
For an example of streaming to multiple files, see the IDEA Visual Basic Demo.
Streaming with Start, Pause, and Cancel Events
Streaming may be started, paused/resumed, and canceled using user created
events. Create and pass any or all of these three event handles to the
streaming method in the “StartEvent”, “PauseEvent”, and “CancelEvent”
Streaming
Properties
ApplicationNotBusyEvent Property
Description Sets or returns the handle to an event that the application should fire
to indicate that it is not currently performing operations such as
snapping, streaming, live display, user dialogs, etc. Setting this event
signals that the application is ready for the IdeaFG control to proceed
with some operation.
This property is currently used for Automatic Signal Detection.
Type long
AudioBitsPerSample Property
Description Sets or returns the sample size in the AVI file for playback. Usual
values are 16 (CD quality) or 8 bits.
This property is used when streaming both audio and video to an AVI
file.
Type long
Syntax Visual Basic
Object.AudioBitsPerSample = Value
Value = Object.AudioBitsPerSample
C++
Object.SetAudioBitsPerSample(long Value)
long Value = Object.GetAudioBitsPerSample( )
AudioChannels Property
Description Sets or returns the number of channels to be recorded in the AVI file.
Must be 1 for monaural or 2 for stereo.
This property is used when streaming both audio and video to an AVI
file.
Type long
Syntax Visual Basic
Object.AudioChannels = Value
Value = Object.AudioChannels
C++
Object.SetAudioChannels(long Value)
long Value = Object.GetAudioChannels( )
AudioEnabled Property
AudioSampleRate Property
Description Sets or returns the sample rate in the AVI file for playback. Usual
values are 44100 (CD quality), 22050, and 11025.
This property is used when streaming both audio and video to an AVI
file.
Type long
Syntax Visual Basic
Object.AudioSampleRate = Value
Value = Object.AudioSampleRate
C++
Object.SetAudioSampleRate(long Value)
long Value = Object.GetAudioSampleRate( )
AutoSignalDetection Property
Description Sets or returns the Automatic Signal Detection flag. A value of zero
means disabled, a value of one means enabled.
Automatic Signal Detection is a feature which, when enabled, will
cause the IdeaFG control to detect a loss of signal, as from
disconnection of the video cable, and a reaquisition of signal, as from
reconnection of the video cable (presumably to a different video
source), and then automatically run VESA scanning to reconfigure the
board to the new video signal.
On disconnection, the application will receive an
OnNotificationMessage event, with a MessageCode equal to
IDEA_INFO_CONNECTION and a MessageParameter equal to
IDEA_CONNECTION_LOST. The application should, upon receiving this
event, terminate live display and disable any controls or menu items
that may cause action in the IdeaFG control, such as snaps, streaming,
C++
Object.SetAutoSignalDetection(long Value)
long Value = Object.GetAutoSignalDetection( )
AVIFile Property
Description Sets the pathname of the AVI file to be used by the StreamToAvi
method for streaming video and playback.
Type string
Syntax Visual Basic
Object.AVIFile = Value
Value = Object.AVIFile
C++
Object.SetAVIFile(LPCTSTR Value)
CString Value = Object.GetAVIFile( )
BitsPerPixel Property
Description Shows the resolution of the frame grabber in bits per pixel, according
to the output format currently defined by the PixelType property. This
is a READ-ONLY property.
Type long
Syntax Visual Basic
Value = Object.BitsPerPixel
C++
long Value = Object.GetBitsPerPixel( )
BoardCount Property
C++
long Value = Object.GetBoardCount( )
BoardHandle Property
Description Returns the board handle for the current board so that IDEA library
functions may be called if necessary -- even while using the ActiveX
control for everything else. This is a READ-ONLY property.
Type long
Syntax Visual Basic
Value = Object.BoardHandle
C++
long Value = Object.GetBoardHandle( )
BoardLocation Property
Description Displays the location of the board as determined by the device driver.
This is a READ-ONLY property that is filled in by the OCX when the
board-handle is determined. For I-Series frame grabbers, this property
displays a Slot designation.
Type string
Syntax Visual Basic
Value = Object.BoardLocation
C++
CString Value = Object.GetBoardLocation( )
Brightness Property
Description Changes or retrieves the brightness of the incoming image. The value
is in the range of 1 to 100 and is computed internally from the board’s
Black Level, Gain, Black Reference and White Reference values. For
AccuStream 50a, 75a, and 205a boards.
Type long
Syntax Visual Basic
Object.Brightness = [Value as Long]
C++
Object.SetBrightness(long Value)
Value = Object.GetBrightness( )
BytesPerPixel Property
Description Shows the resolution of the frame grabber in bytes per pixel,
according to the output format currently defined by the PixelType
property. This is a READ-ONLY property.
Type long
Syntax Visual Basic
Value = Object.BytesPerPixel
C++
long Value = Object.GetBytesPerPixel( )
CableTypeIndexIRGB Property
Description Sets or returns the index into the list of valid cable types, of the
currently selected cable type for the currently selected board.
This property returns –1 if an error occurs.
Type long
Syntax Visual Basic
Object.CableTypeIndexIRGB = Value
Value = Object.CableTypeIndexIRGB
C++
Object.SetCableTypeIndexIRGB(long Value)
long Value = Object.GetCableTypeIndexIRGB( )
CableTypeIRGB Property
Description Sets or returns the name of the currently selected cable type for the
currently selected board.
This property returns an empty string if an error occurs
Type string
Syntax Visual Basic
Object.SetCableTypeIRGB(Value)
Value = Object.GetCableTypeIRGB
C++
Object.SetCableTypeIRGB(LPCTSTR Value)
CString Value = Object.GetCableTypeIRGB( )
CodecDLL Property
Description Gets the path to the DLL containing a user-defined CODEC for
compressing streamed data. This is a READ-ONLY property. Use the
CodecLoad method to set this value.
Type string
Syntax Visual Basic
Value = Object.CodecDLL
C++
CString Value = Object.GetCodecDLL( )
CodecFourCCType Property
Description Gets the FourCC code used by the CODEC for compressing streamed
data. This is a READ-ONLY property. Use the CodecLoad method to set
this value.
Type long
Syntax Visual Basic
Value = Object.CodecFourCCType
C++
long Value = Object.GetCodecFourCCType( )
CodecVideoQuality Property
Contrast Property
Description Changes or retrieves the contrast of the incoming image. The value is
in the range of 1 to 100 and is computed internally from the board’s
Black Level, Gain, Black Reference and White Reference values. For
AccuStream 50a, 75a, and 205a boards.
Type long
Syntax Visual Basic
Value = Object.Contrast
Object.Contrast = Value
C++
long Value = Object.GetContrast( )
Object.SetContrast(long Value)
ControlManagesConfiguration Property
Description Tells the IdeaFG ActiveX control that it will manage user-defined
configuration settings. Default value is TRUE. See Configuration and
Data Persistence, earlier in this chapter, for a detailed discussion on
the usage of this property to manage your own confiiguration settings.
Type Boolean
CopySnapToClipboard Property
CopyrightNotices Property
Description Gets the copyright notices for the IDEA ActiveX controls, as a
formatted string.
Type long
Syntax Visual Basic
Value = Object.CopyrightNotices
C++
CString Value = Object.GetCopyrightNotices( )
CurrentBoardIndex Property
Description The index of the currently selected board. The first board has index 0,
second board has index 1, third board has index 2, etc. This property
is not valid if there are no boards in the system.
Type long
DecimateFrameRate Property
Description Sets or returns the frame rate decimation value for both streaming
and live display. The value must be between 1 and 256. The video
frame rate is divided by the frame decimation value to give the
effective frame rate.
To set the frame rate decimation from the Configuration Dialog
screen, bring up the Video Options tab and enter a value in the "Frame
Rate Decimation" text box.
Type long
Syntax Visual Basic
Object.DecimateFrameRate = Value as long
Value = Object.DecimateFrameRate
DecimateLiveHorizontal Property
Description The horizontal decimation factor for live video display. Allowable
values are: 1=no decimation, 2=decimation by 2. This property is not
valid on color boards.
Type long
DecimateLiveVertical Property
Description The vertical decimation factor for live video display. Allowable values
are: 1=no decimation, 2=decimation by 2.
Type long
DecimateSnapHorizontal Property
Description The horizontal decimation factor for snaps. Allowable values are: 1=no
decimation, 2=decimation by 2. Snap decimation is performed in
software.
Type long
DecimateSnapVertical Property
Description The vertical decimation factor for snaps. Allowable values are: 1=no
decimation, 2=decimation by 2. Snap decimation is performed in
software.
Type long
DecimateStreamHorizontal Property
DecimateStreamVertical Property
Description The vertical decimation factor for video streaming. Allowable values
are: 1=no decimation, 2=decimation by 2.
Type long
DefaultBoardIndex Property
DefaultCableTypeIRGB Property
Description Sets or returns the default cable type that is to be used when running
VESA scanning in silent mode.
Type long
Syntax Visual Basic
Object.DefaultCableTypeIRGB = Value
Value = Object.DefaultCableTypeIRGB
C++
Object.SetDefaultCableTypeIRGB(long Value)
long Value = Object.GetDefaultCableTypeIRGB( )
DigitalMode Property
FieldUpdateLive Property
FieldUpdateStream Property
FireSnapEvent Property
Description Informs the control whether or not to fire an event when completing a
Snap operation. The application must define a receiving function in
order to receive the event. Refer to the Events section later in this
chapter for more information about events.
Type boolean
Syntax Visual Basic
Object.FireSnapEvent = (Value as Boolean)
C++
Object.SetFireSnapEvent (long Value)
Value = Object.GetFireSnapEvent ( )
ForceMonoSnapsTo24Bit Property
Description Sets or returns a flag to indicate that the DIB returned from snaps
should contain 24-bit RGB data instead of 8-bit palettized data. This
property is useful if the palettized data is producing undesirable
effects, such as when the palette is lost or the wrong palette is used.
Generally, using this flag will result in a larger (nearly 3x) buffer and
image file.
Valid values are 0=don’t force mono snaps to 24-bit, non-zero=do
force nono snaps to 24-bit.
This property is only valid for monochrome pixel types (8-bit or 10-bit
on mono boards or 8-bit YCbCr Y-only on color boards).
Type long
Syntax Visual Basic
Object.ForceMonoSnapsTo24Bit = Value
Value = Object.ForceMonoSnapsTo24Bit
C++
Object.SetForceMonoSnapsTo24Bit(long Value)
long Value = Object.GetForceMonoSnapsTo24Bit( )
FrameRateMeasured Property
Description Returns the current actual frame rate as measured by the control.
This property is only valid during multiple frame captures, such as
sequential capture, streaming, and continuous capture mode. This
property is not reliable during the first one second of video capture.
This is a READ-ONLY property.
Type long
Syntax Visual Basic
Value = Object.FrameRateMeasured
C++
long Value = Object.GetFrameRateMeasured( )
FrameRateTheoretical Property
Description Returns the current frame rate of the video source according to the
configuration values in the CHP file. This is a READ-ONLY property.
Type long
Syntax Visual Basic
Value = Object.FrameRateTheoretical
C++
long Value = Object.GetFrameRateTheoretical( )
HardwareProfile Property
NOTE: The application should not set this property. Rather, set the appropriate
CHP pathname property for the intended channel; i.e., CA1Path, CA2Path,
…, SVideo1Path, etc. This property will likely become READ-ONLY at some
time in the future.
Description This property is the complete path to the Common Hardware Profile
database. This is a READ-WRITE property that is initially filled in by
the OCX. The default value is read the first time from the registry.
After the control has been filled in and saved, subsequent values will
reflect that saved value.
Type string
Syntax Visual Basic
Value = Object.HardwareProfile
C++
CString Value = Object.GetHardwareProfile( )
Hue Property
Description Changes or retrieves the hue of the incoming image. The value is in
the range of 0 to 255. For AccuStream 50a, 75a, and 205a boards.
Type long
Syntax Visual Basic
Object.Hue = Value
C++
Object.SetHue(long Value)
Value = Object.GetHue( )
ImageDIBBitsSizeInBytes Property
Description Returns the size in bytes of the image DIB buffer (returned from the
GetImageDIB or GetImagePicture methods) from a snap. This is a
READ-ONLY property.
Type long
Syntax Visual Basic
Value = Object.ImageDIBBitsSizeInBytes
C++
long Value = Object.GetImageDIBBitsSizeInBytes( )
KeyFrameRate Property
Description Sets or returns the keyframe rate which is the rate at which frames
being streamed to AVI will be designated as keyframes; e.g, specifying
a value of 5 means that every fifth frame will be designated as a
keyframe. The default value is 1, which means that every frame is a
keyframe.
Type long
Syntax Visual Basic
Object.KeyFrameRate = Value
Value = Object.KeyFrameRate
LastError Property
Description Returns the error code from the last IDEA library call which returned a
non-zero error. May be passed to the GetErrorText method to obtain a
displayable message string.
Syntax Visual Basic
Value = Object.LastError
C++
short Value = Object.GetLastError()
MessageCaption Property
NthBoardDescription Property
Description Returns a formatted string containing the board type, serial number,
and user-defined board name (if there is one) suitable for display,
based on the zero-based board index.
C++
CString Value =
Object.GetNthGetBoardDescription(short Index)
NthUserDefinedBoardName Property
Description Sets or returns a string containing a name or description for the board,
defined by the user, based on the zero-based board index.
Syntax Visual Basic
Value = Object.NthUserDefinedBoardName(Index as
Integer)
C++
CString Value =
Object.GetNthGetUserDefinedBoardName(short Index)
PixelType Property
Description Sets the output pixel type. Valid values are given in the table below
and are defined in ideaocx.h and ideaocx.bas. Values starting with
“PT_MONO” are valid only for mono boards; values starting with
“PT_COLOR” are valid only for color boards.
Type long
Syntax Visual Basic
Object.PixelType = Value
Value = Object.PixelType
C++
Object.SetPixelType(long Value)
long Value = Object.GetPixelType( )
Pixel Type Values
Value Constant Description
0 PT_MONO_GRAY_8 8 Bit Grayscale
1 PT_MONO_GRAY_10 10 Bit Grayscale
2 PT_MONO_RGB3CH 24 Bit RGB (3 Channel)
3 PT_COLOR_YCBCR_YONLY 8 Bit Grayscale
RegistrySection Property
Description This property sets the name of an arbitrary section, or location, in the
registry, for the storage of information. The default section is
"Applications". Best results will likely be achieved by setting this
property before calling the "Open" method.
Type string
Syntax Visual Basic
Object.RegistrySection = Value
C++
Object.SetRegistrySection(LPCTSTR Value)
SaveToJpegQuality Property
Description Sets or returns the quality factor that will be used when saving a
snapped image to a JPEG file, using the SaveImageToFile method.
Type long
Syntax Visual Basic
Object.SaveToJpegQuality = Value
Value = Object.SaveToJpegQuality
C++
Object.SetSaveToJpegQuality(long Value)
long Value = Object.GetSaveToJpegQuality( )
Saturation Property
Description Changes or retrieves the saturation of the incoming image. The value
is in the range of 0 to 255. For AccuStream 50a, 75a, and 205a boards.
Type long
Syntax Visual Basic
Object.Saturation = Value
C++
Object.SetSaturation(long Value)
Value = Object.GetSaturation( )
SequenceCount Property
Description Tells the object how many frames to snap when performing a
SnapSequence operation.
Type long
Syntax Visual Basic
Object.SequenceCount = Value
C++
Object.SetSequenceCount(long Value)
Value = Object.GetSequenceCount( )
SequenceGrabDelay Property
SerialNumber Property
Description Shows the board serial number. This is passed as a string and is useful
for identification purposes only. This is a READ-ONLY property that is
filled in by the OCX when the board-handle is determined.
Type string
Syntax Visual Basic
Value = Object.SerialNumber
C++
CString Value = Object.GetSerialNumber( )
SnappedImageOrientation Property
SnapFieldMode Property
Description Determines the type of the snap whether it’s the even field, odd field
or both.
Type long
Syntax Visual Basic
Object.SnapFieldMode = Value
Value = Object.SnapFieldMode
C++
Object.SetSnapFieldMode (long Value)
long Value = Object.GetSnapFieldMode( )
Setting
NOTE: The only currently accepted value for this is 0 (zero), which indicates a full
frame of video is to be captured.
StreamingBuffers Property
Description Changes or retrieves the number of buffers to use for streaming. The
number of buffers to use should be enough to hold all streamed frames
that have not yet been written to disk, i.e., enough to cover the
maximum lag in frames between streaming and writing to disk. There
must be enough lockable memory available to allocate that many
buffers. If there are too many buffers, the allocation will fail. If there
are too few buffers, frames will be dropped. The default is 16 buffers.
Type long
Syntax Visual Basic
Object.StreamingBuffers = Value
C++
Object.SetStreamingBuffers(long Value)
long Value = Object.GetStreamingBuffers( )
StreamingLogFile Property
Description Sets or gets the pathname of the log file to use while recording
streaming video. This log file may be used by Technical Support to
diagnose problems that may occur during streaming. The default is an
empty string which means to not use logging.
Type string
Syntax Visual Basic
Object.StreamingLogFile = Value
Value = Object.StreamingLogFile
C++
Object.SetStreamingLogFile(LPCTSTR Value)
CString Value = Object.GetStreamingLogFile( )
SuspendMode Property
Description Sets or gets a value indicating whether the control is in suspend mode.
Setting this value = 1 will put the control into suspend mode, which is
equivalent to calling the Close method, except that the currently
selected board is still claimed. While in suspend mode, functions in
the IDEA Tools Library may be called using the board handle retrieved
from the BoardHandle property.
Setting this value = 0 will take the control out of suspend mode, which
is equivalent to calling the Open method, except that it is assumed
that the currently selected board is already claimed.
Type long
Syntax Visual Basic
Object.SuspendMode = Value
Value = Object.SuspendMode
C++
Object.SetSuspendMode(long Value)
long Value = Object.GetSuspendMode( )
SyncChannel Property
Description Changes the sync source. May cause the entire video parameter set to
be reinitialized. This is not applicable to I-Color, I-RGB or AccuStream
boards. This property is ignored if the UseSyncChannelFromCHP
property is non-zero.
Type long
Syntax Visual Basic
Object.SyncChannel = Value
C++
Object.SetSyncChannel(long Value)
Value = Object.GetSyncChannel( )
TriggerStartFrameDelay Property
Description Sets or returns the trigger delay value. This is the number of frames to
wait before initiating stream capture, after a trigger has been
encountered.
Type long
Syntax Visual Basic
Object.TriggerStartFrameDelay = Value
C++
TriggerStopFrameDelay Property
Description Sets or returns the trigger delay value. This is the number of frames to
wait before terminating stream capture, after a trigger has been
encountered.
Type long
Syntax Visual Basic
Object.TriggerStopFrameDelay = Value
C++
Object.SetTriggerStopFrameDelay(long Value)
long Value = Object.GetTriggerStopFrameDelay( )
TriggerFilterTime Property
Description Sets or returns the trigger filter time value for triggered streaming.
This feature should significantly reduce reliability problems often
encountered with mechanical trigger switches. The trigger filter time
is the amount of time (in microseconds) that a trigger pulse must be
held to be considered valid. A value of at least 25000 is
recommended. A value of 0 will disable this feature.
To set the trigger filter time from the Configuration Dialog screen,
bring up the Streaming Options tab and enter a value in the "Trigger
Filter Time" text box in the Triggering group box.
Type long
Syntax Visual Basic
Object.TriggerFilterTime = Value as long
Value = Object.TriggerFilterTime
TriggerMethod Property
Description Sets or returns the trigger method value for triggered snaps (0 =
trigger on falling edge, 1 = trigger on rising edge).
Type long
Syntax Visual Basic
Object.TriggerMethod = Value
C++
Object.SetTriggerMethod(long Value)
long Value = Object.GetTriggerMethod( )
TriggeredStreaming Property
Description Sets or returns the trigger value for triggered streaming. In the
configuration dialog, these five options are available as radio buttons
on the "Streaming Options" page.
The "start/stop" options make the trigger act like a "click" switch that
takes effect when the user presses and releases. The "run" options
make the trigger act like a "hold" switch that runs when the user
presses it and stops when the user releases it (or vice versa).
The "low/high" options allow control of the trigger polarity.
These options may be used in conjunction with the trigger input BNC
on the standard cables. For custom cabling, the trigger input must be
on pin 4, with a ground connection on any one of pins 8, 9, 11, 12, 20,
or 23.
Type long
Syntax Visual Basic
Object.TriggeredStreaming = Value
C++
Object.SetTriggeredStreaming(long Value)
long Value = Object.GetTriggeredStreaming( )
UseSyncChannelFromCHP Property
Description Tells the control whether to use the SyncChannel property or the sync
channel value in the CHP file. This flag should be set to 1 if using the
sync channel value in the CHP file or 0 if using the SyncChannel
property.
Type long
Syntax Visual Basic
Object.UseSyncChannelFromCHP = Value
C++
Object.SetUseSyncChannelFromCHP(long Value)
long Value = Object.GetUseSyncChannelFromCHP( )
UseTriggers Property
Description Changes or retrieves the triggering state. This flag should be set to 1 if
using triggering or 0 if not using triggering.
Type long
Syntax Visual Basic
Object.UseTriggers = Value
C++
Object.SetUseTriggers(long Value)
long Value = Object.GetUseTriggers( )
Verbosity Property
Description Changes or retrieves the message reporting state. Valid values for this
property are given in the table below and defined in ideaocx.h and
ideaocx.bas. This property affects displayed items only, not written
files such as log files.
Type long
Verbosity
Value Constant Description
0 VERBOSITY_SILENT Silent mode: show nothing
1 VERBOSITY_DIALOGS Show dialogs only, if asked
2 VERBOSITY_ERRORS Show dialogs and errors
3 VERBOSITY_WARNINGS Show dialogs, errors, warnings
4 VERBOSITY_INFO Show everything, including
diagnostic information
VesaChpPath Property
VideoChannel Property
Description Changes the video input channel. May cause the entire video
parameter set to be reinitialized.
Type long
Syntax Visual Basic
Object.VideoChannel = Value
C++
Object.SetVideoChannel(long Value)
Value = Object.GetVideoChannel( )
Methods
AbortTrigger Method
Description This function will abort a triggered grab if it is pending. This feature
may be useful if a hardware trigger mechanism is unavailable or not
working.
Return Value none
Syntax Visual Basic
Object.AbortTrigger( )
C++
Object.AbortTrigger( )
AboutBox Method
Close Method
Description Closes access to the board. All resources associated with the board are
released.
Return Value A boolean is returned. The value is TRUE if the board was previously
opened and no errors occurred while deallocating resources. It returns
FALSE if the board was not previously opened or some error occurred
while deallocating resources.
CodecAbout Method
Description Displays a dialog for viewing information about the currently selected
CODEC, if any, for streaming. The dialog is provided by the CODEC
itself, and may or may not exist. Use the CodecHasAbout method to
determine whether the CODEC has an about dialog.
Return Value None.
CodecChooseByFormat Method
Description Displays a dialog for viewing a list of the CODECs currently installed on
the system that will work for the currently selected Pixel Type. The
dialog also allows the user to choose one of those CODECs, and, if
chosen, stores its DLL name and FourCC code in the CodecDLL and
CodecFourCCType properties and automatically calls the CodecLoad
method for them. Returns TRUE if successful.
Return Value Boolean.
CodecChooseFromList Method
Description Displays a dialog for viewing a list of all CODECs currently installed on
the system. The dialog also allows the user to choose one of those
CODECs, and, if chosen, stores its DLL name and FourCC code in the
CodecDLL and CodecFourCCType properties and automatically calls
the CodecLoad method for them. Returns TRUE if successful.
Return Value Boolean.
CodecConfigure Method
Description Displays a dialog for setting and configuring the currently selected
CODEC, if any, for streaming. The dialog is provided by the CODEC
itself, and may or may not exist. Use the CodecHasConfigure method
to determine whether the CODEC has a configuration dialog.
Return Value None.
CodecHasAbout Method
Description Returns TRUE if the currently selected CODEC has an about dialog that
can be displayed using the CodecAbout method.
Return Value Boolean.
CodecHasConfigure Method
CodecLoad Method
Description Prepares the IdeaFG control for compressed streaming by loading the
specified Codec DLL and FourCC code. The current values can be
obtained from the CodecDLL and CodecFourCCType properties.
Parameters CodecDLL Specifies the path to the DLL containing a user-
defined CODEC for compressing streamed data. This
should be set to an empty string (default) if not using
a CODEC (if streaming uncompressed).
CodecFourCC Specifies the FourCC code used by the CODEC for
compressing streamed data. This should be set to the
result of a macro to create a FourCC code, e.g.,
MmioFOURCC(‘M’,’J’,’P’,’G’) for motion JPEG, or
MmioFOURCC(‘D’,’I’,’B’,’ ‘) for uncompressed.
Return Value A Boolean indicating whether or not the operation completed
successfully
Syntax Visual Basic
ForceTrigger Method
GetBlackLevel Method
GetBlackReference Method
GetBoardType Method
Description Returns the type of the currently selected board as a long integer.
Return Value long
Syntax Visual Basic
Value = Object.GetBoardType
C++
long Value = Object.GetBoardType( )
GetBoardTypeString Method
GetBuffer Method
Description This method is used to retrieve a buffer from the ring of buffers
created during StreamToMemory. The method returns a VARIANT
containing a SAFEARRAY of BYTEs containing the raw image data of
the specified frame.
Parameters MemoryHandle The handle to the memory buffers returned from a
particular call to the StreamToMemory method, or from the
StreamToDicom or StreamToAvi method with the 0x0040 flag turned
on.
FrameNumber The number of the frame to return from the
set of buffers.
GetCableTypeListIRGB Method
Description Returns the I-RGB cable type corresponding to the given index, as a
string. This method is useful for loading an edit box dialog or other list
with entries for selecting cable types.
Return Value string
Parameters Index A short integer from 0 to the maximum number of cable types
- 1. Use the GetNumberOfCableTypesIRGB method to get the
maximum number of cable types.
Syntax Visual Basic
Value = Object.GetCableTypeListIRGB(Index as Integer)
C++
CString Value = Object.GetCableTypeListIRGB(short Index)
GetErrorText Method
GetGain Method
GetHistogram Method
GetHorizontalPosition Method
GetHorzBackPorch Method
GetHorzBackSync Method
GetHorzFrequency Method
GetHorzStart Method
GetHorzSyncWidth Method
GetHorzTotal Method
GetImageDIB Method
GetImageHandle Method
GetImageHeight Method
Description Returns the height of the image in the video signal, in pixels. To get
the height of the image for the purpose of buffer allocation, display
window dimensions, etc., use the specific methods GetLiveHeight,
GetSnapHeight, or GetStreamHeight, as appropriate. Those methods
give the actual size after taking into account adjustments for vertical
decimation, AOI, etc.
Return Value long
GetImagePicture Method
GetImageSizeInBytes Method
Description Returns the number of bytes needed to hold the last image snapped at
the currently selected pixel format.
Return Value long
GetImageWidth Method
Description Returns the width of the image in the video signal, in pixels. To get
the width of the image for the purpose of buffer allocation, display
window dimensions, etc., use the specific methods GetLiveWidth,
GetSnapWidth, or GetStreamWidth, as appropriate. Those methods
give the actual size after taking into account adjustments for
horizontal decimation, AOI, etc.
Return Value long
GetIndex Method
Description Returns the index of the board with the given serial number.
Return Value long
GetInterlace Method
GetLiveAOI Method
GetLiveWidth methods to obtain the height and width of the image for
live display.
Return Value none
Parameters long *Left, long *Right, long *Top, long *Bottom
Left is the distance, in pixels of the AOI from the left side of the
image. Valid values are from 0 to the width of the original image.
Right is the distance, in pixels of the AOI from the right side of the
image. Valid values are from 0 to the width of the original image.
Top is the distance, in pixels of the AOI from the top of the image.
Valid values are from 0 to the height of the original image.
Bottom is the distance, in pixels of the AOI from the bottom of the
image. Valid values are from 0 to the height of the original image.
Syntax Visual Basic
Object.GetLiveAOI ByRef Left As Long, ByRef Right As
Long, ByRef Top As Long, ByRef Bottom As Long
C++
Object.GetLiveAOI(long *Left, long *Right, long *Top,
long *Bottom)
GetLiveHeight Method
Description Returns the height of the image for live display. This method takes
into account any differences from the original size of the image in the
source video signal, such as decimation, AOI, etc.
Return Value long
Syntax Visual Basic
Value = Object.GetLiveHeight
C++
long Value = Object.GetLiveHeight( )
GetLiveWidth Method
Description Returns the width of the image for live display. This method takes into
account any differences from the original size of the image in the
source video signal, such as decimation, AOI, etc.
Return Value long
Syntax Visual Basic
GetNthBoardType Method
Description Returns a board type based on the zero-based board index. This allows
the application to step through all of the boards in the system to find
a particular board.
Syntax Visual Basic
Value = Object.GetNthBoardType(Index as Integer)
C++
long Value = Object.GetNthBoardType(short Index)
GetNthBoardTypeString Method
Description Returns a string representing the board type based on the zero-based
board index.
Syntax Visual Basic
Value = Object.GetNthBoardTypeString(Index as Integer)
C++
CString Value = Object.GetNthBoardTypeString(short
Index)
GetNthSerialNumber Method
Description Returns a board’s serial number string based on the zero-based board
index. This allows the application to step through all of the boards in
the system to find a particular board.
Syntax Visual Basic
GetNumberOfCableTypesIRGB Method
Description Returns the maximum number of cable types. Usually this will be 3 for
VGA, BNC, DVI but it may be more.
Return Value long
Syntax Visual Basic
Value = Object.GetNumberOfCableTypesIRGB
C++
long Value = Object.GetNumberOfCableTypesIRGB( )
GetOutputFormat Method
GetPassMode Method
Description Returns the pass mode. This should always be single pass since no
currently supported Foresight boards implement dual-pass.
Return Value long
Syntax Visual Basic
Value = Object.GetPassMode
C++
long Value = Object.GetPassMode( )
GetPhaseDelay Method
GetPitch Method
GetPixelData Method
GetSerialNumber Method
Description Returns the serial number of the currently selected board as a string.
Return Value string
Syntax Visual Basic
Value = Object.GetSerialNumber
C++
CString Value = Object.GetSerialNumber( )
GetSnapAOI Method
GetSnapHeight Method
Description Returns the height of the image for snaps. This method takes into
account any differences from the original size of the image in the
source video signal, such as decimation, AOI, etc.
Return Value long
Syntax Visual Basic
Value = Object.GetSnapHeight
C++
long Value = Object.GetSnapHeight( )
GetSnapWidth Method
Description Returns the width of the image for snaps. This method takes into
account any differences from the original size of the image in the
source video signal, such as decimation, AOI, etc.
Return Value long
Syntax Visual Basic
GetStreamAOI Method
GetStreamHeight Method
Description Returns the height of the image for streaming. This method takes into
account any differences from the original size of the image in the
source video signal, such as decimation, AOI, etc.
Return Value long
Syntax Visual Basic
GetStreamWidth Method
Description Returns the width of the image for streaming. This method takes into
account any differences from the original size of the image in the
source video signal, such as decimation, AOI, etc.
Return Value long
Syntax Visual Basic
Value = Object.GetStreamWidth
C++
long Value = Object.GetStreamWidth( )
GetVertBackPorch Method
GetVertStart Method
GetVertSyncType Method
GetVertTotal Method
GetVideoFormat Method
GetWhiteReference Method
InitRgb3 Method
IsColorBoard Method
Description Returns a boolean value indicating whether the current board is color
or monochrome.
Return Value True if the current board is a color board. False if the current board is
a monochrome board (e.g., I-Series).
IsDigitalBoard Method
IsHighSpeedRGBBoard Method
IsMonoBoard Method
IsRGBBoard Method
IsStreamingBoard Method
Is64BitBoard
IsVideoDetected Method
IsYPbPrInput
LiveVideo Method
Description Starts/stops the display of live video in the IdeaDisplay window whose
handle was passed in a previous call to SetDisplayWindow. LiveVideo
will attempt to display using Direct Draw, but will use GDI (sequential
snaps) for display if Direct Draw fails. Performance may be
unacceptably slow when using GDI.
If Direct Draw live video is already started when this method is called
and the StartLive parameter is non-zero, this will be interpreted to
mean the caller wishes to update or repaint the display window.
Parameters StartLive 0 = stop live video, non-zero = start live video.
Return Value A Boolean indicating whether or not the method was successful.
Open Method
ReadConfigDword Method
ReadConfigGlobalDword Method
ReadConfigString Method
ReadConfigGlobalString Method
ReadConfiguration Method
Parameters none
Description This method retrieves all of the predefined properties listed below,
plus the audio properties listed above, from the registry. From the
user dialog(s) for getting and setting these properties call this method
when the user selects "Cancel" to reset the values from the registry.
ReleaseAllBuffers Method
Description This method is used to free the memory resources of all buffers
previously allocated from all calls to the StreamToMemory method,
and from all calls to the StreamToDicom and StreamToAvi methods
with the 0x0040 flag turned on.
Parameters none
ReleaseBuffers Method
ResetBoard Method
Description Performs a “hard reset” of the currently selected board. This method
may be used in the case where the board has gotten into an
unresponsive state that could only otherwise be corrected by
rebooting the system. This could occur, for example, if there has been
a problem with the video source or cable resulting in a lockup. The
ResetBoard method will reload the board’s firmware and reinitialize
the software.
Return Value none
Syntax Visual Basic
Object.ResetBoard
C++
Object.ResetBoard( )
ResetBoardFast Method
Description Performs a “soft reset” of the currently selected board. This method
may be used in the case where the board has gotten into an
unresponsive state that could only otherwise be corrected by
rebooting the system. This could occur, for example, if there has been
a problem with the video source or cable resulting in a lockup. This
method merely clears the FIFO of the PCI interface chip and does not
reload the board’s FPGA.
Return Value none
Syntax Visual Basic
SaveImageToFile Method
Description Save an image to a file. Formats that can be saved include Windows
Bitmaps (BMP) and JPEG. For JPEG, use the SaveToJpegQuality property
to adjust the quality vs. file size tradeoff, or ignore it and accept the
default value which is generally considered quite reasonable.
Call SaveImageToFile(HBITMAP hbm, LPCSTR FilePath, Long FileType)
Parameters hbm If hbm is zero, then the control uses the last image
snapped. If the file type is BMP, the image will be saved
according to the currently selected pixel type (except
10-bit will be converted to 8-bit, and YCbCr will be
converted to 24-bit RGB).
If hbm is non-zero, it is assumed to be a handle to a DIB,
as returned from a call to the GetImageDIB method. In
this case, it will not be able to save the image exactly
according to the chosen pixel type. Instead, the image
will always be saved as 24-bit RGB.
FilePath Pathname of the destination file.
FileType Indicates the type of file to save. If FileType is a ‘–1’,
then the file type is extracted from the extension of the
file name. Currently supported values are
IIF_IMAGE_FORMAT_BMP and IIF_IMAGE_FORMAT_JPEG.
Example Visual Basic
Object.SaveImageToFile frm.DisplayImage.Picture.Handle,
“MyPict.BMP”, -1
C++
Object.SaveImageToFile(Picture.Handle, “MyPict.BMP”, -
1);
SavePixelDataToFile Method
SaveVideoSettings Method
Description Saves the current RSET values to the specified CHP file.
Return Value A Boolean indicating whether or not the save operation completed
successfully
Syntax Visual Basic
Object.SaveVideoSettings(Path as String, Comments as
String)
C++
Object.SaveVideoSettings(LPCTSTR Path, LPCTSTR Comments)
SetBlackLevel Method
SetBlackReference Method
SetDisplayWindow Method
SetGain Method
SetHorizontalPosition Method
SetHorzBackPorch Method
SetHorzBackSync Method
SetHorzFrequency Method
SetHorzStart Method
SetHorzSyncWidth Method
SetHorzTotal Method
SetImageHeight Method
SetImageWidth Method
SetInterlace Method
SetLiveAOI Method
SetSnapAOI Method
SetStreamAOI Method
SetOutputFormat Method
SetPassMode Method
SetPhaseDelay Method
SetPitch Method
SetVertBackPorch Method
SetVertStart Method
SetVertSyncType Method
SetVertTotal Method
SetVideoFormat Method
SetWhiteReference Method
ShowAreaOfInterestDialog Method
Description Displays a dialog for selecting the area of interest (AOI) for live display
or streaming.
Use of the built-in dialogs instead of creating your own has the
advantages of reducing your implementation, maintenance and
support costs, keeping your application smaller, avoiding managing
your own registry settings if you need persistent data, and
automatically gaining access to new features as they are released
without additional work on your part.
Parameters long Flags
Return Value none
Syntax Visual Basic
ShowBoardSelectionDialog Method
Description Displays a dialog for selecting the board to use, if there are more than
one boards on the system.
Use of the built-in dialogs instead of creating your own has the
advantages of reducing your implementation, maintenance and
support costs, keeping your application smaller, avoiding managing
your own registry settings if you need persistent data, and
automatically gaining access to new features as they are released
without additional work on your part.
Parameters long Flags
Return Value none
Syntax Visual Basic
Object.ShowBoardSelectionDialog(Flags as Long)
C++
Object.ShowBoardSelectionDialog(long Flags)
Flags
Value Constant Description
0x0001 BOARD_SELECTION_ON Show dialog
0x0100 BOARD_SELECTION_NO_NAMES Don’t show user
defined board names.
ShowCompressionDialog Method
Description Displays a dialog for setting and configuring the compression method
for streaming.
Use of the built-in dialogs instead of creating your own has the
advantages of reducing your implementation, maintenance and
support costs, keeping your application smaller, avoiding managing
your own registry settings if you need persistent data, and
automatically gaining access to new features as they are released
without additional work on your part.
Parameters long Flags
Return Value none
Syntax Visual Basic
Object.ShowCompressionDialog(Flags as Long)
C++
Object.ShowCompressionDialog(long Flags)
Flags
Value Constant Description
0x0001 COMPRESS_OPTIONS_ON Show dialog
ShowConfigDialog Method
Description Displays a dialog for configuring IDEA board parameters and saving
those values in the registry.
Use of the built-in dialogs instead of creating your own has the
advantages of reducing your implementation, maintenance and
support costs, keeping your application smaller, avoiding managing
your own registry settings if you need persistent data, and
automatically gaining access to new features as they are released
without additional work on your part.
Parameters long Flags
Return Value none
Syntax Visual Basic
Object.ShowConfigDialog(Flags as Long)
C++
Object.ShowConfigDialog(long Flags)
Flags
Value Constant Description
0x0001 CONFIG_DIALOG_ON Show dialog
0x0002 CONFIG_DIALOG_WIZARD Display as wizard
0x0100 CONFIG_DIALOG_NO_LIVE Hide live options
0x0200 CONFIG_DIALOG_NO_SNAPS Hide snap options
ShowDicomDialog Method
ShowIRGBCableTypeDialog Method
ShowUserDefinedBoardNamesDialog Method
ShowVesaDetectDialog Method
ShowVideoAdjustments Method
Snap Method
Description Causes a single frame or field to be snapped into the frame grabber
memory. The type of snap depends on the property SnapFieldMode.
This method automatically retrieves the data from the frame grabber
on the completion of the snap and packages it in a DIB. The
application can retrieve the data by either calling the
GetImagePicture, GetImageDIB or the GetPixelData methods. If the
FireSnapEvent property is set to TRUE then this method fires the
event to notify the application that the snap has completed and the
data is available.
Return Value A Boolean indicating whether or not the snap operation completed
successfully.
SnapCancel Method
SnapInThread Method
SnapSequence Method
SnapSequenceCancel Method
SnapSequenceInThread Method
StreamToAVI Method
Description This method will capture an image stream and save it to the AVI file
specified in the AVIFile property.
For more information, see also the AVIFile, StreamingBuffers,
StreamingLogFile, TriggeredStreaming, and DecimateFrameRate
properties, the OnFrameReady, OnNotificationMessage, and
OnStreamingTermination events, and the CodecLoad method.
Parameters long FrameCount, long Flags, long StartEvent, long PauseEvent, long
CancelEvent, long *MemoryHandle
FrameCount is the number of frames to capture and store.
A frame count of -1 will cause the frame count to be ignored and
streaming to continue until the cancel event is received (an error will
occur if the frame count is -1 and no cancel event is specified). This is
useful if it is desired to terminate streaming on a cancel event or the
end of triggered capture, and not on a certain number of frames.
The Flags are as follows:
0x0001 Notify the application with an event when each frame is
captured. See the section describing the OnFrameReady Event.
0x0002 Notify the application when the last frame is captured. See
the section describing the OnStreamingTermination event.
0x0040 Do not delete memory buffers.
0x0100 Applies to triggered streaming only; has no effect if triggering
is not specified. Terminate streaming after capturing the first series of
frames, instead of resetting for the next trigger event. This flag is
StreamToMemory Method
Description This method will capture an image stream into a ring of memory
buffers.
For more information, see also the StreamingBuffers,
StreamingLogFile, TriggeredStreaming, and DecimateFrameRate
properties, the OnFrameReady, OnNotificationMessage, and
OnStreamingTermination events, and the CodecLoad method.
Parameters long FrameCount, long Flags, long StartEvent, long PauseEvent, long
CancelEvent, long *MemoryHandle
FrameCount is the number of frames to capture and store.
A frame count of -1 will cause the frame count to be ignored and
streaming to continue until the cancel event is received (an error will
occur if the frame count is -1 and no cancel event is specified). This is
useful if it is desired to terminate streaming on a cancel event or the
end of triggered capture, and not on a certain number of frames.
The Flags are as follows:
0x0001 Notify the application with an event when each frame is
captured. See the section describing the OnFrameReady Event.
0x0002 Notify the application when the last frame is captured. See
the section describing the OnStreamingTermination event.
WhiteBalance Method
WriteConfigDword Method
WriteConfigGlobalDword Method
WriteConfigString Method
WriteConfigGlobalString Method
WriteConfiguration Method
Parameters none
Description This method stores all of the predefined properties listed below, plus
the audio properties listed above, into the registry. From the user
dialog(s) for getting and setting these properties call this method
when the user selects "Apply" or "OK" to make the values permanent in
the registry.
Events
Events are the mechanism by which the control notifies an application that an
action has occurred. The IdeaFG control supports several notification events.
OnSnap Event
Description The control fires an OnSnap event on the completion of an image grab
during a Snap( ) method. This event will be fired if there has been a
previous call to the SetFireSnapEvent method with a parameter of
TRUE.
This is Event ID 2.
This event has one parameter as follows:
short Status: error return code or 0 for no error
It is up to the application to retrieve the image from the IdeaFG
control for example by a GetImageDIB, GetImagePicture or
GetPixelData method call.
OnFrameReady Event
Description This event gets fired when each frame is grabbed during a streaming
capture, if the proper NotifyFlag is set. Bit zero of the NotifyFlags
parameter for the StreamToAvi method will cause this event to be
fired.
This is event ID 5.
The event handler for this event will receive the following
parameters:
long FrameNumber: the number of the frame in this sequence.
OnStreamingTermination Event
Description This event will get fired at the completion of a streaming operation if
the NotifyFlags parameter passed to the streaming method has bit 1
set. This will be fired either after the last frame has been captured, or
it may be fired early if an error has occurred.
This is event ID 3.
This event has two parameters as follows:
short Status: error return code or 0 for no error
long NumberFrames: the number of frames captured
OnSequenceTermination Event
Description This event will get fired at the completion of a snap sequence
operation. This will be fired either after the last frame has been
captured, or it may be fired early if an error has occurred.
This is event ID 4.
This event has two parameters as follows:
short Status: error return code or 0 for no error
long NumberFrames: the number of frames captured
OnNotificationMessage Event
Description This event is fired to provide the calling application with information
at the time the information becomes available. This generic event
allows the application to receive numerous kinds of information with a
single event handler; and new kinds may be added without changing
the interface to the ActiveX control.
This is event ID 1.
This event has two parameters as follows:
short MessageCode: A 16-bit code identifying the message.
The values for MessageCode are defined in hdp_lib.h and hdp_lib.bas
as follows:
Message Codes
Val Constant Description
0 IDEA_INFO_NONE No information
1 IDEA_INFO_ERROR Error message
2 IDEA_INFO_WARNING Warning message
3 IDEA_INFO_CONNECTION Not used
4 IDEA_INFO_SYNC Sync detection
5 IDEA_INFO_LOCK Not used
6 IDEA_INFO_DROPPED_FRAMES Frame(s) dropped
7 IDEA_INFO_TRIGGER_START Trigger start
Properties
BoardCount Property
C++
long Value = Object.GetBoardCount( )
Methods
AboutBox Method
GetNthBoardType Method
Description Returns a board type based on the zero-based board index. This allows
the application to step through all of the boards in the system to find
a particular board.
Syntax Visual Basic
Value = Object.GetNthBoardType(Index as Integer)
C++
long Value = Object.GetNthGetBoardType(short Index)
GetNthSerialNumber Method
Description Returns a board’s serial number string based on the zero-based board
index. This allows the application to step through all of the boards in
the system to find a particular board.
Syntax Visual Basic
Value = Object.GetNthSerialNumber(Index as Integer)
C++
BSTR Value = Object. GetNthSerialNumber(short Index)
from the frame grabber into a DirectDraw overlay surface where it is displayed.
There are two basic modes in which the CIdeaDisplay operates: GDI or
DirectDraw. In GDI mode, the display window receives the image from the
frame grabber control, performs any application defined graphical operations
on the image and then displays the image using normal Win32 GDI commands.
This method results in a pseudo live display.
In DirectDraw mode, an overlay surface is created. If capable, the frame
grabber DMA’s the image data directly into the overlay buffer on the video
card. Graphical mixing and color keying depend on the capabilities and the
video drivers for the display card. This results in true live video display.
The following are behavioral characteristics of this control:
• Visible at runtime.
• Able to display an About box listing copyright and version information.
• Has a property pages dialog.
• Has properties that can be set at design or runtime.
• Subclasses.
Properties
BackColor Property
Description Determines the default background color of the display window when
no image data is being displayed. The value is an RGB value as defined
in the WIN32 SDK.
Syntax Visual Basic
Object.BackColor = Value
C++
Object.BackColor(long Value)
BorderStyle Property
ColorKey Property
Description Sets the value of the color key when the display mode is using a
DirectDraw overlay surface.
Syntax Visual Basic
Object.ColorKey = Value
C++
Object.SetColorKey(long Value)
Value = Object.GetColorKey( )
DisplayMode Property
HWnd Property
Description Read-only property to retrieve the Windows style window handle for
the display window.
Syntax Visual Basic
hWnd = Object.HWnd
C++
long hWnd = Object.GetHWnd( )
FitToSize Property
Description Determines if the video in the window is scaled to the size of the
window or only displays the portion of the video that fits in the
window. If the video is not scaled and the window is smaller than the
video size, scroll bars are displayed in either the X or the Y-direction
to allow the application to pan and scroll through the active video.
Syntax Visual Basic
Object.FitToSize(Value as Boolean)
Object.FitToSize = Value
C++
bool Value = Object.GetFitToSize( )
Object.SetFitToSize(bool Value)
MessageCaption Property
Verbosity Property
Description Changes or retrieves the message reporting state. Valid values for this
property are given in the table below and defined in ideaocx.h and
ideaocx.bas. This property affects displayed items only, not written
files such as log files.
Type long
Syntax Visual Basic
Object.Verbosity = Value
C++
Object.SetVerbosity(long Value)
long Value = Object.GetVerbosity( )
Verbosity
Methods
AboutBox Method
SetImageHandle Method
Description Takes the image handle from the frame grabber object and uses it to
retrieve the image for display.
aximp ideactls.ocx
3. Enter:
regtlib ideactls.ocx
Persistence of Data
Applications may now use the IdeaFG control to store and retrieve user data in
the registry instead of managing it themselves. The ReadConfiguration and
WriteConfiguration methods may be used to read and write most parameters
used by the IdeaFG control to and from the registry. Also, user-defined
parameters may be read and written as well, on a global or board-specific
basis. See the ReadConfig… and WriteConfig… methods defined and described
in this manual.
current board, or change the default board, at any time. The first, best
opportunity to change the current board is after the IdeaFG control is loaded
but before the call to the Open() method.
Additional methods are also available in the IdeaFG control to gain information
about the boards present on the system. This includes all of the methods that
were formerly only available in the IdeaBoardInfo control. Any application that
was using both the controls should remove the IdeaBoardInfo control and the
only use the IdeaFG control.
The IdeaBoardInfo control no longer claims the boards; and therefore the
GetBoardHandle() method has been removed.
CHAPTER 6:
IDEA Tools API Introduction
The Foresight Imaging IDEA Tools Library is an extension to the Foresight
Imaging IDEA SDK that allows application programmers to incorporate IDEA
Auto-SYNC™ functionality into their Windows programs for Foresight frame
grabber boards. The AccuStream boards consist of two video sections, an
analog section (some also have a DVI section) and a standard definition
television (SDTV) section. The IDEA Tools API does not support the SDTV video
section of AccuStream 50a, 75a, 205a boards.
The IDEA Tools API provides the applications programmer with routines for:
Performing internal board checks to verify that the system is properly
accessing each known Foresight Imaging board and that the frame grabber
memory and the bulk of the digital circuitry is working properly.
nHD_Report( ) provides this service.
Automatically analyzing and recording (Auto-SYNC'ing) the video signals
being provided to a Foresight Imaging board. This service is available
through a sequence of operations including calls to all four of the Tools API
routines.
To support the Foresight Imaging boards, Foresight Imaging provides
HD_AUTO.EXE, a windows application, to verify board setup, automatically
analyze video signals and tune video settings.
All the other essential components become apparent when the AS_RGB
demonstration application is examined. These are:
Include files: IDEATOOLS.H, HDP_LIB.H and GEN_DEF.H.
Library files: HDPW32.DLL and IDEATOOLS.DLL.
Guideline 1
Provide an interactive interface for checking and correcting Auto-SYNC
results.
Guideline 2
Make “verbose” log reports routinely available to your field support.
Guideline 3
Make ASB files available to Foresight Imaging customer support.
Guideline 4
Make CHP files routinely available to your field support.
Guideline 5
Allow Auto-SYNC to perform a thorough survey.
Overview: Do not disable any channels before the Sync Survey portion of
the IDEA Auto-SYNC process. By performing a complete survey
of all eight channels, you produce log information that
describes everything that is connected to the board. This
report ends any confusion about what each channel has.
Background: From experience, certain information reported from troubled
installation sites is not reliable. Specifically, cabling, signal
configuration and video formatting information can be wrong
even when taken directly from authoritative sources. In all
cases, the IDEA Auto-SYNC process can provide the most
reliable formatting information. It measures what is there.
Guideline 6
Document the IDEA Auto-SYNC image content requirements.
CHAPTER 7:
Structures in IDEATOOLS.H
This chapter discusses the more important structures found in the IDEA Tools
API include file called IDEATOOLS.H.
AS_RUNSTATE Structure
Include file, IDEATOOLS.H, declares type AS_RUNSTATE as follows:
typedef struct {
// These first five elements should not be modified by the application
code.
short nThisSize; // Number of bytes in this structure.
DWORD dwID; // Runtime AS_RUNSTATE structure ID ("ARun").
BoardHandle bh; // Board handle for board to Auto-SYNC.
void *pResv; // Reserved for exclusive use of Auto-SYNC.
ASTAGE astage; // How much Auto-SYNC processing is done.
// eHD_ASInitiate( ) sets up defaults for these next elements that can
be changed by your
// application code.
ASLV aslv; // Level of detail to include in Log messages.
long lUser; // Long variable for any application use.
HCB_BUSY *Spinning; // Auto-SYNC progress reporting (% done).
void *pObjSpin; // Object (or data) pointer for Spinning( ).
HCB_LOG *LogReport; // Called with text data for log reporting.
void *pObjLogR; // Object (or data) pointer for LogReport( ).
HCB_ASB *bRawSync; // *.ASB diagnostic data pipe.
void *pObjRawS; // Object (or data) pointer for RawSync( ).
// eHD_ASInitiate( ) allocates these nine structures (per the ASCMASK
argument) and
// eHD_ASTerminate( ) frees them. Treat these pointers as read-only.
AS_CHANNEL *pasc[ASCH_N]; // Array of pointers to channel states.
HDRF wCtrlFlags; // Control flags for the operation
Structure Elements
Each of the elements of this structure is described in detail below:
pasr->nThisSize
Size of the AS_RUNSTATE structure. It is used by the Tools library to verify that
the structure is intact. Do not modify this value.
pasr->dwID
Contains the character string “ARun”. It is used by the Tools library to verify
that this AS_RUNSTATE structure is intact. Do not modify this value.
pasr->bh
Board handle that you specified in eHD_ASInitiate( ). It specifies the I-Series/
HI*DEF board that the IDEA Auto-SYNC process is using. It is unlikely that you
would ever want to change this value. Changing this value from one type of
Foresight board to another causes IDEA Auto-SYNC to fail.
pasr->pResv
Reserved value. The Auto-SYNC process uses this. Changing it causes the Auto-
SYNC process to fail. Do not modify this value.
pasr->aStage
Indicates how much progress has been made in the IDEA Auto-SYNC processing.
The possible values are:
ASTAGE_INIT: Only eHD_ASInitiate( ) has been called.
ASTAGE_SURVEY: eHD_SyncSurvey( ) has been called.
ASTAGE_MEASURE: HD_VideoMeasure( ) has been called.
ASTAGE_ALIGN: Processing is complete except for eHD_ASTerminate( ).
You can use this value to control user interface options. Do not modify this
value.
pasr->aslv
Set this value to indicate which log message reports are of interest to your
application. The default value is ASLV_NORMAL. The possible values are:
ASLV_TERSE: Sends only critical or summary messages.
ASLV_NORMAL: Maintains extensive progress reporting.
ASLV_VERBOSE: Maintains detailed progress reporting.
ASLV_ASB: Same as ASLV_VERBOSE but with *.ASB file data.
pasr->lUser
Pass this value to the callback routines for the logging messages and the *.ASB
file information. Set it to any value that is useful to your application. The
default value is zero.
pasr->Spinning
Since the IDEA Auto-SYNC process can take a minute or two, you may want to
provide some signal to the operator that all is still going well. The default
value is NULL which results in no callback.
In IDEA Auto-SYNC, progress is shown with a bar that slowly advances towards
an indication of 100% completion. To provide this type of reporting to your UI,
write a callback procedure that takes two arguments and set this value
(Spinning) to point to it. This routine is called frequently during Auto-SYNC
processing. The first argument to your routine is the value you specify in pasr-
>pObjSpin (see next item) and the second argument is a value from 0 to 100
indicating the approximate percentage of Auto-SYNC completion.
pasr->pObjSpin
This is the first argument to the pasr->Spinning callback routine. The default
value is zero.
If you are coding in C++, you may want to put your “this” pointer here so you
can restore context in your callback.
pasr->LogReport
Based on the setting of pasr->aslv, the IDEA Auto-SYNC process prepares
narrative reports indicating what it has found and what it is doing. These
reports are often critical for offsite support during system installation and
upgrades. You should code a callback routine to save these reports to a file
that can be printed and faxed or otherwise transmitted to a support center.
HCB_LOG
The prototype for this callback function is based on type HCB_LOG:
typedef void HCB_LOG (void *pThis, long lUser, ASLV aslv, char *pszMsg);
pThis: Value you specify in pasr->pObjLogR (see next item).
lUser: Value you specify in pasr->lUser (see above).
aslv: Indicates the attention level of the message (ASLV_TERSE,
etc).
pszMsg: Pointer to the null-terminated log message.
pasr->pObjLogR
This is the first argument to the pasr->LogReport callback routine. If you are
coding in C++, you may want to put your “this” pointer here so that you can
restore context in your callback.
The default value is zero.
pasr->RawSync
During eHD_SyncSurvey( ), the IDEA Auto-SYNC process prepares binary
diagnostic reports indicating what is processed on each of the eight channels.
These reports are occasionally critical for offsite support during system
installation and upgrades. You should code a callback routine to permit these
reports to be saved to a file that can be transmitted to a support center.
The default value is NULL which results in no callback.
HCB_ASB
The prototype for this callback function is based on type HCB_ASB:
typedef BOOL HCB_ASB (void *pThis, long lUser, ASCH chan, long lNBytes,
BYTE *pbyData);
pthis: Value you specify in pasr->pObjRawS (see next item).
lUser: Value you specify in pasr->lUser (see above).
chan: Specifies which channel (ASCH_CA1, etc) is being reported.
INBytes and pbyData: These change purpose as data from each channel
is transmitted in consecutive calls to your callback routine. The
sequence for each channel is:
pasr->pObjRawS
This is the first argument to the pasr->RawSync callback routine. If you are
coding in C++, you may want to put your “this” pointer here so that you can
restore context in your callback.
The default value is zero.
pasr->pasc[ASCH_N]
Array of AS_CHANNEL pointers, one for each channel selected from processing
in the call to eHD_ASInitiate( ). Pointers for unselected channels are NULL. All
control and monitoring for each channel is controlled by its AS_CHANNEL
structure as described in the next section. Do not modify these values.
When VESA mode scanning is used, the array contains RSETs that were
generated from the VESA CHP template files. All of the VESA RSETs will have
the same video channel setting so there will no longer be a correspondence
between the index into the pasc[] array and the video channel number. In this
case, the index is simply between 0 and (pasr->nVESAStatus-1).
pasr->wCtrlFlags
This sets some control parameters for the Auto-SYNC process; these parameters
are global and not channel-specific. A symbol has been defined for each of the
flags as follows:
Symbol Description
HDRF_DIGITAL The Tools Library sets this flag to indicate that
digital video input has been detected during a sync
survey. When this flag is set, the call to
HD_VideoMeasure() will attempt to match the video
with the VESA standard formats. This flag is
provided for informational purposes and programs
should not set this flag.
HDRF_KEEPFINEPHASE Don't reset the fine phase adjustment value for
AccuStream boards when performing the Sync
Survey. This value is otherwise reset to its default
prior to a Sync Survey operation.
HDRF_NOSTRAYSYNC Don’t allow stray sync pulses when testing for
horizontal sync on a video channel.
HDRF_STOP Set this flag to signal an Auto-SYNC session to stop.
Depending on the operation in progress, it may take
several seconds for processing to stop.
HDRF_STOPPED This flag value is set by the library in response to
detecting the HDRF_STOP flag value. If
HDRF_STOPPED is set, the library has stopped
processing and it is safe to call eHD_ASTerminate().
HDRF_MONO This flag is set to indicate that the AccuStream is
capturing a monochrome signal on one of its red,
green or blue input channels.
For ready testing of these values, two macros have been created:
#define HDRF_ON(v,f) ( (v##wCtrlFlags & HDRF_##f) == HDRF_##f) // Tests for
the flag
present.
#define HDRF_OFF(v,f) ( (v##wCtrlFlags & HDRF_##f) != HDRF_##f) // Tests for
the flag NOT
present.
Both of the above macros return a Boolean value. Each takes two arguments,
the AS_RUNSTATE pointer with a trailing "." or "->" and the HDRF symbol name
without the "HDRF_". For example, to specify that stray syncs are allowed, use
the code HDRF_ON(pasr->,NOSTRAYSYNC).
The flags may be used throughout the Auto-SYNC process.
pasr->lVESAHTolerance
Sets the percentage (measured in 0.1%) that the video signal's horizontal
frequency must match the horizontal frequency in the VESA CHP template file
in order for the signals to be considered a match. A usable default is set by
eHD_ASInitiate() and should not be changed lightly.
pasr->lVESAVTolerance
Sets the percentage (measured in 0.1%) that the video signal's vertical
frequency must match the vertical frequency in the VESA CHP template file in
order for the signals to be considered a match. A usable default is set by
eHD_ASInitiate() and should not be changed lightly.
pasr->szVESADir
The fully qualified pathname to the VESA CHP template directory. IDEA
normally installs this directory below the CHP directory and stores the path the
CHP directory in the Windows Registry in the key
"HKEY_LOCAL_MACHINE\Software\Foresight\Idea\Common\CHP_DIR". Append
"\\VESACHP" and you will usually have the right directory.
VESA mode scanning does not function if this directory is set incorrectly.
pasr->nVESAStatus
The return value from HD_VideoMeasure() when VESA mode scanning is
enabled. If the value is 0 or less, the VESA scan failed. Otherwise, the VESA
scan has created RSETs corresponding to one or more VESA CHP template files.
The RSETs are stored in pasc[n]->prset, where n = 0..(pasr->nVESAStatus - 1).
Other values in the pasc[] AS_CHANNEL structures (such as error status) should
be ignored when using VESA mode scanning.
pasr->ffinfo
This structure is passed into HD_VideoMeasure to provide hints as to the
preferred aspect ratio of the image.
AS_CHANNEL Structure
AS_CHANNEL is a structure for control and survey of an analog channel. There
is one of these structures for each channel. Include file, IDEATOOLS.H, declares
type AS_CHANNEL as follows:
Structure Element Data Code
typedef struct {
short nThisSize; 1
ASCMD ascmd; 1 2 3 M S V
ASPHASEL asph; 3 A
ASMODES mVideo; 1 2 M S
ASMODES mode[MODES_HIDEF_N]; 1 2 M V
DWORD dwHorFreq; S
short nHL_Field; S
short nMaxLines; S
DWORD dwHPulse_nsec; S
DWORD dwVPeriod; S
HDVF wVideoFlags; S
ASCMASK ascmBestCS; 1 S
ASCMASK ascmHDP_CS; S
ASCMASK ascmHD4_CS; S
ASCH aschCS; 2 A M S
TOTWID twMin; 2 3 A M
TOTWID twMax; 2 3 A M
TOTWID tw; 2 3 A M
WORD wHeight; A M
PIXELD PD; 2 A M
RSET *prset; 1 A V
WORD wCtrlFlags; 2 M
short nRGBCableType 1
char szComment[255]; 1
WORD wBlankFilter;
2 M
} AS_CHANNEL;
The following are descriptions of the data codes listed above:
Each element of this structure is described in detail below. Keep in mind that
“pasc” is a pointer to the AS_CHANNEL structure that occurs for each channel.
It is set from an array of these pointers in structure *pasr.
pasc->nThisSize
Size of the AS_CHANNEL structure (number of bytes). The Tools library uses this
to verify that the structure is intact. Do not modify this value.
pasc->ascmd
Control specifications. The default value is ASCMD_ENABLE.
This parameter is reserved for Auto-SYNC control flags for the channel.
Currently only ASCMD_ENABLE is used with this variable. Setting this flag to
zero can terminate processing of a channel.
pasc->asph
Phase delay determination method.
pasc->mVideo
Deals with the availability of analog video image data signal on this channel
and is used only with the analog channels (CA1 to CA4). The mVideo values for
the “CT” channels should be left at their default values.
This is the first ASMODES structure. ASMODES structures deal with a particular
use of a video signal and are described in a separate section later.
These values are only used during the early phases of Auto-SYNC processing
while image and sync video data is processed separately. Once the video and
sync data has been merged, only the pasc->mode value is used.
Auto-SYNC Description
Processing Phase mVideo (Analog only) mode[ ]
Initialization All CAn set to Mode for the board in use is
“interest”. required. Others are set to
interest.
Application (1) Set.
Sync Survey Affects reporting.
Application (2) Match and/or drop Video & C-Sync sources.
Auto-SYNC Description
Processing Phase mVideo (Analog only) mode[ ]
Video Measure Copy mode[ ] from C-Sync to video
channels. Affects reports.
Application (3) Check, drop, and adjust.
Video Alignment Affects reporting.
Application (4) Check final results.
Termination
pasc->mode[MODES_HIDEF_N]
Target board mode states.
This is an array of ASMODES structures. ASMODES structures deal with a
particular use of the video signal on this channel. One of them, mVideo is
described above. The structures are described in general terms in a section of
their own later in this document.
Each element of this array describes a particular board-type/pass-mode
combination. Symbols have been defined for use as indexes to this array, one
for each of the six IDEA modes. Those six symbols and the IDEA modes are:
1. MODE_HDP_1PASS: Single pass operation of the HI*DEF Plus.
2. MODE_HDP_2PASS: Dual pass operation of the HI*DEF Plus.
3. MODE_HD4_1PASS: Single pass operation of the I-Series/HI*DEF Accura.
4. MODE_HD4_2PASS: Dual pass operation of the I-Series/HI*DEF Accura.
5. MODES_HDP: Any HI*DEF Plus operation (dual or single pass).
6. MODES_HD4: Any I-Series/HI*DEF Accura operation (dual or single
pass).
As an example, the ASMODES structure for dual pass mode on HI*DEF Plus for
channel CT3 could be accessed starting with a pointer to the AS_RUNSTATE
structure 'pasr' with the following code:
{
AS_RUNSTATE *pasr;
ASMODES *pmode;
...
pmode=pasr->pasc[ASCH_CT3]->mode+MODE_HDP_2PASS;
...
}
The last two of the six symbols (MODES_HDP and MODES_HD4) specify mode
combinations rather than individual modes. Use them to specify that the final
RSET must be usable (degree of interest is "required") with a particular
I-Series/HI*DEF board type even though neither of the pass modes is
specifically required (degree of interest being "unnecessary" or "interesting").
If you have not already read the description for pasc->mVideo, review it now. It
includes a description and a chart showing the period of Auto-SYNC processing
where mVideo is used. But there is one more wrinkle to that description which
affects the use of pasc->mode.
At the beginning of the Auto-SYNC process, Auto-SYNC is working with eight
real channels (CA1-4, CT1-4) and one virtual channel (separated sync S S). If a
channel is not compatible with a mode, it is one of these nine channels that
are dropped. By the end of the Auto-SYNC process, Auto-SYNC is working with
at most four channels (CA1-4). The transition occurs when matches are made
between video sources and composite sync sources. When that happens, it is
the ASMODES information from the C-Sync channel, not the video channel that
is retained. This occurs at the very start of the Video Measurement phase. For
consistency, the other ASMODES structure (pmode->mVideo) is set up for each
of the analog channels to control reporting of pre-sync video detection. That
structure is set up during initialization and used in the Sync Survey phase. The
copying of the mode[ ] data from the sync source to the analog video channel
marks the end of mVideo's usefulness. Use of these ASMODES structures as
Auto-SYNC transitions from phase to phase is shown in the diagram at the end
of subsection pasc->mVideo.
pasc->dwHorFreq
Reports the measured horizontal frequency of a channel with C-Sync or H-Sync
information.
This is reported at the end of the eHD_SyncSurvey( ). The units are Hertz.
pasc->nHL_Field
Reports the number of half lines in a vertical field.
A progressive (non-interlaced) video signal is twice the number of line periods
in a frame period. An interlaced video signal is the number of line periods in a
frame period. The phrase “line periods in a frame period” is used because
these line counts include V-Sync lines even when block sync is used.
This is reported at the end of eHD_SyncSurvey( ) for channels with Composite
Sync information.
pasc->nMaxLines
Reports the number of lines in a frame of video excluding blanking. Only lines
which could (but may or may not) include video are counted. Specifically, lines
with serration or equalization pulses are excluded.
This is reported at the end of eHD_SyncSurvey( ) for channels with Composite
Sync information.
pasc->dwHPulse_nsec
Reports the width of a normal horizontal sync pulse, in nanoseconds, for this
video signal.
This is reported at the end of the eHD_SyncSurvey( ) for channels with
Composite or Horizontal Sync information.
pasc->dwVPeriod
Reports the precise duration of a video field expressed in tenths of
microseconds (10-7 seconds).
This is reported at the end of the eHD_SyncSurvey( ) for channels with
Composite or Vertical Sync information.
pasc->wVideoFlags
This reports some of the characteristics of the video signal discovered on this
channel. A symbol has been defined for each of these characteristics as
follows:
Symbol Description
HDVF_INTERLACE Signal is interlaced.
HDVF_POS_HS H-Sync polarity is reversed (pos.).
HDVF_POS_VS V-Sync polarity is reversed (pos.).
HDVF_POS Reverse both H-Sync and V-Sync polarity.
HDVF_VIDEO Video or sync detected.
HDVF_HSYSC Horizontal sync pulses detected.
HDVF_VSYNC Vertical sync pulses detected.
HDVF_CSYNC Composite sync pulses detected.
HDVF_BLOCKSYNC Block sync used.
For ready testing of these values, two macros have been created:
#define HDVF_ON(v,f) ( (v##wVideoFlags & HDVF_##f) == HDVF_##f) // Tests for
the condition
present.
#define HDVF_OFF(v,f) ( (v##wVideoFlags & HDVF_##f) != HDVF_##f) // Tests for
the condition
NOT present.
Both of the above macros return a Boolean value. Each takes two arguments,
the AS_CHANNEL name with a trailing “.” or “->” and HDFV symbol name
without the “HDFV_”. For example, to check this channel for non-interlaced,
use the code HDVF_OFF(pasc->,INTERLACE).
This is reported at the end of the eHD_SyncSurvey( ) for all channels.
pasc->ascmBestCS
Reports which of the nine possible composite sync sources would most likely be
correct for this channel. Symbols have been declared for these bit values in
this “mask”. When the bit is set, the corresponding channel is a likely
composite sync source for this channel. Those symbols are:
ASCMASK_CA1 to ASCMASK_CA4
ASCMASK_CT1 to ASCMASK_CT4
ASCMASK_SS (separated sync)
These values are set only for the four analog channels and only for analog
channels where a video signal has been detected. They are reported at the end
of eHD_SyncSurvey( ).
pasc->ascmHDP_CS
Reports which of the nine possible composite sync sources can be used with a
HI*DEF Plus board.
On the HI*DEF Plus board, a composite sync source on channels CT1 to CT4 can
only be used for the correspondingly numbered analog channel. So for example,
if C-Sync is found on CT3, it can only be matched with CA3.
Symbols have been declared for these bit values in this “mask”. When the bit is
set, the corresponding channel is a likely composite sync source for this
channel. Those symbols are:
ASCMASK_CA1 to ASCMASK_CA4
ASCMASK_CT1 to ASCMASK_CT4
ASCMASK_SS (separated sync)
These values are set only for the four analog channels and only for analog
channels where a video signal has been detected. They are reported at the end
of eHD_SyncSurvey( ).
pasc->ascmHD4_CS
This reports which of the nine possible composite sync sources could be used
with an I-Series/HI*DEF Accura board.
Symbols have been declared for these bit values in this “mask”. When the bit is
set, the corresponding channel is a likely composite sync source for this
channel. Those symbols are:
ASCMASK_CA1 to ASCMASK_CA4
ASCMASK_CT1 to ASCMASK_CT4
ASCMASK_SS (separated sync)
These values are set only for the four analog channels and only for analog
channels where a video signal has been detected. They are reported at the end
of eHD_SyncSurvey( ).
pasc->aschCS
Sets the C-Sync source (channel number) for the video on this channel.
This must be set (or left defaulted) between the calls to eHD_SyncSurvey( ) and
HD_VideoMeasure( ). If a valid default is available, it is selected from
pasc->ascmBestCS.
NOTE: This one of the more important values for your application to check and
perhaps correct. There can be many situations where the default can be
wrong and unusable. If left to an unusable default, Auto-SYNC processing
continues without detecting the error and ultimately generates a RSET file
that produces useless images.
pasc->twMin
Sets the minimum permitted HTOTAL and image width.
Function eHD_ASInitiate( ) sets both of these values to zero indicating that
there is no minimum width or HTOTAL for this channel.
Your application can change these defaults before calling HD_VideoMeasure( )
to prevent the Auto-SYNC process (and more specifically, the pixel detection
process) from considering HTOTAL or width values that you know to be too
small. If the Auto-SYNC process discovers that the values you provided
eliminate any possibility of capturing an image, it overrides them.
If you leave either the HTOTAL or width value zero, the Auto-SYNC process sets
it during HD_VideoMeasure( ) to reflect IDEA limitations for the video signal on
this channel.
pasc->twMax
Sets the maximum permitted HTOTAL and image width.
Function eHD_ASInitiate( ) sets both of these values to zero indicating that
there is no maximum width or HTOTAL for this channel.
Your application can change these defaults before calling HD_VideoMeasure( )
to prevent the Auto-SYNC process (and more specifically, the pixel detection
process) from considering HTOTAL or width values that you know to be too
large. If the Auto-SYNC process discovers that the values you provided
eliminate any possibility of capturing an image, it will override them.
If you leave either the HTOTAL or width value zero, the Auto-SYNC process sets
it during HD_VideoMeasure( ) to reflect IDEA limitations for the video signal on
this channel.
pasc->tw
Sets the preferred HTOTAL and image width.
Default values are computed for at least one of these during HD_VideoMeasure( ).
The primary chore of your application, between the HD_VideoMeasure( ) and
HD_VideoAlign( ) calls, is to finalize these values. If you fail to correct these at
that time, the RSET will have to be corrected after Auto-SYNC processing is
complete.
To assist your application in determining a correct result, HD_VideoMeasure( )
leaves pasc->twMin and pasc->twMax with the most pasc->tw limit data.
Also, if pixel detection is used and successful, pasc->PD.peaks[…].tw contains
candidate pasc->tw values. In fact, the default value has to be selected from
among those candidate values.
If you specify or default a non-zero HTOTAL (pasc->tw.wHTOTAL), it is used. If
you specify or default a non-zero width (pasc->tw.wWidth), it is used only if
wHTOTAL is zero.
pasc->wHeight
Reports the measured height (in lines) of the image during HD_VideoMeasure( ).
It is not available before this time. This value can be useful in choosing correct
pasc->tw values when an approximate image width-to-height is known.
pasc->PD
Used before HD_VideoMeasure( ), selects and controls pixel detection. Used
after HD_VideoMeasure( ), chooses an HTOTAL and/or width value. See PIXELD
Structure later in this chapter for more details.
pasc->prset
This is a pointer to a structure of type RSET. That structure is documented in
the SDK section of this manual. This is the final output of the Auto-SYNC
process.
In VESA scanning mode, the data in *prset may be a valid RSET that represents
a match against a VESA CHP template file upon completion of the
HD_VideoMeasure() call. The validity of the RSET is determined by the value of
the nVESAStatus element of the AS_RUNSTATE structure.
In normal scan mode, the data in *prset is valid only after HD_VideoAlign() and
before eHD_ASTerminate(). Therefore, save this RSET data before calling
eHD_Terminate().
pasc->wCtrlFlags
This sets some control parameters for the Auto-SYNC process. The flags may
also be used to return values from the functions. A symbol has been defined for
each of the flags as follows:
Symbol Description
HDCF_FRODD Force the generated RSET to use ODDUP field ordering.
HDCF_FREVENODD Force the generated RSET to use ON_EVENODD field
ordering.
HDCF_FRODDEVENODD Force the generated RSET to use ODDUP_EVENODD field
ordering.
HDCF_VESAMODE Force the Auto-SYNC process to use VESA mode scanning.
HDCF_REFRAME Set this flag to force an Auto-SYNC session to reframe
the image after setting the phase. Reframing is
automatic for all VESA mode scanning and all Auto-SYNC
sessions using high-speed I-RGB boards.
HDCF_FILTERBLANKING Set this flag to filter blanking lines that appear at the
top of the image.
For ready testing of these values, two macros have been created:
#define HDCF_ON(c,f) ( (c##wCtrlFlags & HDCF_##f) == HDCF_##f) // Tests for
the flag
present.
#define HDCF_OFF(c,f) ( (c##wCtrlFlags & HDCF_##f) != HDCF_##f) // Tests for
the flag NOT
present.
Both of the above macros return a Boolean value. Each takes two arguments,
the AS_CHANNEL name with a trailing “.” or “->” and HDCF symbol name
without the “HDCF_”. For example, to specify this channel to use ODDUP field
ordering, use the code HDCF_ON(pasc->,FRODD).
The HDCF_VESAMODE flag is used to initiate VESA mode scanning. It must be
set on all AS_CHANNEL structures on all video channels, regardless of whether
they have video input.
The flags set are used by the eHD_SyncSurvey( ) function for all channels.
pasc->nRGBCableType
This specifies the cable type that is used; cable types are only significant for
AccuStream boards. The value should be in the range of 0…maxCables, where
maxCables is a system-dependent constant.
The following code sample shows how to retrieve the value of maxCables and
the list of cable types.
//
// Retrieve the active list from the IDEA library.
// Start by finding out how many list items there are.
//
int n, maxCables;
char *pC;
ERRTYPE e
FsiCableList cableList;
uvsl.lValue = 0;
uvsl.pRSet = &rset;
e = eHP_GetControlValue( bh, "IRGBCable", sizeof( uvsl),
(void*)&uvsl
);
//
// If (e == 0), eHP_GetControlValue() returned without an error and
the current
// cable type value is stored in uvsl.lValue.
//
.........
//
// Set the I-RGB Cable Type value to the value in the variable
nCableType.
//
UpdateVideoSettingLong uvsl;
pasc->szComment
A NULL-terminated character array containing a comment line read from a
VESA CHP template file. This may be descriptive text (read from the first
comment line in the CHP file) or it may be generated from the CHP filename (if
no comment was present). It can be used to provide user-friendly descriptions
of the matching VESA template.
The comment string is set after a call to HD_VideoMeasure() returns from a
successful VESA mode scan. If VESA mode scanning was not enabled or if the
scan was unsuccessful, the comment string is invalid.
pasc->wBlankFilter
Used to specify the number of lines to skip in blanking.
ASMODES Structure
Multiple ASMODES structures occur in the AS_CHANNEL structure. Each holds
data relating to the usability or suitability of the video signal on a particular
channel for a particular purpose. The use of these structures is detailed in this
section.
By default, the Auto-SYNC process will check all channels for video and sync
signals and fill RSET structures specifically intended for the Foresight board
type that IDEA Auto-SYNC is using. If possible, that RSET will be made usable by
the other board type as well. By default, IDEA Auto-SYNC also shows a bias
toward single pass mode in situations where both modes are possible for a
given board type. Also by default, the log messages issued by IDEA Auto-SYNC
show no partiality to any particular channel. In all cases, a failure to detect or
recognize a signal on a channel is treated as routine and a notification is logged
but no error is reported.
Your application may want to modify this default operation, for example,
directing the Auto-SYNC process to examine specific channel/mode
combinations while skipping others. Changing the default settings of ASM_N
values in ASMODES structures controls this channel/mode selection process.
The ASM_N values allow you to indicate your "degree-of-interest" in a
channel/mode combination. There are a total of five possible degrees-of-
interest (drop, unnecessary, interesting, required and preferred) that are
described in detail later.
Although the most critical function of the degree of interest (ASM_N) values is
to disable channel/mode combinations, there are other effects. More
generally, these other ASM_N effects are on the:
1. Actions taken when Auto-SYNC recognizes that a particular IDEA mode
cannot be used with the signal on a particular channel.
2. Selection of measurements and analysis performed on the signal.
3. Values in the final RSET structure.
As IDEA Auto-SYNC proceeds, the application also needs to monitor which
channel/mode combination is still in the running and which has been
eliminated. It may also need to know why combinations have been eliminated.
The ASMODES structures are used to report this information.
This is particularly useful when it is time to match video to composite sync
sources and near the end of the Auto-SYNC process when it is time to save or
use the RSET information.
There is one of these ASMODES structures (shown below) for each of the 54
channel/mode combinations (6 different modes times 9 different channels).
The six modes, nine channels, and method of access are described later.
Each structure contains three elements:
ASM_N anNeed Indicates your level of interest in the signal.
ASM_A aaAvail Returned by Auto-SYNC processing to report signal
suitability.
ERRTYPE e If non-zero, cause for non-suitability.
The ASM_N value “anNeed” is set (or left defaulted) by the application to
control the degree of interest for each channel/mode combination. The ASM_A
value “aaAvail” is set by Auto-SYNC to report the availability (described later)
for each channel/mode combination. The ERRTYPE value 'e' is left zero until a
combination has been eliminated (dropped) and then it is set by Auto-SYNC to
an error code (HPERR_*) specifying the cause for the drop. Only the first error
code is saved. After that, the combination is dropped and cannot be revived
without restarting the Auto-SYNC process. The application code should treat
values “aaAvail” and “e” as read-only. Modifying them could produce difficult
to interpret log entries and other anomalies.
These elements are further detailed in the following subsections. The variable
name “pmode” is used in those sections as the name of a pointer to type
ASMODES (i.e. ASMODES *pmode).
pmode->anNeed
Your application sets this value to indicate its level of interest in the “pmode”
signal use. The following value can be specified:
ASM_N_SKIP: Do not process for this mode at all. This causes
pmode->aaAvail to be set to ASM_A_NOTAVAIL and for
pmode->e to be set to HPERR_TOOL_SKIPPED.
ASM_N_NONEED: No need to support this board/mode combination.
Continue processing for it but do not bias signal
analysis in its favor. If it is eliminated, log the cause
only as a "verbose" notification.
ASM_N_INTEREST: Board/mode of interest for this channel. Fit the signal
recognition to this board/mode if possible. If it
becomes eliminated, log the cause as a "normal" error
notification.
ASM_N_REQUIRED: Board/mode required for this channel. Fit the signal
recognition to this board/mode if possible. If it
becomes eliminated, log the cause as a "terse" error
notification and stop all processing for this channel.
Should this occur, all other non-zero ‘e’ codes (for
other ASMODES structures) for this channel would be
set to HPERR_TOOL_SKIPPED.
ASM_N_PREFERRED: Specifies all the same conditions as ASM_N_REQUIRED
and one more, that this pass mode (single or dual) is
preferred over the other for this channel. This value
can only be applied to one of the MODE_H*
board/mode selections to indicate that for the
particular Foresight board type the particular pass
mode (single or dual) is preferred over the other. If
two conflicting pass modes (single and dual pass for
the same board type) both specify ASM_N_PREFERRED,
they are both downgraded to ASM_N_REQUIRED. Also,
if ASM_N_PREFERRED is applied to one of the
MODES_H* combination selections, it is downgraded to
ASM_N_REQUIRED. When this mode is selected (and
not downgraded), the final aaAvail value can be
ASM_A_NOTAVAIL or ASM_A_AVAILABLE but never
ASM_A_NOTCHOSEN. This selection becomes noted in
the RSET structure as preferred.
pmode->aaAvail
Value is maintained by the Auto-SYNC functions to indicate the availability of
this board/mode combination for this channel. The possible values are:
ASM_A_NOTAVAIL: Channel cannot be processed with this board/mode
combination. The cause for its elimination is
specified in pmode->e.
ASM_A_NOTDONE: Auto-SYNC processing has not completed. The RSET
structure is not ready nor has this board/mode
combination been eliminated for this channel.
ASM_A_NOTCHOSEN: Signal can be processed for this board/mode
combination but the other mode (dual pass or single
pass) has been chosen.
ASM_A_AVAILABLE: RSET structure is complete and supports this
board/mode combination.
pmode->e
If this value is non-zero, the video signal on this channel cannot be used for the
“pmode” purpose. The value of pmode->e is a standard IDEA SDK error code.
PIXELD Structure
Data type PIXELD is a structure which occurs only in the AS_CHANNEL structure
as element pasc->PD. It is your application’s interface to the pixel detection
process which is available in function HD_VideoMeasure( ). It is used by your
application before HD_VideoMeasure( ) to select and control pixel detection
and after HD_VideoMeasure( ) to choose an HTOTAL and/or width value from
among those discovered by the pixel detection process.
The PD structure is only used on the analog channels (CA1 to CA4) and, of
course, only on those that have not been eliminated for lack of a signal or any
other cause.
Each of the elements in this structure is described in detail below.
PD.bEnable
Selects or deselects the pixel detection process for this channel. The extended
name for this variable would be pasc->PD.bEnable, so “this channel” refers to
that “pasc”.
The default value is TRUE which is set in eHD_ASInitiate( ). You would set it
FALSE to prevent the pixel detection process from being applied to the video
signal on this channel.
If this value is non-zero, the video signal on this channel cannot be used for the
“pmode”.
PD.e
If the pixel detection process does not complete successfully, the cause is
reported as a non-zero value to this variable. This is a normal IDEA ERRTYPE.
A zero value means that pixel detection was successful and a list of
HTotal/width pairs have been prepared.
PD.dMaxW2H
You can limit the range of the pixel detection search in terms of the width-to-
height ratio. This value sets the maximum width-to-height ratio. For example,
if this value is 1.5 and the height is measured at 720 lines, then the maximum
image width will be 1.5*720 or 1080 pixels.
The default value is 2.0. Any value greater than PD.dMinW2H and greater than
0.01 can be specified. If the value you specify is not valid, both PD.dMaxW2H
and PD.dMinW2H will be reset to their defaults.
PD.dMinW2H
You can limit the range of the pixel detection search in terms of the width-to-
height ratio. This value sets the minimum width-to-height ratio. For example,
if this value is 0.75 and the height is measured at 720 lines, then the minimum
image width will be 0.75*720 or 540 pixels.
The default value is 0.5. Any positive values less than PD.dMaxW2H and less
than 100 can be specified. If the value you specify is not valid, both
PD.dMaxW2H and PD.dMinW2H will be reset to their defaults.
PD.peaks[HD_PIXDLIST]
This is an array of structures of type PIXPEAKS. This array stores the results
from the pixel detection process. Each entry in this array includes a TOTWID
value “tw” which specifies a candidate HTotal and width value and a double
value “dScore” which indicates the amount of evidence found to support that
candidate value.
If fewer than HD_PIXDLIST candidate width values are found, the unused
“peaks” entries are zeroed.
The default HTotal and width values (pasc->tw) are selected from this list by
HD_VideoMeasure( ) based on the dScore values and on a bias towards the 4:3
width-to-height ratio. Your application can override this default by replacing
the pasc->tw values based on another combination of criteria.
The dScore values can also be used to evaluate installation test patterns for
use with Auto-SYNC. Test patterns which give high scores (say over 20,000) to
the correct HTotal and width and low scores (less than half the correct score
value) to each incorrect width are providing good input to the pixel detection
process. The “RESOLVE” test pattern is exceptionally good for this purpose. For
a 520x648 format, it gives a score of 120,000 to the correct choice and less
than 10,000 to incorrect choices.
ASPHASEL Structure
Type ASPHASEL is used in the AS_CHANNEL structure to specify how the phase
delay determination for that channel is performed. Type ASPDMETHOD is used
in the ASPHASEL structure to specify which basic phase delay determination
method is used.
typedef enum {
ASPD_STDEV=O,
ASPD_SHARP,
ASPD_MEAS5,
ASPD_EXAM5
} ASPDMETHOD;
typedef struct {
ASPDMETHOD aspd;
long lParam;
long lHunt;
} ASPHASEL;
ASPD_STDEV
A fast measurement survey followed by a measurement hunt is performed in an
attempt to locate the candidate with the lowest pixel value standard
deviation. This candidate falls very close to the midpoint of the pixel edge. The
candidate who falls lParam degrees beyond this edge is then used. A full pixel
period represents 360 degrees. In the default case, ASPD_STDEV is used with
lParam set to 240 and lHunt set to 10. This provides a fairly quick and
reasonably good selection with a wide range of image/format combinations.
ASPD_SHARP
A fast measurement survey followed by a measurement hunt is performed in an
attempt to locate the candidate with the sharpest histogram peaks. This
method provides very good results when the image consists entirely or almost
(>90%) entirely of an alternating-white-pixel-black-pixel pattern. Such patterns
include "resolve" which is mostly a large checker board with one pixel per
square and the 1 pixel “vgrill” which is alternating black and white vertical
stripes one pixel wide. Note that a resolve-like pattern is very good for pixel
detection and phase delay determination but is very poor for black white
adjustments.
If lParam is from 5 to 630, it specifies that this method is to be filtered using
the standard deviation method. This filtering is based on the fact that the
candidate that produces the minimal pixel standard deviation (StDevMin) is in
the midst of the worse candidate values. Those values need not be considered.
When filtering is on (5<=lParam<=630), a range of candidates are eliminated.
The range starts 0.5nSec before StDevMin. The end of the range is a specified
period of time after StDevMin. This time period is specified with lParam in 0.1
nSec units, but is never less than 0.5nSec or greater than half a pixel period.
Depending on the situation, specifying filtering may speed up or slow down the
phase delay determination process. More importantly, it makes the results of
ASPD SHARP more reliable especially when a substantial portion of the image is
not resolve-like.
ASPD_MEAS5
This method involves a thorough measurement survey of the candidates and is
therefore typically slower than methods ASPD_STDEV and ASPD_SHARP.
However, it is also more precise and reliable than those methods for most
image/format combinations.
Since this method does not employ "hunting", parameter lHunt is not used and
should be set to zero. Parameter lParam specifies filtering and is used exactly
as it is with ASPD_SHARP. When filtering is used with this method, it improves
reliability but has no affect on speed.
ASPD_EXAM5
This method involves a thorough examination survey of the candidates and is
therefore the slowest of the methods. This method requires a minimal amount
of edge information in the image and its selection process is precise and
definitive. The biggest drawback to using this method is that it is usually slower
than picking the phase delay value manually.
This method uses the image data to precisely measure the image stability at
each candidate value. It then selects the most stable. The resulting selection
will produce repeatable results with resilience to changes in temperature and
image content. Based on these criteria, its results are better than can be
selected by eye.
Neither lHunt nor lParam are used and both should be set to zero. Filtering
does not improve the selection results of this method and is not available for
it.
AS_VESAINFO Structure
The IDEATOOLS.H header file declares the AS_VESAINFO structure as follows:
typedef struct {
int nVideoChannel; // Video channel
int nSyncChannel; // sync channel
DWORD dwHFreq; // Horz Frequency measured in Hz
DWORD dwVFreq; // Vert Frequency measured in .01Hz
DWORD dwVTotal; // Vertical Total
BOOL bInterlaced; // TRUE if video is interlaced
BOOL bPosHSync; // TRUE if HSync polarity reversed (pos)
BOOL bPosVSync; // TRUE if VSync polarity reversed (pos)
} AS_VESAINFO;
pVESA->nVideoChannel
The input video channel index. For VESA scanning, this value must be
ASCH_CA1.
pVESA->nSyncChannel
The input video sync channel index. This could be the usual “composite on
green” or more likely, one of the separate sync channel designations.
pVESA->dwHFreq
The horizontal frequency of the video signal, measured in Hz.
pVESA->dwVFreq
The vertical frequency of the video signal, measured in .01Hz.
pVESA->dwVTotal
The vertical total of the video signal, measured in lines.
pVESA->bInterlaced
TRUE if the video is interlaced.
pVESA->bPosHSync
TRUE if the HSYNC has its polarity reversed (positive).
pVESA->bPosVSync
TRUE if the VSYNC has its polarity reversed (positive).
CHAPTER 8:
Tools API Functions and Operating
Sequence
The Tools API provides five “C” functions that are used in the Auto-SYNC
process as a set in a specific sequence. These functions are listed in the correct
operating sequence below:
1. eHD_ASInitiate( )
2. eHD_SyncSurvey( )
3. HD_VideoMeasure( )
4. HD_VideoAlign( )
5. eHD_ASTerminate( )
See a sample of this sequence in the sample code for AS_RGB.EXE in Chapter 6.
The above sequence and the purpose of each of the five IDEA Tools functions
are described below. Before reading that description, take a look at how the
pointer pasc is used in the AS_RGB application discussed earlier in this
document. That variable is a pointer to structure (AS_CHANNEL), which occurs
for each channel. It is set from an array of these pointers in structure *pasr.
The reason for noting this now is that pasc is used in parts of the description
that follow.
Although it is important to know the purpose of each of these functions, the
real API story is in structure AS_RUNSTATE. Each of these functions takes a
pointer (or a pointer to a pointer) to this structure as an argument and each
one alters this structure. For additional information concerning this structure,
refer to Chapter 7.
The Tools API also provides functions for generating CHP files based on VESA
mode templates and for automatically recalculating the phase delay/fine phase
adjustment. For these operations, the following functions are provided:
1. HD_GetVESAInfo( )
2. eHD_ASLoadVESADB( )
3. eHD_ASAutoPhase( )
Function Descriptions
This section discusses the IDEA Tools Library functions with more detail.
eHD_ASInitiate
Before calling this function, you must claim the I-Series/HI*DEF board that
supports the Auto-SYNC operations. The handle to this board is passed as the
first argument. The second argument should always be ASCMASK_ALL indicating
that all channels will be surveyed. If a narrower search is required, other
values (such as ASCMASK_CA1 or ASCMASK_CT1) can be specified. Note
however, that this would violate Guideline #5 in Chapter 6.
void APPTYPE eHD_ASInitiate(
BoardHandle bh,
ASCMASK ascmIn,
AS_RUNSTATE **ppasr);
Description Allocates the AS_RUNSTATE structure complex. Once this structure is
allocated, only eHD_ASTerminate( ) can deallocate it. Do not attempt
to deallocate it any other way.
Parameters bh Handle to the board.
ascmIn Should always be ASCMASK_ALL.
ppasr Returns the pointer to the AS_RUNSTATE structure.
Note Once this routine is called, the log data "verbosity" level (pasr->aslv)
and pointers to your callback routines (pasr->Spinning, etc) can be set.
Note that for each callback routine there is a data object pointer
(such as pasr->pObjSpin). These data pointers can be used in C++ code
to reestablish the "this" pointer.
Returns 0
Non-zero Error condition and pasr is set to NULL. Any structures
that were allocated by eHD_ASInitiate( ) are deallocated
before returning.
eHD_SyncSurvey
HD_VideoMeasure
void APPTYPE HD_VideoMeasure(AS_RUNSTATE *pasr);
Description Makes a preliminary contrast and brightness adjustment and the top,
bottom, left and right sides of the image are located. The height of
the image is expressed as a number of easily counted lines. The width
is measured as a video signal time period or as a ratio or percentage of
the total horizontal period.
HD_VideoAlign
void APPTYPE HD_VideoAlign(AS_RUNSTATE *pasr);
Description Generates a complete RSET structure and then performs the final
adjustments for framing, pixel phase alignment, contrast and
brightness.
Parameter pasr Finalized width information for each channel.
Return On return from this routine, there is a valid pasc->prset for each
channel that was successfully Auto-SYNC'ed. These RSET's should be
immediately copied or saved to *.CHP files since they are deallocated
by the final call.
eHD_ASTerminate
void APPTYPE eHD_ASTerminate(AS_RUNSTATE **ppasr);
bh = (BoardHandle)nHP_ClaimAll(0,1);
if (bh)
{
//
// Do a normal initialize and sync survey
//
eHD_ASInitiate( bh, ASCMASK_ALL, &pasr);
eHD_SyncSurvey( pasr);
//
// Mark the video channels with a control flag
// to indicate VESA mode scanning
//
for (asch = ASCH_CA1; asch < ASCH_CA4; asch++)
{
pasc = pasr->pasc[asch];
if ((pasc != NULL) && (pasc->mVideo.e == 0))
{
pasc->wCtrlFlags |= HDCF_VESAMODE;
}
}
//
// Save the path to the VESA CHP directory
// to the AS_RUNSTATE structure
//
strcpy( pasr->szVESADir, szVESACHPDir);
//
// Calling HD_VideoMeasure() will do the VESA scan.
// It will return an error code if something goes wrong.
//
e = HD_VideoMeasure( pasr);
if (e)
{
//
// Error occurred. Cleanup and exit.
//
TRACE("Error %d from HD_VideoMeasure\n", e);
eHD_ASTerminate( &pasr);
HP_Unclaim( bh);
return;
}
//
// pasr->nVESAStatus is the number of VESA modes that
// matched. It can be 0...4. The corresponding RSETs are
// stored in the pasr->pasc[asch] structures.
//
if (pasr->nVESAStatus == 0)
{
//
// No matches. Cleanup and exit.
//
TRACE("No VESA mode matched the input video signal\n");
eHD_ASTerminate( &pasr);
HP_Unclaim( bh);
return;
}
//
// Loop through the channels and create CHPs from the RSETs.
//
for (asch=ASCH_0; asch<ASCH_N; asch++)
{
if ((asch - ASCH_0) < pasr->nVESAStatus)
{
//
Function Descriptions
This section discusses the VESA mode scanning functions of the IDEA Tools
Library with more detail. These are utility functions that are available from the
library but are not required in order to use VESA scanning.
HD_GetVESAInfo
eHD_ASLoadVESADB
includes some rapid horizontal transitions between light and dark (e.g.,
grill pattern, text).
Once these conditions are met, the function is used as shown in the following
code sample.
ERRTYPE RunAutoPhase(
WORD wBoardID, /* ID of board to use */
RSET *pRSET, /* Video settings */
BOOL bIsIRGB /* TRUE if board is I-RGB or AccuStream */
)
{
BoardHandle bh;
int nRGBCableType;
ASPHASEL asph;
ERRTYPE e;
long lOldPhase, lNewPhase;
int nPhaseMethod;
UpdateVideoSettingLong uvsl;
//
// Set nPhaseMethod to a value 0..5 to match the algorithm
// to be used and then load the ASPHASEL with the parameters
// for the type of algorithm to perform. These are the same values
// that the Auto-SYNC application uses.
//
nPhaseMethod = 0; /* Or whatever value you want */
switch( nPhaseMethod)
{
case 1: /* Refined */
asph.aspd = ASPD_MEAS5;
asph.lParam = 630;
asph.lHunt = 0;
break;
case 2: /* Thorough */
asph.aspd = ASPD_EXAM5;
asph.lParam = 0;
asph.lHunt = 0;
break;
case 3: /* Standard deviation; best match */
asph.aspd = ASPD_STDEV;
asph.lParam = 240;
asph.lHunt = 254;
break;
case 4: /* Sharpness with hunting */
asph.aspd = ASPD_SHARP;
asph.lParam = 630;
asph.lHunt = 10;
break;
case 5: /* Sharpness, maximum */
asph.aspd = ASPD_SHARP;
asph.lParam = 630;
asph.lHunt = 254;
break;
case 0: /* Coarse */
default:
asph.aspd = ASPD_STDEV;
asph.lParam = 240;
asph.lHunt = 10;
break;
}
//
// If the board was already claimed, unclaim it
// before executing the following code.
Function Descriptions
This section discusses the phase determination function in more detail.
eHD_ASAutoPhase
Before calling this function, you must claim the Foresight board.
ERRTYPE APPTYPE eHD_ASAutoPhase(
BoardHandle bh,
RSET *pRSET,
ASPHASEL *pasph,
int nRGBCableType,
WORD wCtrlFlags
HCB_BUSY *pfSpinning,
void *pObjSpin);
Description Attempts to automatically adjust for optimal phase. If you want to be
able to return your phase value to its original value (or even to detect
a change), you should save its value prior to calling this function.
The phase determination algorithm is defined by pasph.
If the board supports fine phase adjustment, the phase
algorithm will be ignored and the fine phase adjustment value
will be set instead.
Parameters bh Handle to the board.
pRSET Pointer to the RSET whose phase is to be adjusted.
pasph Pointer to an ASPHASEL structure that defines the phase
determination algorithm and parameters.
nRGBCableType
The cable type index for an I-RGB or AccuStream board
(e.g., 0 = DVI-to-BNC, 1 = DVI-to-VGA, 2 = DVI-to-DVI) or
0 if a non-IRGB board is being used.
wCtrlFlags Flags to control the survey. 1 = YPbPr input, 2 =
Monochrome input on one of the red, green or blue
channels.
pfSpinning
Pointer to a callback function to receive progress status.
See the description of “pasr->Spinning” in Chapter 7 for
additional information.
pObjSpin Object pointer for pfSpinning; can be used to restore
context in the callback. See the description of
"pasr->pObjSpin" in Chapter 7 for additional information.
Returns Non-zero Error condition occurred during processing.
APPENDIX A:
IDEA SDK and Tools Library
Functional Summary
This Appendix summarizes the functions listed in Chapter 4, C Function Listings,
as well as in Chapter 8, Tools API Functions and Operating Sequence. However,
these tables sort the functions by functional categories:
Board Information
Image Data Access
Image Handle
Millisecond Timer
Preparing Board Access
Register Functions
Tools
Video Control
Board Information
Name Description
nHP_GetBoardInfo Retrieves specified board information.
Image Handle
Name Description
eHD_Command Executes the specified command as set up in the specified
image handle.
bHD_CommandDone Returns status of Command Done.
eHD_Deallocate Makes a previously allocated image buffer in the frame
grabber memory available and invalidates the image handle.
eHD_DeallocateAll Invalidates all image handles assigned to the specified
board. This releases all use of the board’s memory and
permits board-handle-based calls to the board.
eHD_FBFastReadPixel Transfers any rectangular section of a captured image from
the image buffer in frame grabber memory to the
application buffer fpwBuf. Either 8-bit or 10-bit pixels can
be transferred. HI*DEF Plus only: Only 8-bit pixels can be
transferred.
eHD_FBHistoPixel Accumulates pixel code histogram data from any
rectangular section of a captured image from the image
buffer in frame grabber memory to the application buffer
fpwBuf. Either 8-bit or 10-bit pixel codes can be
histogrammed. Neither eHD_FBHistoPixel( ) nor
eHP_FBHisto( ) ever initialize (zero) the histogram array.
eHD_RSET_Get Gets the RSET currently in use by an image handle.
eHD_RSET_Set Configures an image handle for use with a Foresight Imaging
board.
eHD_SetChannel Changes the channel used with a specified image handle.
Millisecond Timer
Name Description
Name Description
Register Functions
Name Description
eHD_RSET_Check Checks an RSET structure against mode-specific criteria.
Name Description
eHP_RSET_FRead Reads the contents of a file containing IDEA video settings
data. Before calling this routine, fopen( ) must be called to
prepare the IDEA Configuration file (*.CHP) for reading. This
routine decodes the ASCII data in the *.CHP file and
performs various syntax checking. If no errors are found,
structure *prset is returned with a binary form of the *.CHP
data.
eHP_RSET_FWrite Writes the IDEA video settings data to an ASCII file. Before
calling this routine, fopen( ) must be called to prepare the
IDEA Configuration file (*.CHP) for writing. This routine
encodes the data in the RSET structure to the ASCII *.CHP
format and writes the data, a line at a time, to the file
opened on fpCHP. fpCHP is not repositioned before the data
is written. It is therefore possible to write descriptive
comments to the file before calling this routine.
eHP_RSET_Set Configures a Foresight Imaging board. Data should already
be loaded into *prset with a call to eHP_RSET_FRead( ).
Tools
Name Description
eHD_ASInitiate Allocates the AS_RUNSTATE structure complex. Once this
structure is allocated, only eHD_ASTerminate( ) can
deallocate it. Do not attempt to deallocate it any other
way.
eHD_ASTerminate Deallocates the entire AS_RUNSTATE, AS_CHANNEL, RSET
complex and completes the Auto-SYNC "session".
bHP_CSyncDetect Reports status of Command Ready.
nHP_Report Provides a list of I-Series/HI*DEF boards found at system
start-up. This should be called before boards are claimed or
opened.
eHD_SyncSurvey Surveys channels on the I-Series/HI*DEF board looking for
composite sync, horizontal sync, vertical sync, and syncless
video sources.
HD_VideoAlign Generates a complete RSET structure and then performs the
final adjustments for framing, pixel phase alignment,
contrast and brightness.
Name Description
HD_VideoMeasure Makes a preliminary contrast and brightness adjustment and
the top, bottom, left and right sides of the image are
located. The height of the image is expressed as a number
of easily counted lines. The width is measured as a video
signal time period or as a ratio or percentage of the total
horizontal period.
Video Control
Name Description
eHP_Command Sets up specified command (wCommand) of specified
board.
bHP_CommandDone Returns status of Command Done.
eHP_CommandDone Waits up to wTimeout_mS milliseconds for Command
Done, then returns. Error condition is generated on
timeout. Timeout value may be defaulted by specifying
VIDEOTIMEOUT.
bHP_CommandReady Returns status of Command Ready.
eHP_CommandReady Waits up to wTimeout_mS milliseconds for Command
Ready then returns. Error condition is generated on
timeout. Timeout value may be defaulted by specifying
VIDEOTIMEOUT.
eHP_SetBlackLevel Sets the Black Level.
eHP_SetChannel Sets the current video signal channel.
eHP_SetGain Sets the Gain Range.
Foresight Imaging
Tel: (001) 978-458-4624
Fax: (001) 978-458-5488
Email:
[email protected]
Web:
www.fi-llc.com
WebEx:
tims.webex.com