56
Frame Format and Descriptor Structures
Document No.: 04646-01
PixeLINK PL-A780
MACHINE VISION CAMERA
SYSTEM GUIDE
Copyright © 2004 PixeLINK
All Rights Reserved
9 Frame Format and Descriptor Structures
9.1 Frame Format
A frame coming from the camera will have the following format:
Byte 0
Byte 1
Byte 2
…
Byte N-2
Byte N-1
Frame Descriptor (See Descriptor Structure Format)
= IIDC 1.31 Frame padding region
N = Number of bytes per frame (width * height * bytes per pixel)
If multiple descriptors are being used then a synchronization code will be encoded in the first
four pixels. This code is to ensure that the driver knows which frame it is receiving from the
camera (in case the frame size changes between descriptors). The code is encoded as:
Byte 0
Bits 7 … 0
Byte 1
Bits 7 … 1
Code Bit 7
Byte 2
Bits 7 … 0
Byte 3
Bits 7 … 1
Code Bit 6
Byte 4
Bits 7 … 0
Byte 5
Bits 7 … 1
Code Bit 5
Byte 6
Bits 7 … 0
Byte 7
Bits 7 … 1
Code Bit 4
Byte 8
Bits 7 … 0
Byte 9
Bits 7 … 1
Code Bit 3
Byte 10
Bits 7 … 0
Byte 11
Bits 7 … 1
Code Bit 2
Byte 12
Bits 7 … 0
Byte 13
Bits 7 … 1
Code Bit 1
Byte 14
Bits 7 … 1
Byte 15
Bits 7 … 1
Code Bit 0
where Code is a 8 bit number (Bit 7 = MSB). The Code is zero for the first frame of a video
stream, and will increment by one each frame after that, rolling over once it reaches the
number of descriptors currently in use (i.e. if three descriptors are in use then the Code will
roll over once it reaches 2).
9.1.1 Byte Order
For 8-bit data, the byte order is straight forward with byte 0 being the top left pixel in the
image, byte 1 being the second pixel in the top row and so on.
The FireWire bus uses big-endian notation, that means that the most significant byte comes
first and the most significant bit is bit 0. The PC uses little endian notation, where the least
significant byte comes first. Hence, on a PC system, when receiving 16-bit data from the
camera, the bytes will be swapped.