unit VDigitizerDefs; { Defines structures and constants for the Video Digitizer Manager (VDM) and } { for Video Digitizer Definition Functions (VDEFs). } { Copyright ©, 1990 Perceptics Corporation } { History: } { June 28, 1990 - Module created. Paul Whalen. } { April 22, 1991 - Major changes. Added VDModalInfo struct, bit field defs. Paul Whalen. } interface uses QuickDraw; const { Message codes for VDEF function selection: } vdInitStructures = -1; { Initialize structures } vdReset = -2; { Reset board } vdInstallInterrupts = -3; { Install interrupt routine } vdRemoveInterrupts = -4; { Remove interrupt routine } vdReadRegister = -5; { Read board register } vdWriteRegister = -6; { Write value to board register } vdSetInputLUT = -7; { Set (Select) Input LookUp Table } vdGetInputLUT = -8; { Get (Selected) Input LookUp Table } vdReadInputLUT = -9; { Read from Input LookUp Table } vdWriteInputLUT = -10; { Write into Input LookUp Table } vdSetSource = -11; { Set video source } vdGetSource = -12; { Get current video source setting } vdReadFrameBuffer = -13; { Read block from frame buffer } vdWriteFrameBuffer = -14; { Write block into frame buffer } vdReadMemoryBlock = -15; { Read a block from digitizer memory } vdWriteMemoryBlock = -16; { Write a block into digitizer memory } vdCaptureFrames = -17; { Capture digitizer frames } vdWaitCaptureDone = -18; { Wait for capture to complete } vdIsCapture = -19; { Test for capture in progress } vdGetTimeOut = -22; { Get current timeout value for digitizer operations } vdSetTimeOut = -23; { Set timeout value for digitizer operations } vdTask = -24; { Perform any needed digitizer operations } vdPreserve = -25; { Save board settings } vdRestore = -26; { Restore board settings } vdAdjustWindow = -27; { Adjust window size/position for HW restrictions } vdAdjustDisplayRect = -28; { Adjust live display rect size/position for HW restrictions } vdAdjustGrabRect = -29; { Adjust capture rect size/position for HW restrictions } vdReadFrameCounter = -30; { Read the frame and tick counts for the last digitizing operation. } vdGetHistogram = -31; { Compute the histogram of the specified region of the specified frame buffer. } vdSetMode = -32; { Set the digitizer into the specified mode. } vdGetModeInfo = -33; { Get digitizer modal info. } vdGetModeName = -34; { Get digitizer mode name. } vdDoCustomFcn = -35; { Invoke a Custom Function of the VDEF. } vdSetOutputLUT = -36; { Set (Select) Output LookUp Table } vdGetOutputLUT = -37; { Get (Selected) Output LookUp Table } vdReadOutputLUT = -38; { Read from Output LookUp Table } vdWriteOutputLUT = -39; { Write into Output LookUp Table } vdGetFrameBuffer = -40; { Get current frame buffer selection } vdSetFrameBuffer = -41; { Set (Select) the specified frame buffer as the current frame buffer } vdGetModalParams = -42; { Get the list of modal parameters for the digitizer } vdSetModalParams = -43; { Set values for the modal parameters for the digitizer } vdGetGainMinMax = -44; { Get min & max digitizer gain settings } vdGetGain = -45; { Get current setting for digitizer gain } vdSetGain = -46; { Set digitizer gain value } vdGetOffsetMinMax = -47; { Get min & max digitizer offset settings } vdGetOffset = -48; { Get current setting for digitizer offset } vdSetOffset = -49; { Set digitizer offset value } vdGetControlBits = -50; { Get current setting for digitizer control bits } vdSetControlBits = -51; { Set digitizer control bits } vdSetCameraType = -52; { Set digitizer camera type code } vdGetCameraType = -53; { Get digitizer camera type code } vdSetCameraSize = -54; { Set digitizer camera size } vdGetCameraSize = -55; { Get digitizer camera size } vdSetCameraEdges = -56; { Set digitizer camera edges } vdGetCameraEdges = -57; { Get digitizer camera edges } vdSetCameraName = -58; { Set digitizer camera name } vdGetCameraName = -59; { Get digitizer camera name } vdSetCameraLineTime = -60; { Set digitizer camera line time } vdGetCameraLineTime = -61; { Get digitizer camera line time } vdSetCameraPixelInfo = -62; { Set digitizer camera pixel info } vdGetCameraPixelInfo = -63; { Get digitizer camera pixel info } vdSetCameraSpecialInfo = -64; { Set digitizer camera special info } vdGetCameraSpecialInfo = -65; { Get digitizer camera special info } { Error codes for Video Digitizer Definition Functions: } vdNotSupported = -9000; { Operation is not supported by VDEF/hardware. } vdTimeOut = -9001; { Operation did not complete within allotted time. } vdInvalidLUT = -9002; { The specified LUT number is not valid. } vdInvalidSrc = -9003; { The specified input source is not valid. } vdInvalidReg = -9004; { The specified register number is not valid. } vdISRNotInstalled = -9005; { Referenced ISR is not installed. } vdMultDevices = -9006; { Digitizer does not support multiple display devices. } vdInvalidTimeOut = -9007; { The specified timeout value was out of range. } vdDepthNotSupported = -9008; { Digitizer does not support screen device with this depth. } vdInvalidLUTType = -9009; { The specified LUT type is not valid for this digitizer. } vdDevNotRecognized = -9010; { The window's gDevice is not recognized. } vdInvalidBuffer = -9011; { Buffer not valid. } vdIOErr = -9012; { Unknown hardware failure. } vdNotFound = -9013; { Requested device/resource not found. } vdOutOfMemory = -9014; { VDM unable to allocate temporary memory. } { Trigger codes: } vdSource = 0; { Trigger on video signal. } vdExternalStart = 1; { Start capture on external trigger signal. } vdExternalStop = 2; { Start capture, then stop capture on external trigger. } vdExternalStartStop = 3; { Start capture on external trigger, stop on next trigger. } { Operation codes: } vdNone = 0; { No operation. } vdArithAvg = 1; { Arithmetic average frames. } vdGeomAvg = 2; { Geometric average frames. } vdIntegrate = 3; { Integrate video frames. } vdAddLive = 4; { Add live to reference image. } vdSubtractLive = 5; { Subtract live from reference image. } vdMultiplyLive = 6; { Multiply live with reference image. } vdANDLive = 7; { AND live with reference image. } vdORLive = 8; { OR live with reference image. } vdXORLive = 9; { XOR live with reference image. } vdBgdSubAvg = 10; { Arithmetic average with subtract of reference image. } vdBgdSubGeom = 11; { Geometric average with subtract of reference image. } vdRatioLive = 12; { Ratio live image to reference image. } vdCustomGrabOp = 13; { Do a custom grab operation (set up previously). } vdBgdSubIntegrate = 14; { Integration with subtract of reference image. } { LUT codes: } vdLUT = 0; { Normal indexed LUT. } vdCLUT = 1; { Color indexed CLUT. } { VDModalInfo structure bit field definitions } { Bit masks for the vdModalFields field of the VDModalInfo structure } { (If the bit is set, the field value is dependent on the operating mode.) } vdMFBFeatures = $00000001; { The vdFeatures field } vdMFBFunctions = $00000002; { The vdFunctions field } vdMFBCustomFcns = $00000004; { The vdCustomFcns field } vdMFBCustomNames = $00000008; { The vdCustomNames field } vdMFBNInputLUTs = $00000010; { The vdNInputLUTs field } vdMFBInputLUTSize = $00000020; { The vdInputLUTSize field } vdMFBNOutputLUTs = $00000040; { The vdNOutputLUTs field } vdMFBOutputLUTSize = $00000080; { The vdOutputLUTSize field } vdMFBChannels = $00000100; { The vdChannels field } vdMFBBitsPerChannel = $00000200; { The vdBitsPerChannel field } vdMFBVideoSize = $00000400; { The vdVideoSize field } vdMFBNFrameBuffers = $00000800; { The vdNFrameBuffers field } vdMFBFBSize = $00001000; { The vdFBSize field } vdMFBFBType = $00002000; { The vdFBType field } vdMFBFBDepth = $00004000; { The vdFBDepth field } vdMFBFBBaseAddr = $00008000; { The vdFBBaseAddr field } vdMFBFBRowBytes = $00010000; { The vdFBRowBytes field } vdMFBDispWindowSize = $00020000; { The vdDispWindowSize field } { Bit masks for the vdFeatures field of the VDModalInfo structure } { (If the bit is set, the feature is supported by the video digitizer } { in the current operating mode.) } vdFeBPALMode = $00000001; { PAL-mode input } vdFeBRS170Mode = $00000002; { RS170-mode input } vdFeBProgGain = $00000004; { Progammable gain on input } vdFeBProgOffset = $00000008; { Progammable offset on input } vdFeBRGB = $00000010; { RGB input } vdFeBInputSelect = $00000020; { Input channel selection } vdFeBALU = $00000040; { ALU processing } vdFeBDMAOut = $00000080; { DMA output } vdFeBSubSIn = $00000100; { Sub-sampling of input } vdFeBSuperSIn = $00000200; { Super-sampling of input } vdFeBSubSOut = $00000400; { Sub-sampling for output } vdFeBSuperSOut = $00000800; { Super-sampling for output } vdFeBExtTrigStart = $00001000; { External trigger to start grabbing } vdFeBExtTrigStop = $00002000; { External trigger to stop grabbing } vdFeBExtTrigStartStop = $00004000; { External trigger to start and to stop grabbing } vdFeBLiveHistogram = $00008000; { Digitizer supports/allows live histograms. } vdFeBMultipleCameras = $00010000; { Digitizer supports multiple, selectable cameras. } { Bit masks for the vdControls field of the VDModalInfo structure } { (If the bit is set, the feature is supported by the video digitizer in } { the current operating mode AND can be controlled by the application.) } vdFcBPALMode = $00000001; { PAL-mode input } vdFcBRS170Mode = $00000002; { RS170-mode input } vdFcBProgGain = $00000004; { Progammable gain on input } vdFcBProgOffset = $00000008; { Progammable offset on input } vdFcBRGB = $00000010; { RGB input } vdFcBInputSelect = $00000020; { Input channel selection } vdFcBALU = $00000040; { ALU processing } vdFcBDMAOut = $00000080; { DMA output } vdFcBSubSIn = $00000100; { Sub-sampling of input } vdFcBSuperSIn = $00000200; { Super-sampling of input } vdFcBSubSOut = $00000400; { Sub-sampling for output } vdFcBSuperSOut = $00000800; { Super-sampling for output } vdFcBInLUTEnab = $00001000; { Input LUT enable/disable } vdFcBOutLUTEnab = $00002000; { Output LUT enable/disable } vdFcBInLUTSize = $00004000; { Input LUT size } vdFcBOutLUTSize = $00008000; { Output LUT size } vdFcBPFBSize = $00010000; { Primary frame buffer size } vdFcBSFBSize = $00020000; { Secondary frame buffer size } vdFcBAFBSize = $00040000; { Auxiliary frame buffer size } vdFcBExtTrigStart = $00100000; { External trigger to start grabbing } vdFcBExtTrigStop = $00200000; { External trigger to stop grabbing } vdFcBExtTrigStartStop = $00400000; { External trigger to start and to stop grabbing } { Bit masks for the vdFunctions field of the VDModalInfo structure } { (If the bit is set, the function is supported by the video digitizer in } { the current operating mode either in hardware or by the VDEF.) } vdFuBRawSample = $00000001; { Raw sampling (no processing) } vdFuBArithAvg = $00000002; { Arithmetic averaging } vdFuBGeomAvg = $00000004; { Geometric averaging } vdFuBIntegrate = $00000008; { Integration } vdFuBSubtract = $00000010; { Subtraction } vdFuBAdd = $00000020; { Addition } vdFuBMultiply = $00000040; { Multiplication } vdFuBAND = $00000080; { Logical AND } vdFuBOR = $00000100; { Logical OR } vdFuBXOR = $00000200; { Logical XOR } vdFuBBgSubAvg = $00000400; { Background-subtracted averaging } vdFuBBgSubGeomAvg = $00000800; { Background-subtracted geometric averaging } vdFuBRatio = $00001000; { Ratio } vdFuBBgSubIntegrate = $00002000; { Background-subtracted integration } vdFuBCustoms = $80000000; { Custom Functions } { Miscellaneous: } MaxLUTs = 10; { Maximum number of LUTs on a digitizer. } MaxCustomFcns = 32; { Maximum number of VDEF custom functions. } MaxFBs = 999; { Maximum number of frame buffers on a digitizer. } MaxChoices = 3; { Maximum number of choices for a modal parameter. } MaxParams = 4; { Maximum number of modal parameters in a list. } ChoiceParm = 1; { The type code for a 'choice of n' parameter. } IntParm = 2; { The type code for an integer parameter. } FloatParm = 3; { The type code for a float parameter. } chunky = 0; { PixelMap pixel type identifier. } ImageHResolution = 72 * $00010000; { For hres field of pixMap. } ImageVResolution = 72 * $00010000; { For vres field of pixMap. } type VDMPParamEntry = packed record vdMPEntryName: Str31; { The name of this entry } vdMPEntryType: Integer; { The type for this entry } vdMPIEntryValue: Integer; { The current value for an integer-type entry } vdMPNChoices: Integer; { For type=choice, the number of choices } vdMPChoiceNames: array[0..MaxChoices] of Str31; { The names of the choices } vdMPFEntryValue: LongReal; { The current value for a float-type entry } vdMPFMinValue: LongReal; { The minimum value of a float-type param } vdMPFMaxValue: LongReal; { The maximum value of a float-type param } end; VDMPListHdl = ^VDMPListPtr; VDMPListPtr = ^VDModalParamsList; VDModalParamsList = packed record vdMPListName: Str31; { The title for the list. } vdMPNParams: Integer; { The number of parameters in the list. } vdModalParams: array[0..MaxParams] of vdMPParamEntry; { The parameters } end; VDMInfoHandle = ^VDMInfoPtr; VDMInfoPtr = ^VDModalInfo; VDModalInfo = packed record vdModeName: Str31; { The name of the current mode of operation } vdFeatures: LongInt; { Digitizer features (bit set if present) } vdControls: LongInt; { Settable digitizer features } vdFunctions: LongInt; { VDEF functions (bit set if supported) } vdMPListHdl: VDMPListHdl; { Handle to the list of modal parameters } vdNCustomFcns: Integer; { Number of custom functions performed } vdCustomNames: array[0..MaxCustomFcns] of Str31; { Custom fcn names } vdNInputLUTs: Integer; { The number of input LUTs on the digitizer } vdInputLUTSize: array[0..MaxLUTs] of Integer; { Number entries per LUT} vdNOutputLUTs: Integer; { The number of output LUTs on digitizer } vdOutputLUTSize: array[0..MaxLUTs] of Integer; { Number entries per LUT} vdChannels: Integer; { Number of video channels on the digitizer } vdBitsPerChannel: Integer; { Data bits per input channel } vdVideoSize: Point; { Size of the Video Image input } vdNFrameBuffers: Integer; { Number of frame buffers on the digitizer } vdFBSize: array[0..2] of Point; { Size of frame buffers } vdFBType: array[0..2] of Integer; { Pixel type of frame buffers } vdFBDepth: array[0..2] of Integer; { Pixel depth of frame buffers } vdFBBaseAddr: array[0..2] of LongInt; { Address of first row of FBs } vdFBRowBytes: array[0..2] of Integer; { Offset between rows of FBs } vdDispWindowSize: Point; { Width/height of max live display window} vdReserved2: LongInt; { Reserved for future use } end; VDHandle = ^VDPtr; VDPtr = ^VDRecord; VDRecord = packed record vdID: Integer; { Digitizer's boardID } vdSlot: Integer; { Digitizer's slot number } vdNextDigitizer: VDHandle; { Handle to next digitizer in list } vdPrevDigitizer: VDHandle; { Handle to previous digitizer in list } vdOwner: WindowPtr; { Digitizer's window } vdCaptureRect: Rect; { Capture rectangle } vdDefProc: Handle; { Video digitizer definition function } vdData: Handle; { Data used by VDEF } vdMake: Str255; { Digitizer's manufacturer name } vdModel: Str255; { Digitizer's model name } vdModelNumber: Str255; { Digitizer's model number } vdDescription: Str255; { Digitizer description text } vdNModes: Integer; { Number of modes for the digitizer } vdModalFields: LongInt; { Fields that are mode-dependent } vdCurrentMode: Integer; { The number for the current mode } vdCurrentInLUT: Integer; { ID of the currently selected input LUT } vdCurrentOutLUT: Integer; { ID of the currently selected output LUT } vdCurrentFB: Integer; { ID of the currently selected frame buffer } vdModeInfo: VDModalInfo; { Device info that is mode-dependent } vdReserved1: LongInt; { Reserved for future use } end; LUTEntry = record index: Integer; { The index of the entry } value: Integer; { Gray level value of entry } end; lEntryArray = array[0..0] of LUTEntry; LTabHandle = ^LTabPtr; LTabPtr = ^LUTTable; LUTTable = record ltSize: Integer; { Number of entries - 1 in ltTable } ltTable: lEntryArray; { The array of LUTEntry records } end; histogramArray = packed array[0..255] of LongInt; histArrayPtr = ^histogramArray; UnsignedByte = 0..255; UnsBytePtr = ^UnsignedByte; UnsByteArray = packed array[0..0] of UnsignedByte; UnsByteArrayPtr = ^UnsByteArray; IntPtr = ^Integer; IntArray = packed array[0..0] of Integer; IntArrayPtr = ^IntArray; LongPtr = ^LongInt; LongArray = packed array[0..0] of LongInt; LongArrayPtr = ^LongArray; RectPtr = ^Rect; LUTArray = packed array[0..255] of UnsignedByte; LUT8Ptr = ^LUTArray; LUT8Hdl = ^LUT8Ptr; LUT11Array = packed array[0..2047] of UnsignedByte; LUT11Ptr = ^LUT11Array; LUT11Hdl = ^LUT11Ptr; {StringPtr = ^Str255;} RealPtr = ^Real; ExtendedPtr = ^Extended; implementation end.