Supported pixel formats for video frames. More...
#include <vcl_string.h>
#include <vcl_cstddef.h>
#include <vcl_iosfwd.h>
#include <vcl_typeinfo.h>
#include <vxl_config.h>
Go to the source code of this file.
Classes | |
struct | vidl_pixel_traits |
Traits of the pixel formats. More... | |
struct | vidl_pixel_limits< vxl_byte > |
struct | vidl_pixel_limits< bool > |
struct | vidl_pixel_limits< vxl_uint_16 > |
struct | vidl_pixel_limits< float > |
struct | vidl_pixel_limits< double > |
Defines | |
#define | vidl_ct_mac(COL, NC) |
#define | vidl_pt_mac(FMT, NAME, T, BPP, CLR, ARNG, XCS, YCS) |
#define | vidl_pp_mac(FMT) |
Enumerations | |
enum | vidl_pixel_format { VIDL_PIXEL_FORMAT_UNKNOWN = -1, VIDL_PIXEL_FORMAT_RGB_24, VIDL_PIXEL_FORMAT_RGB_24P, VIDL_PIXEL_FORMAT_BGR_24, VIDL_PIXEL_FORMAT_RGBA_32, VIDL_PIXEL_FORMAT_RGBA_32P, VIDL_PIXEL_FORMAT_RGB_565, VIDL_PIXEL_FORMAT_RGB_555, VIDL_PIXEL_FORMAT_YUV_444P, VIDL_PIXEL_FORMAT_YUV_422P, VIDL_PIXEL_FORMAT_YUV_420P, VIDL_PIXEL_FORMAT_YVU_420P, VIDL_PIXEL_FORMAT_YUV_411P, VIDL_PIXEL_FORMAT_YUV_410P, VIDL_PIXEL_FORMAT_UYV_444, VIDL_PIXEL_FORMAT_YUYV_422, VIDL_PIXEL_FORMAT_UYVY_422, VIDL_PIXEL_FORMAT_UYVY_411, VIDL_PIXEL_FORMAT_MONO_1, VIDL_PIXEL_FORMAT_MONO_8, VIDL_PIXEL_FORMAT_MONO_16, VIDL_PIXEL_FORMAT_MONO_F32, VIDL_PIXEL_FORMAT_RGB_F32, VIDL_PIXEL_FORMAT_RGB_F32P, VIDL_PIXEL_FORMAT_ENUM_END } |
Describes the format of pixel encoding in a video frame buffer. More... | |
enum | vidl_pixel_color { VIDL_PIXEL_COLOR_UNKNOWN = -1, VIDL_PIXEL_COLOR_MONO, VIDL_PIXEL_COLOR_RGB, VIDL_PIXEL_COLOR_RGBA, VIDL_PIXEL_COLOR_YUV, VIDL_PIXEL_COLOR_ENUM_END } |
Describes the color encoding of a pixel format. More... | |
enum | vidl_pixel_arrangement { VIDL_PIXEL_ARRANGE_UNKNOWN = -1, VIDL_PIXEL_ARRANGE_SINGLE, VIDL_PIXEL_ARRANGE_PACKED, VIDL_PIXEL_ARRANGE_PLANAR, VIDL_PIXEL_ARRANGE_PALETTE, VIDL_PIXEL_ARRANGE_ENUM_END } |
Describes the arrangement of pixels in a pixel format. More... | |
Functions | |
vidl_ct_mac (UNKNOWN, 0) | |
vidl_ct_mac (MONO, 1) | |
vidl_ct_mac (RGB, 3) | |
vidl_ct_mac (RGBA, 4) | |
vidl_ct_mac (YUV, 3) | |
vidl_pt_mac (UNKNOWN,"unknown", void, 0, UNKNOWN, UNKNOWN, 0, 0) | |
vidl_pt_mac (RGB_24,"RGB 24", vxl_byte, 24, RGB, SINGLE, 0, 0) | |
vidl_pt_mac (RGB_24P,"RGB 24P", vxl_byte, 24, RGB, PLANAR, 0, 0) | |
vidl_pt_mac (BGR_24,"BGR 24", vxl_byte, 24, RGB, SINGLE, 0, 0) | |
vidl_pt_mac (RGBA_32,"RGBA 32", vxl_byte, 32, RGBA, SINGLE, 0, 0) | |
vidl_pt_mac (RGBA_32P,"RGBA 32P", vxl_byte, 32, RGBA, PLANAR, 0, 0) | |
vidl_pt_mac (RGB_565,"RGB 565", vxl_byte, 16, RGB, SINGLE, 0, 0) | |
vidl_pt_mac (RGB_555,"RGB 555", vxl_byte, 16, RGB, SINGLE, 0, 0) | |
vidl_pt_mac (YUV_444P,"YUV 444P", vxl_byte, 24, YUV, PLANAR, 0, 0) | |
vidl_pt_mac (YUV_422P,"YUV 422P", vxl_byte, 16, YUV, PLANAR, 1, 0) | |
vidl_pt_mac (YUV_420P,"YUV 420P", vxl_byte, 12, YUV, PLANAR, 1, 1) | |
vidl_pt_mac (YVU_420P,"YVU 420P", vxl_byte, 12, YUV, PLANAR, 1, 1) | |
vidl_pt_mac (YUV_411P,"YUV 411P", vxl_byte, 12, YUV, PLANAR, 2, 0) | |
vidl_pt_mac (YUV_410P,"YUV 410P", vxl_byte, 10, YUV, PLANAR, 2, 1) | |
vidl_pt_mac (UYV_444,"UYV 444", vxl_byte, 24, YUV, SINGLE, 0, 0) | |
vidl_pt_mac (YUYV_422,"YUYV 422", vxl_byte, 16, YUV, PACKED, 1, 0) | |
vidl_pt_mac (UYVY_422,"UYVY 422", vxl_byte, 16, YUV, PACKED, 1, 0) | |
vidl_pt_mac (UYVY_411,"UYVY 411", vxl_byte, 12, YUV, PACKED, 2, 0) | |
vidl_pt_mac (MONO_1,"Mono 1", bool, 1, MONO, SINGLE, 0, 0) | |
vidl_pt_mac (MONO_8,"Mono 8", vxl_byte, 8, MONO, SINGLE, 0, 0) | |
vidl_pt_mac (MONO_16,"Mono 16", vxl_uint_16, 16, MONO, SINGLE, 0, 0) | |
vidl_pt_mac (MONO_F32,"Mono float 32", vxl_ieee_32, 32, MONO, SINGLE, 0, 0) | |
vidl_pt_mac (RGB_F32,"RGB float 32", vxl_ieee_32, 96, RGB, SINGLE, 0, 0) | |
vidl_pt_mac (RGB_F32P,"RGB float 32P", vxl_ieee_32, 96, RGB, PLANAR, 0, 0) | |
vidl_pp_mac (YUYV_422) | |
vidl_pp_mac (UYVY_422) | |
vidl_pp_mac (UYVY_411) | |
unsigned | vidl_pixel_color_num_channels (vidl_pixel_color c) |
Return the number of channels needed in a color mode. | |
vidl_pixel_traits | vidl_pixel_format_traits (vidl_pixel_format f) |
Return the set of traits for pixel format f. | |
const vcl_type_info & | vidl_pixel_format_typeid (vidl_pixel_format f) |
Return the typeid of the pixel format datatype. | |
unsigned | vidl_pixel_format_bpp (vidl_pixel_format f) |
Return the effective number of bits per image pixel in pixel format f. | |
unsigned | vidl_pixel_format_num_channels (vidl_pixel_format f) |
Return the number of color channels encoded in pixel format f. | |
vidl_pixel_color | vidl_pixel_format_color (vidl_pixel_format f) |
Return the color encoding for the pixel format. | |
vidl_pixel_arrangement | vidl_pixel_format_arrangement (vidl_pixel_format f) |
Return the pixel arrangement for a given format. | |
unsigned | vidl_pixel_format_chroma_shift_x (vidl_pixel_format f) |
Return the chroma shift in the horizontal direction. | |
unsigned | vidl_pixel_format_chroma_shift_y (vidl_pixel_format f) |
Return the chroma shift in the vertical direction. | |
vcl_ostream & | operator<< (vcl_ostream &os, vidl_pixel_format f) |
Output a pretty string representing the pixel format. | |
vcl_string | vidl_pixel_format_to_string (vidl_pixel_format f) |
Convert a string into a pixel format. | |
vidl_pixel_format | vidl_pixel_format_from_string (const vcl_string &s) |
Convert a string into a pixel format. | |
unsigned | vidl_pixel_format_buffer_size (unsigned ni, unsigned nj, vidl_pixel_format f) |
Compute the size (in bytes) of a ni x nj image buffer of pixel format f. |
Supported pixel formats for video frames.
This file defines the set of known video frame pixel formats. The enum vidl_pixel_format enumerates the types while the template specializations of vidl_pixel_traits define their basic traits. These specializations are defined using the macro vidl_pt_mac. The pixel traits are:
vidl_pixel_format differs from vil_pixel_format in that the vidl formats are representations typically used by video hardware and in video codecs to encode a frame. The vil pixel formats are more useful for image processing and are related to the C++ data types that may be arranged in a regular array to make an image. A vidl_pixel_format may have components in multiple planes of different sizes or may have data from multiple image pixels encoded as a single macro pixel.
This file also contains several functions to check the traits of a pixel format at runtime. These functions use template metaprogramming to generate conditionals that probe the formats defined in this file. So you don't need to modify these functions when you add a new pixel format into this header file.
Definition in file vidl_pixel_format.h.
#define vidl_ct_mac | ( | COL, | |
NC | |||
) |
VCL_DEFINE_SPECIALIZATION \ struct vidl_color_traits_of<VIDL_PIXEL_COLOR_##COL> \ {\ enum { num_channels = NC }; \ }
Definition at line 197 of file vidl_pixel_format.h.
#define vidl_pp_mac | ( | FMT | ) |
VCL_DEFINE_SPECIALIZATION \
struct vidl_pixel_pack_of<VIDL_PIXEL_FORMAT_##FMT> \
{\
enum { macro_pix_size = 1<<vidl_pixel_traits_of<VIDL_PIXEL_FORMAT_##FMT>::chroma_shift_x }; \
enum { num_channels = vidl_pixel_traits_of<VIDL_PIXEL_FORMAT_##FMT>::num_channels }; \
static const vcl_ptrdiff_t offset[macro_pix_size][num_channels]; \
}
Definition at line 285 of file vidl_pixel_format.h.
#define vidl_pt_mac | ( | FMT, | |
NAME, | |||
T, | |||
BPP, | |||
CLR, | |||
ARNG, | |||
XCS, | |||
YCS | |||
) |
VCL_DEFINE_SPECIALIZATION \ struct vidl_pixel_traits_of<VIDL_PIXEL_FORMAT_##FMT> \ {\ static inline vcl_string name() { return NAME; }\ typedef T type;\ enum { bits_per_pixel = BPP };\ enum { num_channels = vidl_color_traits_of<VIDL_PIXEL_COLOR_##CLR>::num_channels };\ static inline vidl_pixel_color color() { return VIDL_PIXEL_COLOR_##CLR; }\ enum { color_idx = VIDL_PIXEL_COLOR_##CLR };\ static inline vidl_pixel_arrangement arrangement() { return VIDL_PIXEL_ARRANGE_##ARNG; }\ enum { arrangement_idx = VIDL_PIXEL_ARRANGE_##ARNG };\ enum { chroma_shift_x = XCS };\ enum { chroma_shift_y = YCS };\ }
Definition at line 221 of file vidl_pixel_format.h.
Describes the arrangement of pixels in a pixel format.
VIDL_PIXEL_ARRANGE_UNKNOWN | |
VIDL_PIXEL_ARRANGE_SINGLE | |
VIDL_PIXEL_ARRANGE_PACKED | |
VIDL_PIXEL_ARRANGE_PLANAR | |
VIDL_PIXEL_ARRANGE_PALETTE | |
VIDL_PIXEL_ARRANGE_ENUM_END |
Definition at line 103 of file vidl_pixel_format.h.
enum vidl_pixel_color |
Describes the color encoding of a pixel format.
VIDL_PIXEL_COLOR_UNKNOWN | |
VIDL_PIXEL_COLOR_MONO | |
VIDL_PIXEL_COLOR_RGB | |
VIDL_PIXEL_COLOR_RGBA | |
VIDL_PIXEL_COLOR_YUV | |
VIDL_PIXEL_COLOR_ENUM_END |
Definition at line 87 of file vidl_pixel_format.h.
enum vidl_pixel_format |
Describes the format of pixel encoding in a video frame buffer.
Definition at line 51 of file vidl_pixel_format.h.
vcl_ostream& operator<< | ( | vcl_ostream & | os, |
vidl_pixel_format | f | ||
) |
Output a pretty string representing the pixel format.
Definition at line 125 of file vidl_pixel_format.cxx.
vidl_ct_mac | ( | UNKNOWN | , |
0 | |||
) |
vidl_ct_mac | ( | MONO | , |
1 | |||
) |
vidl_ct_mac | ( | RGB | , |
3 | |||
) |
vidl_ct_mac | ( | RGBA | , |
4 | |||
) |
vidl_ct_mac | ( | YUV | , |
3 | |||
) |
unsigned vidl_pixel_color_num_channels | ( | vidl_pixel_color | c | ) |
Return the number of channels needed in a color mode.
Definition at line 93 of file vidl_pixel_format.cxx.
vidl_pixel_arrangement vidl_pixel_format_arrangement | ( | vidl_pixel_format | f | ) | [inline] |
Return the pixel arrangement for a given format.
Definition at line 351 of file vidl_pixel_format.h.
unsigned vidl_pixel_format_bpp | ( | vidl_pixel_format | f | ) | [inline] |
Return the effective number of bits per image pixel in pixel format f.
Definition at line 327 of file vidl_pixel_format.h.
unsigned vidl_pixel_format_buffer_size | ( | unsigned | ni, |
unsigned | nj, | ||
vidl_pixel_format | f | ||
) |
Compute the size (in bytes) of a ni x nj image buffer of pixel format f.
Definition at line 148 of file vidl_pixel_format.cxx.
unsigned vidl_pixel_format_chroma_shift_x | ( | vidl_pixel_format | f | ) | [inline] |
Return the chroma shift in the horizontal direction.
Definition at line 359 of file vidl_pixel_format.h.
unsigned vidl_pixel_format_chroma_shift_y | ( | vidl_pixel_format | f | ) | [inline] |
Return the chroma shift in the vertical direction.
Definition at line 367 of file vidl_pixel_format.h.
vidl_pixel_color vidl_pixel_format_color | ( | vidl_pixel_format | f | ) | [inline] |
Return the color encoding for the pixel format.
Definition at line 343 of file vidl_pixel_format.h.
vidl_pixel_format vidl_pixel_format_from_string | ( | const vcl_string & | s | ) |
Convert a string into a pixel format.
This uses the same encoding as operator<<.
Definition at line 137 of file vidl_pixel_format.cxx.
unsigned vidl_pixel_format_num_channels | ( | vidl_pixel_format | f | ) | [inline] |
Return the number of color channels encoded in pixel format f.
Definition at line 335 of file vidl_pixel_format.h.
vcl_string vidl_pixel_format_to_string | ( | vidl_pixel_format | f | ) | [inline] |
Convert a string into a pixel format.
Definition at line 380 of file vidl_pixel_format.h.
vidl_pixel_traits vidl_pixel_format_traits | ( | vidl_pixel_format | f | ) |
Return the set of traits for pixel format f.
Definition at line 113 of file vidl_pixel_format.cxx.
const vcl_type_info& vidl_pixel_format_typeid | ( | vidl_pixel_format | f | ) | [inline] |
Return the typeid of the pixel format datatype.
Definition at line 320 of file vidl_pixel_format.h.
vidl_pp_mac | ( | YUYV_422 | ) |
vidl_pp_mac | ( | UYVY_422 | ) |
vidl_pp_mac | ( | UYVY_411 | ) |
vidl_pt_mac | ( | UNKNOWN | , |
"unknown" | , | ||
void | , | ||
0 | , | ||
UNKNOWN | , | ||
UNKNOWN | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | RGB_24 | , |
"RGB 24" | , | ||
vxl_byte | , | ||
24 | , | ||
RGB | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | RGB_24P | , |
"RGB 24P" | , | ||
vxl_byte | , | ||
24 | , | ||
RGB | , | ||
PLANAR | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | BGR_24 | , |
"BGR 24" | , | ||
vxl_byte | , | ||
24 | , | ||
RGB | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | RGBA_32 | , |
"RGBA 32" | , | ||
vxl_byte | , | ||
32 | , | ||
RGBA | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | RGBA_32P | , |
"RGBA 32P" | , | ||
vxl_byte | , | ||
32 | , | ||
RGBA | , | ||
PLANAR | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | RGB_565 | , |
"RGB 565" | , | ||
vxl_byte | , | ||
16 | , | ||
RGB | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | RGB_555 | , |
"RGB 555" | , | ||
vxl_byte | , | ||
16 | , | ||
RGB | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | YUV_444P | , |
"YUV 444P" | , | ||
vxl_byte | , | ||
24 | , | ||
YUV | , | ||
PLANAR | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | YUV_422P | , |
"YUV 422P" | , | ||
vxl_byte | , | ||
16 | , | ||
YUV | , | ||
PLANAR | , | ||
1 | , | ||
0 | |||
) |
vidl_pt_mac | ( | YUV_420P | , |
"YUV 420P" | , | ||
vxl_byte | , | ||
12 | , | ||
YUV | , | ||
PLANAR | , | ||
1 | , | ||
1 | |||
) |
vidl_pt_mac | ( | YVU_420P | , |
"YVU 420P" | , | ||
vxl_byte | , | ||
12 | , | ||
YUV | , | ||
PLANAR | , | ||
1 | , | ||
1 | |||
) |
vidl_pt_mac | ( | YUV_411P | , |
"YUV 411P" | , | ||
vxl_byte | , | ||
12 | , | ||
YUV | , | ||
PLANAR | , | ||
2 | , | ||
0 | |||
) |
vidl_pt_mac | ( | YUV_410P | , |
"YUV 410P" | , | ||
vxl_byte | , | ||
10 | , | ||
YUV | , | ||
PLANAR | , | ||
2 | , | ||
1 | |||
) |
vidl_pt_mac | ( | UYV_444 | , |
"UYV 444" | , | ||
vxl_byte | , | ||
24 | , | ||
YUV | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | YUYV_422 | , |
"YUYV 422" | , | ||
vxl_byte | , | ||
16 | , | ||
YUV | , | ||
PACKED | , | ||
1 | , | ||
0 | |||
) |
vidl_pt_mac | ( | UYVY_422 | , |
"UYVY 422" | , | ||
vxl_byte | , | ||
16 | , | ||
YUV | , | ||
PACKED | , | ||
1 | , | ||
0 | |||
) |
vidl_pt_mac | ( | UYVY_411 | , |
"UYVY 411" | , | ||
vxl_byte | , | ||
12 | , | ||
YUV | , | ||
PACKED | , | ||
2 | , | ||
0 | |||
) |
vidl_pt_mac | ( | MONO_1 | , |
"Mono 1" | , | ||
bool | , | ||
1 | , | ||
MONO | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | MONO_8 | , |
"Mono 8" | , | ||
vxl_byte | , | ||
8 | , | ||
MONO | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | MONO_16 | , |
"Mono 16" | , | ||
vxl_uint_16 | , | ||
16 | , | ||
MONO | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | MONO_F32 | , |
"Mono float 32" | , | ||
vxl_ieee_32 | , | ||
32 | , | ||
MONO | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | RGB_F32 | , |
"RGB float 32" | , | ||
vxl_ieee_32 | , | ||
96 | , | ||
RGB | , | ||
SINGLE | , | ||
0 | , | ||
0 | |||
) |
vidl_pt_mac | ( | RGB_F32P | , |
"RGB float 32P" | , | ||
vxl_ieee_32 | , | ||
96 | , | ||
RGB | , | ||
PLANAR | , | ||
0 | , | ||
0 | |||
) |