// copy or use the software.
//
//
-// Intel License Agreement
+// License Agreement
// For Open Source Computer Vision Library
//
-// Copyright (C) 2000, Intel Corporation, all rights reserved.
+// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
+// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
-// * The name of Intel Corporation may not be used to endorse or promote products
+// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
//
//M*/
-#ifndef _CXCORE_TYPES_H_
-#define _CXCORE_TYPES_H_
+#ifndef __OPENCV_CORE_TYPES_H__
+#define __OPENCV_CORE_TYPES_H__
+
+#if !defined _CRT_SECURE_NO_DEPRECATE && _MSC_VER > 1300
+#define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */
+#endif
+
#ifndef SKIP_INCLUDES
#include <assert.h>
#include <string.h>
#include <float.h>
+#if !defined _MSC_VER && !defined __BORLANDC__
+ #include <stdint.h>
+#endif
+
#if defined __ICL
#define CV_ICC __ICL
#elif defined __ICC
#define CV_ICC __ECL
#elif defined __ECC
#define CV_ICC __ECC
+ #elif defined __INTEL_COMPILER
+ #define CV_ICC __INTEL_COMPILER
#endif
- #if defined WIN64 && defined EM64T && (defined _MSC_VER || defined CV_ICC) \
- || defined __SSE2__ || defined _MM_SHUFFLE2
+ #if (_MSC_VER >= 1400 && defined _M_X64) || (__GNUC__ >= 4 && defined __x86_64__)
+ #if defined WIN64
+ #include <intrin.h>
+ #endif
#include <emmintrin.h>
- #define CV_SSE2 1
- #else
- #define CV_SSE2 0
#endif
#if defined __BORLANDC__
#include <fastmath.h>
- #elif defined WIN64 && !defined EM64T && defined CV_ICC
- #include <mathimf.h>
#else
#include <math.h>
#endif
#ifdef HAVE_IPL
#ifndef __IPL_H__
- #if defined WIN32 || defined WIN64
+ #if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
#include <ipl.h>
#else
#include <ipl/ipl.h>
#endif
#endif // SKIP_INCLUDES
-#if defined WIN32 || defined WIN64
+#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64
#define CV_CDECL __cdecl
#define CV_STDCALL __stdcall
#else
#ifndef CV_INLINE
#if defined __cplusplus
#define CV_INLINE inline
-#elif (defined WIN32 || defined WIN64) && !defined __GNUC__
+#elif (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 || defined WINCE) && !defined __GNUC__
#define CV_INLINE __inline
#else
#define CV_INLINE static
#endif
#endif /* CV_INLINE */
-#if (defined WIN32 || defined WIN64) && defined CVAPI_EXPORTS
+#if (defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64 || defined WINCE) && defined CVAPI_EXPORTS
#define CV_EXPORTS __declspec(dllexport)
#else
#define CV_EXPORTS
typedef __int64 int64;
typedef unsigned __int64 uint64;
#else
-typedef long long int64;
-typedef unsigned long long uint64;
+typedef int64_t int64;
+typedef uint64_t uint64;
#endif
#ifndef HAVE_IPL
typedef unsigned short ushort;
#endif
-/* CvArr* is used to pass arbitrary array-like data structures
- into the functions where the particular
- array type is recognized at runtime */
+typedef signed char schar;
+
+/* CvArr* is used to pass arbitrary
+ * array-like data structures
+ * into functions where the particular
+ * array type is recognized at runtime:
+ */
typedef void CvArr;
typedef union Cv32suf
CV_INLINE int cvRound( double value )
{
-#if CV_SSE2
- __m128d t = _mm_load_sd( &value );
+#if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && !defined __APPLE__)
+ __m128d t = _mm_set_sd( value );
return _mm_cvtsd_si32(t);
-#elif defined WIN32 && !defined WIN64 && defined _MSC_VER
+#elif defined _MSC_VER && defined _M_IX86
int t;
__asm
{
fistp t;
}
return t;
-#elif (defined HAVE_LRINT) || (defined WIN64 && !defined EM64T && defined CV_ICC)
+#elif defined HAVE_LRINT || defined CV_ICC || defined __GNUC__
return (int)lrint(value);
#else
- /*
- the algorithm was taken from Agner Fog's optimization guide
- at http://www.agner.org/assem
- */
- Cv64suf temp;
- temp.f = value + 6755399441055744.0;
- return (int)temp.u;
+ // while this is not IEEE754-compliant rounding, it's usually a good enough approximation
+ return (int)(value + (value >= 0 ? 0.5 : -0.5));
#endif
}
CV_INLINE int cvFloor( double value )
{
-#if CV_SSE2
- __m128d t = _mm_load_sd( &value );
+#ifdef __GNUC__
+ int i = (int)value;
+ return i - (i > value);
+#elif defined _MSC_VER && defined _M_X64
+ __m128d t = _mm_set_sd( value );
int i = _mm_cvtsd_si32(t);
- return i - _mm_movemask_pd(_mm_cmplt_sd(t,_mm_cvtsi32_sd(t,i)));
+ return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i)));
#else
- int temp = cvRound(value);
+ int i = cvRound(value);
Cv32suf diff;
- diff.f = (float)(value - temp);
- return temp - (diff.i < 0);
+ diff.f = (float)(value - i);
+ return i - (diff.i < 0);
#endif
}
CV_INLINE int cvCeil( double value )
{
-#if CV_SSE2
- __m128d t = _mm_load_sd( &value );
+#ifdef __GNUC__
+ int i = (int)value;
+ return i + (i < value);
+#elif defined _MSC_VER && defined _M_X64
+ __m128d t = _mm_set_sd( value );
int i = _mm_cvtsd_si32(t);
- return i + _mm_movemask_pd(_mm_cmpgt_sd(t,_mm_cvtsi32_sd(t,i)));
+ return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t));
#else
- int temp = cvRound(value);
+ int i = cvRound(value);
Cv32suf diff;
- diff.f = (float)(temp - value);
- return temp + (diff.i < 0);
+ diff.f = (float)(i - value);
+ return i + (diff.i < 0);
#endif
}
CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1))
{
- CvRNG rng = (uint64)(seed ? seed : (int64)-1);
+ CvRNG rng = seed ? (uint64)seed : (uint64)(int64)-1;
return rng;
}
-/* returns random 32-bit unsigned integer */
+/* Return random 32-bit unsigned integer: */
CV_INLINE unsigned cvRandInt( CvRNG* rng )
{
uint64 temp = *rng;
- temp = (uint64)(unsigned)temp*1554115554 + (temp >> 32);
+ temp = (uint64)(unsigned)temp*4164903690U + (temp >> 32);
*rng = temp;
return (unsigned)temp;
}
-/* returns random floating-point number between 0 and 1 */
+/* Returns random floating-point number between 0 and 1: */
CV_INLINE double cvRandReal( CvRNG* rng )
{
return cvRandInt(rng)*2.3283064365386962890625e-10 /* 2^-32 */;
typedef struct _IplImage
{
- int nSize; /* sizeof(IplImage) */
- int ID; /* version (=0)*/
- int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */
- int alphaChannel; /* ignored by OpenCV */
- int depth; /* pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
- IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported */
- char colorModel[4]; /* ignored by OpenCV */
- char channelSeq[4]; /* ditto */
- int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels.
- cvCreateImage can only create interleaved images */
- int origin; /* 0 - top-left origin,
- 1 - bottom-left origin (Windows bitmaps style) */
- int align; /* Alignment of image rows (4 or 8).
- OpenCV ignores it and uses widthStep instead */
- int width; /* image width in pixels */
- int height; /* image height in pixels */
- struct _IplROI *roi;/* image ROI. if NULL, the whole image is selected */
- struct _IplImage *maskROI; /* must be NULL */
- void *imageId; /* ditto */
- struct _IplTileInfo *tileInfo; /* ditto */
- int imageSize; /* image data size in bytes
- (==image->height*image->widthStep
- in case of interleaved data)*/
- char *imageData; /* pointer to aligned image data */
- int widthStep; /* size of aligned image row in bytes */
- int BorderMode[4]; /* ignored by OpenCV */
- int BorderConst[4]; /* ditto */
- char *imageDataOrigin; /* pointer to very origin of image data
- (not necessarily aligned) -
- needed for correct deallocation */
+ int nSize; /* sizeof(IplImage) */
+ int ID; /* version (=0)*/
+ int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */
+ int alphaChannel; /* Ignored by OpenCV */
+ int depth; /* Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
+ IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported. */
+ char colorModel[4]; /* Ignored by OpenCV */
+ char channelSeq[4]; /* ditto */
+ int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels.
+ cvCreateImage can only create interleaved images */
+ int origin; /* 0 - top-left origin,
+ 1 - bottom-left origin (Windows bitmaps style). */
+ int align; /* Alignment of image rows (4 or 8).
+ OpenCV ignores it and uses widthStep instead. */
+ int width; /* Image width in pixels. */
+ int height; /* Image height in pixels. */
+ struct _IplROI *roi; /* Image ROI. If NULL, the whole image is selected. */
+ struct _IplImage *maskROI; /* Must be NULL. */
+ void *imageId; /* " " */
+ struct _IplTileInfo *tileInfo; /* " " */
+ int imageSize; /* Image data size in bytes
+ (==image->height*image->widthStep
+ in case of interleaved data)*/
+ char *imageData; /* Pointer to aligned image data. */
+ int widthStep; /* Size of aligned image row in bytes. */
+ int BorderMode[4]; /* Ignored by OpenCV. */
+ int BorderConst[4]; /* Ditto. */
+ char *imageDataOrigin; /* Pointer to very origin of image data
+ (not necessarily aligned) -
+ needed for correct deallocation */
}
IplImage;
#define CV_64F 6
#define CV_USRTYPE1 7
-#define CV_MAKETYPE(depth,cn) ((depth) + (((cn)-1) << CV_CN_SHIFT))
+#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
+#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
+
+#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
#define CV_MAKE_TYPE CV_MAKETYPE
#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT)
#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
-#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
-#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
#define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
#define CV_MAT_TYPE(flags) ((flags) & CV_MAT_TYPE_MASK)
#define CV_MAT_CONT_FLAG_SHIFT 14
#define CV_IS_MAT_HDR(mat) \
- ((mat) != NULL && (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL)
+ ((mat) != NULL && \
+ (((const CvMat*)(mat))->type & CV_MAGIC_MASK) == CV_MAT_MAGIC_VAL && \
+ ((const CvMat*)(mat))->cols > 0 && ((const CvMat*)(mat))->rows > 0)
#define CV_IS_MAT(mat) \
(CV_IS_MAT_HDR(mat) && ((const CvMat*)(mat))->data.ptr != NULL)
((((mat1)->type ^ (mat2)->type) & CV_MAT_DEPTH_MASK) == 0)
#define CV_ARE_SIZES_EQ(mat1, mat2) \
- ((mat1)->height == (mat2)->height && (mat1)->width == (mat2)->width)
+ ((mat1)->rows == (mat2)->rows && (mat1)->cols == (mat2)->cols)
#define CV_IS_MAT_CONST(mat) \
- (((mat)->height|(mat)->width) == 1)
+ (((mat)->rows|(mat)->cols) == 1)
-/* size of each channel item,
+/* Size of each channel item,
0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */
#define CV_ELEM_SIZE1(type) \
((((sizeof(size_t)<<28)|0x8442211) >> CV_MAT_DEPTH(type)*4) & 15)
#define CV_ELEM_SIZE(type) \
(CV_MAT_CN(type) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> CV_MAT_DEPTH(type)*2) & 3))
-/* inline constructor. No data is allocated internally!!!
- (use together with cvCreateData, or use cvCreateMat instead to
- get a matrix with allocated data) */
+#define IPL2CV_DEPTH(depth) \
+ ((((CV_8U)+(CV_16U<<4)+(CV_32F<<8)+(CV_64F<<16)+(CV_8S<<20)+ \
+ (CV_16S<<24)+(CV_32S<<28)) >> ((((depth) & 0xF0) >> 2) + \
+ (((depth) & IPL_DEPTH_SIGN) ? 20 : 0))) & 15)
+
+/* Inline constructor. No data is allocated internally!!!
+ * (Use together with cvCreateData, or use cvCreateMat instead to
+ * get a matrix with allocated data):
+ */
CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL))
{
CvMat m;
m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type;
m.cols = cols;
m.rows = rows;
- m.step = rows > 1 ? m.cols*CV_ELEM_SIZE(type) : 0;
+ m.step = m.cols*CV_ELEM_SIZE(type);
m.data.ptr = (uchar*)data;
m.refcount = NULL;
m.hdr_refcount = 0;
}
-CV_INLINE int cvCvToIplDepth( int type )
+CV_INLINE int cvIplDepth( int type )
{
int depth = CV_MAT_DEPTH(type);
return CV_ELEM_SIZE1(depth)*8 | (depth == CV_8S || depth == CV_16S ||
{
int type;
CvArr* bins;
- float thresh[CV_MAX_DIM][2]; /* for uniform histograms */
- float** thresh2; /* for non-uniform histograms */
- CvMatND mat; /* embedded matrix header for array histograms */
+ float thresh[CV_MAX_DIM][2]; /* For uniform histograms. */
+ float** thresh2; /* For non-uniform histograms. */
+ CvMatND mat; /* Embedded matrix header for array histograms. */
}
CvHistogram;
typedef struct CvBox2D
{
- CvPoint2D32f center; /* center of the box */
- CvSize2D32f size; /* box width and length */
- float angle; /* angle between the horizontal axis
- and the first side (i.e. length) in radians */
+ CvPoint2D32f center; /* Center of the box. */
+ CvSize2D32f size; /* Box width and length. */
+ float angle; /* Angle between the horizontal axis */
+ /* and the first side (i.e. length) in degrees */
}
CvBox2D;
-/* Line iterator state */
+/* Line iterator state: */
typedef struct CvLineIterator
{
- /* pointer to the current point */
+ /* Pointer to the current point: */
uchar* ptr;
- /* Bresenham algorithm state */
+ /* Bresenham algorithm state: */
int err;
int plus_delta;
int minus_delta;
typedef struct CvMemStorage
{
int signature;
- CvMemBlock* bottom;/* first allocated block */
- CvMemBlock* top; /* current memory block - top of the stack */
- struct CvMemStorage* parent; /* borrows new blocks from */
- int block_size; /* block size */
- int free_space; /* free space in the current block */
+ CvMemBlock* bottom; /* First allocated block. */
+ CvMemBlock* top; /* Current memory block - top of the stack. */
+ struct CvMemStorage* parent; /* We get new blocks from parent as needed. */
+ int block_size; /* Block size. */
+ int free_space; /* Remaining free space in current block. */
}
CvMemStorage;
typedef struct CvSeqBlock
{
- struct CvSeqBlock* prev; /* previous sequence block */
- struct CvSeqBlock* next; /* next sequence block */
- int start_index; /* index of the first element in the block +
- sequence->first->start_index */
- int count; /* number of elements in the block */
- char* data; /* pointer to the first element of the block */
+ struct CvSeqBlock* prev; /* Previous sequence block. */
+ struct CvSeqBlock* next; /* Next sequence block. */
+ int start_index; /* Index of the first element in the block + */
+ /* sequence->first->start_index. */
+ int count; /* Number of elements in the block. */
+ schar* data; /* Pointer to the first element of the block. */
}
CvSeqBlock;
-#define CV_TREE_NODE_FIELDS(node_type) \
- int flags; /* micsellaneous flags */ \
- int header_size; /* size of sequence header */ \
- struct node_type* h_prev; /* previous sequence */ \
- struct node_type* h_next; /* next sequence */ \
- struct node_type* v_prev; /* 2nd previous sequence */ \
- struct node_type* v_next /* 2nd next sequence */
+#define CV_TREE_NODE_FIELDS(node_type) \
+ int flags; /* Miscellaneous flags. */ \
+ int header_size; /* Size of sequence header. */ \
+ struct node_type* h_prev; /* Previous sequence. */ \
+ struct node_type* h_next; /* Next sequence. */ \
+ struct node_type* v_prev; /* 2nd previous sequence. */ \
+ struct node_type* v_next /* 2nd next sequence. */
/*
Read/Write sequence.
Elements can be dynamically inserted to or deleted from the sequence.
*/
-#define CV_SEQUENCE_FIELDS() \
- CV_TREE_NODE_FIELDS(CvSeq); \
- int total; /* total number of elements */ \
- int elem_size; /* size of sequence element in bytes */ \
- char* block_max; /* maximal bound of the last block */ \
- char* ptr; /* current write pointer */ \
- int delta_elems; /* how many elements allocated when the seq grows */ \
- CvMemStorage* storage; /* where the seq is stored */ \
- CvSeqBlock* free_blocks; /* free blocks list */ \
- CvSeqBlock* first; /* pointer to the first sequence block */
+#define CV_SEQUENCE_FIELDS() \
+ CV_TREE_NODE_FIELDS(CvSeq); \
+ int total; /* Total number of elements. */ \
+ int elem_size; /* Size of sequence element in bytes. */ \
+ schar* block_max; /* Maximal bound of the last block. */ \
+ schar* ptr; /* Current write pointer. */ \
+ int delta_elems; /* Grow seq this many at a time. */ \
+ CvMemStorage* storage; /* Where the seq is stored. */ \
+ CvSeqBlock* free_blocks; /* Free blocks list. */ \
+ CvSeqBlock* first; /* Pointer to the first sequence block. */
typedef struct CvSeq
{
/************************************* Graph ********************************************/
/*
- Graph is represented as a set of vertices.
+ We represent a graph as a set of vertices.
Vertices contain their adjacency lists (more exactly, pointers to first incoming or
outcoming edge (or 0 if isolated vertex)). Edges are stored in another set.
- There is a single-linked list of incoming/outcoming edges for each vertex.
+ There is a singly-linked list of incoming/outcoming edges for each vertex.
+
+ Each edge consists of
+
+ o Two pointers to the starting and ending vertices
+ (vtx[0] and vtx[1] respectively).
- Each edge consists of:
- two pointers to the starting and the ending vertices (vtx[0] and vtx[1],
- respectively). Graph may be oriented or not. In the second case, edges between
- vertex i to vertex j are not distingueshed (during the search operations).
+ A graph may be oriented or not. In the latter case, edges between
+ vertex i to vertex j are not distinguished during search operations.
- two pointers to next edges for the starting and the ending vertices.
- next[0] points to the next edge in the vtx[0] adjacency list and
- next[1] points to the next edge in the vtx[1] adjacency list.
+ o Two pointers to next edges for the starting and ending vertices, where
+ next[0] points to the next edge in the vtx[0] adjacency list and
+ next[1] points to the next edge in the vtx[1] adjacency list.
*/
#define CV_GRAPH_EDGE_FIELDS() \
int flags; \
int header_size; \
CvSeq* seq; /* the sequence written */ \
CvSeqBlock* block; /* current block */ \
- char* ptr; /* pointer to free space */ \
- char* block_min; /* pointer to the beginning of block*/\
- char* block_max; /* pointer to the end of block */
+ schar* ptr; /* pointer to free space */ \
+ schar* block_min; /* pointer to the beginning of block*/\
+ schar* block_max; /* pointer to the end of block */
typedef struct CvSeqWriter
{
int header_size; \
CvSeq* seq; /* sequence, beign read */ \
CvSeqBlock* block; /* current block */ \
- char* ptr; /* pointer to element be read next */ \
- char* block_min; /* pointer to the beginning of block */\
- char* block_max; /* pointer to the end of block */ \
+ schar* ptr; /* pointer to element be read next */ \
+ schar* block_min; /* pointer to the beginning of block */\
+ schar* block_max; /* pointer to the end of block */ \
int delta_index;/* = seq->first->start_index */ \
- char* prev_elem; /* pointer to previous element */
+ schar* prev_elem; /* pointer to previous element */
typedef struct CvSeqReader
cvGetSeqElem( (CvSeq*)(seq), (index) )))
#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )
-/* macro that adds element to sequence */
+/* Add element to sequence: */
#define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer ) \
{ \
if( (writer).ptr >= (writer).block_max ) \
}
-/* move reader position forward */
+/* Move reader position forward: */
#define CV_NEXT_SEQ_ELEM( elem_size, reader ) \
{ \
if( ((reader).ptr += (elem_size)) >= (reader).block_max ) \
}
-/* move reader position backward */
+/* Move reader position backward: */
#define CV_PREV_SEQ_ELEM( elem_size, reader ) \
{ \
if( ((reader).ptr -= (elem_size)) < (reader).block_min ) \
} \
}
-/* read element and move read position forward */
+/* Read element and move read position forward: */
#define CV_READ_SEQ_ELEM( elem, reader ) \
{ \
assert( (reader).seq->elem_size == sizeof(elem)); \
CV_NEXT_SEQ_ELEM( sizeof(elem), reader ) \
}
-/* read element and move read position backward */
+/* Read element and move read position backward: */
#define CV_REV_READ_SEQ_ELEM( elem, reader ) \
{ \
assert( (reader).seq->elem_size == sizeof(elem)); \
/************ Graph macros ************/
-/* returns next graph edge for given vertex */
+/* Return next graph edge for given vertex: */
#define CV_NEXT_GRAPH_EDGE( edge, vertex ) \
(assert((edge)->vtx[0] == (vertex) || (edge)->vtx[1] == (vertex)), \
(edge)->next[(edge)->vtx[1] == (vertex)])
/* "black box" file storage */
typedef struct CvFileStorage CvFileStorage;
-/* storage flags */
+/* Storage flags: */
#define CV_STORAGE_READ 0
#define CV_STORAGE_WRITE 1
#define CV_STORAGE_WRITE_TEXT CV_STORAGE_WRITE
#define CV_STORAGE_WRITE_BINARY CV_STORAGE_WRITE
#define CV_STORAGE_APPEND 2
-/* list of attributes */
+/* List of attributes: */
typedef struct CvAttrList
{
- const char** attr; /* NULL-terminated array of (attribute_name,attribute_value) pairs */
- struct CvAttrList* next; /* pointer to next chunk of the attributes list */
+ const char** attr; /* NULL-terminated array of (attribute_name,attribute_value) pairs. */
+ struct CvAttrList* next; /* Pointer to next chunk of the attributes list. */
}
CvAttrList;
#define CV_NODE_TYPE(flags) ((flags) & CV_NODE_TYPE_MASK)
/* file node flags */
-#define CV_NODE_FLOW 8 /* used only for writing structures to YAML format */
+#define CV_NODE_FLOW 8 /* Used only for writing structures in YAML format. */
#define CV_NODE_USER 16
#define CV_NODE_EMPTY 32
#define CV_NODE_NAMED 64
}
CvString;
-/* all the keys (names) of elements in the readed file storage
- are stored in the hash to speed up the lookup operations */
+/* All the keys (names) of elements in the readed file storage
+ are stored in the hash to speed up the lookup operations: */
typedef struct CvStringHashNode
{
unsigned hashval;
typedef struct CvGenericHash CvFileNodeHash;
-/* basic element of the file storage - scalar or collection */
+/* Basic element of the file storage - scalar or collection: */
typedef struct CvFileNode
{
int tag;