libdc1394: API version 2: Conversions

enum {
  DC1394_BYTE_ORDER_UYVY=0,
  DC1394_BYTE_ORDER_YUYV
};

enum {
  DC1394_BAYER_METHOD_NEAREST=0,
  DC1394_BAYER_METHOD_SIMPLE,
  DC1394_BAYER_METHOD_BILINEAR,
  DC1394_BAYER_METHOD_HQLINEAR,
  DC1394_BAYER_METHOD_DOWNSAMPLE,
  DC1394_BAYER_METHOD_EDGESENSE,
  DC1394_BAYER_METHOD_VNG,
  DC1394_BAYER_METHOD_AHD
};
#define DC1394_BAYER_METHOD_MIN      DC1394_BAYER_METHOD_NEAREST
#define DC1394_BAYER_METHOD_MAX      DC1394_BAYER_METHOD_AHD
#define DC1394_BAYER_METHOD_NUM     (DC1394_BAYER_METHOD_MAX-DC1394_BAYER_METHOD_MIN+1)

typedef enum {
  DC1394_STEREO_METHOD_INTERLACED=0,
  DC1394_STEREO_METHOD_FIELD
} dc1394stereo_method_t;
#define DC1394_STEREO_METHOD_MIN     DC1394_STEREO_METHOD_INTERLACE
#define DC1394_STEREO_METHOD_MAX     DC1394_STEREO_METHOD_FIELD
#define DC1394_STEREO_METHOD_NUM    (DC1394_STEREO_METHOD_MAX-DC1394_STEREO_METHOD_MIN+1)

#define YUV2RGB(y, u, v, r, g, b)\
  r = y + ((v*1436) >> 10);\
  g = y - ((u*352 + v*731) >> 10);\
  b = y + ((u*1814) >> 10);\
  r = r < 0 ? 0 : r;\
  g = g < 0 ? 0 : g;\
  b = b < 0 ? 0 : b;\
  r = r > 255 ? 255 : r;\
  g = g > 255 ? 255 : g;\
  b = b > 255 ? 255 : b
  

#define RGB2YUV(r, g, b, y, u, v)\
  y = (306*r + 601*g + 117*b)  >> 10;\
  u = ((-172*r - 340*g + 512*b) >> 10)  + 128;\
  v = ((512*r - 429*g - 83*b) >> 10) + 128;\
  y = y < 0 ? 0 : y;\
  u = u < 0 ? 0 : u;\
  v = v < 0 ? 0 : v;\
  y = y > 255 ? 255 : y;\
  u = u > 255 ? 255 : u;\
  v = v > 255 ? 255 : v


dc1394_convert_to_MONO8()

Arguments:
:src:A pointer to the source image buffer
:dest:A pointer to the destination image buffer
uint_t:width:the width of the image
uint_t:height:the height of the image
uint_t:byte_order:the input/output byte order (for YUV422 only)
dc1394color_coding_t:source_coding:color coding of the source buffer
uint_t:bits:number of bits (useful for 16 bits formats only)
Returns:   dc1394error_t (error code)

dc1394_convert_to_RGB8()

Arguments:
:src:A pointer to the source image buffer
:dest:A pointer to the destination image buffer
uint_t:width:the width of the image
uint_t:height:the height of the image
uint_t:byte_order:the input/output byte order (for YUV422 only)
dc1394color_coding_t:source_coding:color coding of the source buffer
uint_t:bits:number of bits (useful for 16 bits formats only)
Returns:   dc1394error_t (error code)

dc1394_convert_to_YUV422()

Arguments:
:src:A pointer to the source image buffer
:dest:A pointer to the destination image buffer
uint_t:width:the width of the image
uint_t:height:the height of the image
uint_t:byte_order:the input/output byte order (for YUV422 only)
dc1394color_coding_t:source_coding:color coding of the source buffer
uint_t:bits:number of bits (useful for 16 bits formats only)
Returns:   dc1394error_t (error code)

dc1394_deinterlace_stereo()

Arguments:
:src:A pointer to the source image buffer
:dest:A pointer to the destination image buffer
uint_t:width:the width of the image
uint_t:height:the height of the image
Returns:   (nothing)

dc1394_bayer_decoding_8bit()

Arguments:
:bayer:A pointer to the source image buffer
:rgb:A pointer to the destination image buffer
uint_t:width:the width of the image
uint_t:height:the height of the image
dc1394color_filter_t:tile:Elementary bayer coding tile (DC1394_COLOR_FILTER_RGGB,...)
dc1394bayer_method_t:method:Bayer decoding method (DC1394_BAYER_METHOD_BILINEAR,...)
Returns:   dc1394error_t (error code)

dc1394_bayer_decoding_16bit()

Arguments:
:bayer:A pointer to the source image buffer
:rgb:A pointer to the destination image buffer
uint_t:width:the width of the image
uint_t:height:the height of the image
dc1394color_filter_t:tile:Elementary bayer coding tile (DC1394_COLOR_FILTER_RGGB,...)
dc1394bayer_method_t:method:Bayer decoding method (DC1394_BAYER_METHOD_BILINEAR,...)
uint_t:bits:Number of effective bits per pixel
Returns:   dc1394error_t (error code)

The following functions are more practical and work directly on frames:


dc1394_convert_frames()

Arguments:
dc1394video_frame_t:*in:
dc1394video_frame_t:*out:
Returns:   dc1394error_t (error code)

dc1394_debayer_frames()

Arguments:
dc1394video_frame_t:*in:
dc1394video_frame_t:*out:
dc1394bayer_method_t:method:
Returns:   dc1394error_t (error code)

dc1394_deinterlace_stereo_frames()

Arguments:
dc1394video_frame_t:*in:
dc1394video_frame_t:*out:
dc1394stereo_method_t:method:
Returns:   dc1394error_t (error code)