VCEANCB_LockBuffer
[This is preliminary documentation and subject to change.]The VCEANCB_LockBuffer function gets raw bytes from snapped frame.
VCEANCB_Error VCEANCB_LockBuffer ( HANDLE hVCEANCB, // Handle to card BYTE** ppBuffer, // Pointer to pointer to buffer DWORD* pdwSize // Pointer to size of buffer );
Parameter:
- hVCEANCB
- [in] Handle to FrameLink card.
- ppBuffer
- [out] Pointer to pointer to buffer.
- pdwSize
- [out] Pointer to size of buffer
Return values:
If function succeeds, the return value is VCEANCB_Err_Success.
If function fails, the return value can be one of the following values.
| VCEANCB_Err_badArgument | hVCEANCB handle or ppBuffer pointer is bad (possibly NULL). |
| VCEANCB_Err_notGrabbed | VCEANCB_SnapFrame was not called. |
| VCEANCB_Err_bufferBusy | Snapping buffers are busy. |
Remarks:
The buffer is a raw bytes in YUV 4:2:2 format received from digitizer for color image(see table bellow) or "Y only" format, where each byte represent Luma component of YUV data.
| Cb0 | Y0 | Cr0 | Y1 | Cb2 | Y2 | Cr2 | Y3 |
Even field placed at begin of returned buffer. Start of odd field could be found using next formula:
if(monochrome) { // For monochrome image
sourceWidth = dwWidth;
frameShift = dwWidth*(dwHeight/2)/512;
if((dwWidth*(dwHeight/2))%512)
frameShift++;
frameShift*=512;
}
else { // For color image
sourceWidth = 2*dwWidth;
frameShift = dwWidth*dwHeight/512;
if((dwWidth*dwHeight)%512)
frameShift++;
frameShift++;
frameShift*=512;
}
Where:
- monochrome
- Monochrome flag. Used in VCEANCB_SnapData structure (corresponding PAL or NTSC field of VCEANCB_CameraConfig structure)
- dwWidth
- Width of image in pixels
- dwHeight
- Height of image in pixels
- frameShift
- Shift of odd field relative to start of buffer in bytes
- sourceWidth
- Width of line in source buffer in bytes