Most pci dv utility routines have a dvu_ prefix. dvu_ subroutines are not necessarily specific to the EDT digital video hardware. For example, dvu_write_rasfile could concievably be used to write a raster file from any source, not just one captured by an EDT PCI DV board. As such, dvu_ subroutines do not operate on an PdvDev device handle in their parameter lists.
There are a few utility subroutines that don't take a PdvDev device handle but do have a pdv_ prefix, and may or may not have some PCI DV specificity.
The remaining pdv_ subroutines that do take a PdvDev device handle are tagged as utility subroutines because they do not fit any other category.
Defines | |
| #define | DVUFATAL PDVLIB_MSG_FATAL |
| #define | RAS_MAGIC 0x59a66a95 |
| #define | RT_STANDARD 1 |
| #define | RMT_EQUAL_RGB 1 |
| #define | RMT_NONE 0 |
| #define | BI_RGB 0L |
| #define | WIDTHBYTES(bits) (((bits) + 31) / 32 * 4) |
| #define | DWORD unsigned long |
| #define | LONG long |
| #define | WORD unsigned short |
| #define | BYTE unsigned char |
| #define | BI_RLE8 1L |
| #define | BI_RLE4 2L |
| #define | BI_BITFIELDS 3L |
Functions | |
| int | pdv_bytes_per_line (int width, int depth) |
| Returns bytes per line based on width and bit depth, including depth < 8. | |
| void | pdv_perror (char *err) |
| Formats and prints a system error. | |
| uchar_t * | pdv_alloc (int size) |
| Convenience routine to allocate memory in a system-independent way. | |
| void | pdv_free (uchar_t *ptr) |
| Convenience routine to free the memory allocated with pdv_alloc. | |
| int | pdv_access (char *fname, int perm) |
| Determines file access independent of operating system. | |
| int | pdv_is_kodak_i (PdvDev *pdv_p) |
| Infer if it's a Redlake (formerly Roper, formerly Kodak) 'i' camera from the serial settings. | |
| int | pdv_is_atmel (PdvDev *pdv_p) |
| Infers that this device is connected to is an Atmel camera, from settings from the loaded camera config file. | |
| int | pdv_is_hamamatsu (PdvDev *pdv_p) |
| Infers that this device is connected to is a Hamamatsu camera, from settings from the loaded camera config file. | |
| int | pdv_is_dvc (PdvDev *pdv_p) |
| Infers that this device is connected to is a DVC camera, from settings from the loaded camera config file. | |
| int | pdv_is_cameralink (PdvDev *pdv_p) |
| Infers that this device is connected to is a Camera Link camera (as opposed to RS-422 or LVDS parallel), based on settings from the loaded camera config file. | |
| int | pdv_is_simulator (PdvDev *pdv_p) |
| Infers that this device is a simulator -- either a PCI DV CLS board, or a PCIe DV C-Link with simulator FPGA loaded. | |
| int | pdv_cl_camera_connected (PdvDev *pdv_p) |
| Checks whether a camera is connected and turned on. | |
| int | dvu_write_rasfile (char *fname, u_char *addr, int x_size, int y_size) |
| Utility routine that outputs a 1-band, 8-bit image to a Sun raster format file (regardless of platform). | |
| int | dvu_write_rasfile16 (char *fname, u_char *addr, int x_size, int y_size, int depth_bits) |
| converts 1 band, 10-16 bit image to a sun raster format file and writes to a file. | |
| int | dvu_write_window (char *fname, dvu_window *w) |
| dvu_window * | dvu_read_window (char *fname) |
| int | dvu_write_image (char *fname, u_char *addr, int x_size, int y_size, int istride) |
| Utility routine that outputs a 1-band, 8-bit image to a Sun raster format file (regardless of platform), with stride. | |
| int | dvu_write_rasfile24 (char *fname, u_char *addr, int x_size, int y_size) |
| Writes a 24-bit per pixel RGB data buffer as a Sun Raster format file. | |
| int | dvu_write_image24 (char *fname, u_char *addr, int x_size, int y_size, int istride) |
| Writes a 24-bit per pixel RGB data buffer as a Sun Raster format file, with stride. | |
| int | dvu_wordscale (u_short *words, u_char *bytes, int count, int minbyte, int maxbyte, int doinit) |
| int | dvu_winscale (dvu_window *wi, dvu_window *bi, int minbyte, int maxbyte, int doinit) |
| int | dvu_histeq (u_char *src, u_char *dst, int size, int depth) |
| Perform a histogram equalization on an image. | |
| int | dvu_load_lookup (char *filename, int depth) |
| int | dvu_save_lookup (char *filename, int depth) |
| int | dvu_lookup (u_char *src, u_char *dst, int size, int depth) |
| int | dvu_exp_histeq (u_char *src, u_char *dst, int size, int depth, int cutoff) |
| Perform a histogram equalization on an image, with cutoff (experimental). | |
| void | dvu_free_tables () |
| dvu_window * | dvu_init_window (u_char *data, int sx, int sy, int dx, int dy, int xdim, int ydim, int depth) |
| dvu_window * | dvu_reset_window (dvu_window *s, u_char *data, int sx, int sy, int dx, int dy) |
| int | dvu_free_window (dvu_window *w) |
| int | ten2one (u_short *wbuf, u_char *bbuf, int count) |
| int | dvu_word2byte (u_short *wbuf, u_char *bbuf, int count, int depth) |
| int | dvu_word2byte_with_stride (u_short *wbuf, u_char *bbuf, int wstride, int bstride, int xsize, int ysize, int depth) |
| void | dvu_perror (char *str) |
| int | dvu_write_bmp (char *fname, u_char *buffer, int width, int height) |
| Writes an 8-bit per pixel data buffer as a grayscale Windows bitmap file. | |
| int | dvu_write_bmp_24 (char *fname, u_char *buffer, int width, int height) |
| Writes a 24-bit per pixel RGB data buffer as a Windows bitmap file. | |
| int | dvu_write_raw (int imagesize, u_char *imagebuf, char *fname) |
| Writes a 24-bit per pixel RGB data buffer as a raw data file (no formatting). | |
| void | dvu_long_to_charbuf (unsigned int val, u_char *buf) |
Variables | |
| int | Pdv_debug |
| int pdv_bytes_per_line | ( | int | width, | |
| int | depth | |||
| ) |
| void pdv_perror | ( | char * | err | ) |
Formats and prints a system error.
Convenience function to format and print a system error. In UNIX implementations, the routine just turns around and makes a perror system call, with the errstr argument. NT implementations format and print the last error using GetLastErrorString.
| uchar_t* pdv_alloc | ( | int | size | ) |
Convenience routine to allocate memory in a system-independent way.
The buffer returned is page aligned. Page alignment is required for some EDT image routines and always preferred. This function uses VirtualAlloc on Windows NT/2000/XP systems, or valloc on UNIX-based systems.
Example
unsigned char *buf = pdv_alloc(pdv_image_size(pdv_p));
| size | the number of bytes of memory to allocate |
| void pdv_free | ( | uchar_t * | ptr | ) |
| int pdv_access | ( | char * | fname, | |
| int | perm | |||
| ) |
Determines file access independent of operating system.
This a convenience routine that maps to access() on Unix/Linux systems, and _access on Windows systems.
| fname | path name of the file to check access of. | |
| perm | permission flag(s) to test for. See access() (Unix/Linux) or _access (Windows) for valid arguments. |
if (pdv_access("file.ras", F_OK)) print("Warning: about to overwrite file %s/n", "file.ras");
| int pdv_is_kodak_i | ( | PdvDev * | pdv_p | ) |
| int pdv_is_atmel | ( | PdvDev * | pdv_p | ) |
Infers that this device is connected to is an Atmel camera, from settings from the loaded camera config file.
| pdv_p | pointer to pdv device structure returned by pdv_open |
| int pdv_is_hamamatsu | ( | PdvDev * | pdv_p | ) |
| int pdv_is_dvc | ( | PdvDev * | pdv_p | ) |
| int pdv_is_cameralink | ( | PdvDev * | pdv_p | ) |
Infers that this device is connected to is a Camera Link camera (as opposed to RS-422 or LVDS parallel), based on settings from the loaded camera config file.
Generally useful only for applications that may use both Camera Link and the (older) AIA cameras, and that need to differentiate between the two.
| pdv_p | device handle returned by pdv_open |
| int pdv_is_simulator | ( | PdvDev * | pdv_p | ) |
| int pdv_cl_camera_connected | ( | PdvDev * | pdv_p | ) |
Checks whether a camera is connected and turned on.
Looks for an active (changing) pixel clock from the camera, and returns 1 if detected.
| int dvu_write_rasfile | ( | char * | fname, | |
| u_char * | addr, | |||
| int | x_size, | |||
| int | y_size | |||
| ) |
Utility routine that outputs a 1-band, 8-bit image to a Sun raster format file (regardless of platform).
| fname | the name of the output file | |
| addr | the address of the image data (8 bits per pixel) | |
| x_size | width in pixels of image | |
| y_size | height in pixels of image |
| int dvu_write_rasfile16 | ( | char * | fname, | |
| u_char * | addr, | |||
| int | x_size, | |||
| int | y_size, | |||
| int | depth_bits | |||
| ) |
converts 1 band, 10-16 bit image to a sun raster format file and writes to a file.
| fname | the name of the output file | |
| addr | the address of the image data (8 bits per pixel) | |
| x_size | width in pixels of image | |
| y_size | height in pixels of image | |
| depth_bits | number of bits per pixel |
| int dvu_write_image | ( | char * | fname, | |
| u_char * | addr, | |||
| int | x_size, | |||
| int | y_size, | |||
| int | istride | |||
| ) |
Utility routine that outputs a 1-band, 8-bit image to a Sun raster format file (regardless of platform), with stride.
This function can be used to output a partial image. For example, to output the top left 100x100 pixels of the image, specify x_size of 100 and y_size * 100, and an istride of the actual width of the image.
| fname | the name of the output file | |
| addr | the address of the image data (8 bits per pixel) | |
| x_size | width in pixels of image | |
| y_size | height in pixels of image | |
| istride | number of pixels (bytes) to skip from one the beginning of one line to the beginning of the next (this should just be the image width, unless you want something weird like a diagonally skewed image). |
| int dvu_write_rasfile24 | ( | char * | fname, | |
| u_char * | addr, | |||
| int | x_size, | |||
| int | y_size | |||
| ) |
| int dvu_write_image24 | ( | char * | fname, | |
| u_char * | addr, | |||
| int | x_size, | |||
| int | y_size, | |||
| int | istride | |||
| ) |
Writes a 24-bit per pixel RGB data buffer as a Sun Raster format file, with stride.
| fname | the name of output file | |
| addr | data buffer, three bytes per pixel (RGB) | |
| x_size | number of pixels per line | |
| y_size | number of lines in the image | |
| istride | number of pixels to skip between sucessive lines |
// skip every other line int err=dvu_write_image24("file.ras", buf_p, pdv_get_width(pdv_p), pdv_get_height(pdv_p) / 2, pdv_get_width(pdv_p) );
| int dvu_histeq | ( | u_char * | src, | |
| u_char * | dst, | |||
| int | size, | |||
| int | depth | |||
| ) |
| int dvu_exp_histeq | ( | u_char * | src, | |
| u_char * | dst, | |||
| int | size, | |||
| int | depth, | |||
| int | cutoff | |||
| ) |
| int dvu_write_bmp | ( | char * | fname, | |
| u_char * | buffer, | |||
| int | width, | |||
| int | height | |||
| ) |
Writes an 8-bit per pixel data buffer as a grayscale Windows bitmap file.
Example
int err=dvu_write_bmp("file.bmp", buf_p, pdv_get_width(pdv_p), pdv_get_height(pdv_p) );
| fname | filename | |
| buffer | data buffer, one byte per pixel | |
| width | number of pixels (bytes) per line | |
| height | number of lines in the image |
| int dvu_write_bmp_24 | ( | char * | fname, | |
| u_char * | buffer, | |||
| int | width, | |||
| int | height | |||
| ) |
Writes a 24-bit per pixel RGB data buffer as a Windows bitmap file.
Example
int err=dvu_write_bmp("file.bmp", buf_p, pdv_get_width(pdv_p), pdv_get_height(pdv_p);
| fname | filename | |
| buffer | data buffer, one byte per pixel | |
| width | number of pixels (bytes) per line | |
| height | number of lines in the image |
| int dvu_write_raw | ( | int | imagesize, | |
| u_char * | imagebuf, | |||
| char * | fname | |||
| ) |
Writes a 24-bit per pixel RGB data buffer as a raw data file (no formatting).
Example
int err=dvu_write_raw(pdv_get_imagesize(pdv_p), buf_p, "file.raw");
| imagesize | number of bytes in the image. | |
| imagebuf | pointer to image data buffer. | |
| fname | output file name. |
1.4.7