File: utils.h

package info (click to toggle)
libdc1394-22 2.2.0-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,924 kB
  • sloc: ansic: 16,415; sh: 10,205; makefile: 273
file content (105 lines) | stat: -rw-r--r-- 3,541 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * 1394-Based Digital Camera Control Library
 *
 * Utilities
 *
 * Written by Damien Douxchamps <ddouxchamps@users.sf.net>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __DC1394_UTILS_H__
#define __DC1394_UTILS_H__

/*! \file dc1394/utils.h
    \brief Utility functions
    \author Damien Douxchamps: coding
    \author Peter Antoniac: documentation maintainer

    More details soon
*/

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Returns the image width and height (in pixels) corresponding to a video mode. Works for scalable and non-scalable video modes.
 */
dc1394error_t dc1394_get_image_size_from_video_mode(dc1394camera_t *camera, uint32_t video_mode, uint32_t *width, uint32_t *height);

/**
 * Returns the given framerate as a float.
 */
dc1394error_t dc1394_framerate_as_float(dc1394framerate_t framerate_enum, float *framerate);

/**
 * Returns the number of bits per pixel for a certain color coding. This is the size of the data sent on the bus, the effective
 * data depth may vary. Example: RGB16 is 16, YUV411 is 8, YUV422 is 8.
 */
dc1394error_t dc1394_get_color_coding_data_depth(dc1394color_coding_t color_coding, uint32_t * bits);

/**
 * Returns the bit-space used by a pixel. This is different from the data depth! For instance, RGB16 has a bit space of 48 bits,
 * YUV422 is 16bits and YU411 is 12bits. 
 */
dc1394error_t dc1394_get_color_coding_bit_size(dc1394color_coding_t color_coding, uint32_t* bits);

/**
 * Returns the color coding from the video mode. Works with scalable image formats too.
 */
dc1394error_t dc1394_get_color_coding_from_video_mode(dc1394camera_t *camera, dc1394video_mode_t video_mode, dc1394color_coding_t *color_coding);

/**
 * Tells whether the color mode is color or monochrome
 */
dc1394error_t dc1394_is_color(dc1394color_coding_t color_mode, dc1394bool_t *is_color);

/**
 * Tells whether the video mode is scalable or not.
 */
dc1394bool_t dc1394_is_video_mode_scalable(dc1394video_mode_t video_mode);

/**
 * Tells whether the video mode is "still image" or not ("still image" is currently not supported by any cameras on the market)
 */
dc1394bool_t dc1394_is_video_mode_still_image(dc1394video_mode_t video_mode);

/**
 * Tells whether two IDs refer to the same physical camera unit.
 */
dc1394bool_t dc1394_is_same_camera(dc1394camera_id_t id1, dc1394camera_id_t id2);

/**
 * Returns a descriptive name for a feature 
 */
const char * dc1394_feature_get_string(dc1394feature_t feature);

/**
 * Returns a descriptive string for an error code
 */
const char * dc1394_error_get_string(dc1394error_t error);

/**
 * Calculates the CRC16 checksum of a memory region. Useful to verify the CRC of an image buffer, for instance.
 */
uint16_t dc1394_checksum_crc16 (const uint8_t* buffer, uint32_t buffer_size);

#ifdef __cplusplus
}
#endif

#endif /* _DC1394_UTILS_H */