vidl2_pixel_format differs from vil_pixel_format in that the vidl2 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 vidl2_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 vidl2_pixel_format.h.
#include <vcl_string.h>
#include <vcl_cstddef.h>
#include <vcl_iosfwd.h>
#include <vxl_config.h>
Go to the source code of this file.
Classes | |
| struct | vidl2_pixel_traits |
| Traits of the pixel formats. More... | |
| struct | vidl2_pixel_limits< vxl_byte > |
| struct | vidl2_pixel_limits< bool > |
| struct | vidl2_pixel_limits< vxl_uint_16 > |
| struct | vidl2_pixel_limits< float > |
| struct | vidl2_pixel_limits< double > |
Defines | |
| #define | vidl2_ct_mac(COL, NC) |
| #define | vidl2_pt_mac(FMT, NAME, T, BPP, CLR, ARNG, XCS, YCS) |
| #define | vidl2_pp_mac(FMT) |
Enumerations | |
| enum | vidl2_pixel_format { VIDL2_PIXEL_FORMAT_UNKNOWN = -1, VIDL2_PIXEL_FORMAT_RGB_24, VIDL2_PIXEL_FORMAT_RGB_24P, VIDL2_PIXEL_FORMAT_BGR_24, VIDL2_PIXEL_FORMAT_RGBA_32, VIDL2_PIXEL_FORMAT_RGBA_32P, VIDL2_PIXEL_FORMAT_RGB_565, VIDL2_PIXEL_FORMAT_RGB_555, VIDL2_PIXEL_FORMAT_YUV_444P, VIDL2_PIXEL_FORMAT_YUV_422P, VIDL2_PIXEL_FORMAT_YUV_420P, VIDL2_PIXEL_FORMAT_YVU_420P, VIDL2_PIXEL_FORMAT_YUV_411P, VIDL2_PIXEL_FORMAT_YUV_410P, VIDL2_PIXEL_FORMAT_UYV_444, VIDL2_PIXEL_FORMAT_YUYV_422, VIDL2_PIXEL_FORMAT_UYVY_422, VIDL2_PIXEL_FORMAT_UYVY_411, VIDL2_PIXEL_FORMAT_MONO_1, VIDL2_PIXEL_FORMAT_MONO_8, VIDL2_PIXEL_FORMAT_MONO_16, VIDL2_PIXEL_FORMAT_ENUM_END } |
| Describes the format of pixel encoding in a video frame buffer. More... | |
| enum | vidl2_pixel_color { VIDL2_PIXEL_COLOR_UNKNOWN = -1, VIDL2_PIXEL_COLOR_MONO, VIDL2_PIXEL_COLOR_RGB, VIDL2_PIXEL_COLOR_RGBA, VIDL2_PIXEL_COLOR_YUV, VIDL2_PIXEL_COLOR_ENUM_END } |
| Describes the color encoding of a pixel format. More... | |
| enum | vidl2_pixel_arrangement { VIDL2_PIXEL_ARRANGE_UNKNOWN = -1, VIDL2_PIXEL_ARRANGE_SINGLE, VIDL2_PIXEL_ARRANGE_PACKED, VIDL2_PIXEL_ARRANGE_PLANAR, VIDL2_PIXEL_ARRANGE_PALETTE, VIDL2_PIXEL_ARRANGE_ENUM_END } |
| Describes the arrangement of pixels in a pixel format. More... | |
Functions | |
| vidl2_ct_mac (UNKNOWN, 0) | |
| vidl2_ct_mac (MONO, 1) | |
| vidl2_ct_mac (RGB, 3) | |
| vidl2_ct_mac (RGBA, 4) | |
| vidl2_ct_mac (YUV, 3) | |
| vidl2_pt_mac (UNKNOWN,"unknown", void, 0, UNKNOWN, UNKNOWN, 0, 0) | |
| vidl2_pt_mac (RGB_24,"RGB 24", vxl_byte, 24, RGB, SINGLE, 0, 0) | |
| vidl2_pt_mac (RGB_24P,"RGB 24P", vxl_byte, 24, RGB, PLANAR, 0, 0) | |
| vidl2_pt_mac (BGR_24,"BGR 24", vxl_byte, 24, RGB, SINGLE, 0, 0) | |
| vidl2_pt_mac (RGBA_32,"RGBA 32", vxl_byte, 32, RGBA, SINGLE, 0, 0) | |
| vidl2_pt_mac (RGBA_32P,"RGBA 32P", vxl_byte, 32, RGBA, PLANAR, 0, 0) | |
| vidl2_pt_mac (RGB_565,"RGB 565", vxl_byte, 16, RGB, SINGLE, 0, 0) | |
| vidl2_pt_mac (RGB_555,"RGB 555", vxl_byte, 16, RGB, SINGLE, 0, 0) | |
| vidl2_pt_mac (YUV_444P,"YUV 444P", vxl_byte, 24, YUV, PLANAR, 0, 0) | |
| vidl2_pt_mac (YUV_422P,"YUV 422P", vxl_byte, 16, YUV, PLANAR, 1, 0) | |
| vidl2_pt_mac (YUV_420P,"YUV 420P", vxl_byte, 12, YUV, PLANAR, 1, 1) | |
| vidl2_pt_mac (YVU_420P,"YVU 420P", vxl_byte, 12, YUV, PLANAR, 1, 1) | |
| vidl2_pt_mac (YUV_411P,"YUV 411P", vxl_byte, 12, YUV, PLANAR, 2, 0) | |
| vidl2_pt_mac (YUV_410P,"YUV 410P", vxl_byte, 10, YUV, PLANAR, 2, 1) | |
| vidl2_pt_mac (UYV_444,"UYV 444", vxl_byte, 24, YUV, SINGLE, 0, 0) | |
| vidl2_pt_mac (YUYV_422,"YUYV 422", vxl_byte, 16, YUV, PACKED, 1, 0) | |
| vidl2_pt_mac (UYVY_422,"UYVY 422", vxl_byte, 16, YUV, PACKED, 1, 0) | |
| vidl2_pt_mac (UYVY_411,"UYVY 411", vxl_byte, 12, YUV, PACKED, 2, 0) | |
| vidl2_pt_mac (MONO_1,"Mono 1", bool, 1, MONO, SINGLE, 0, 0) | |
| vidl2_pt_mac (MONO_8,"Mono 8", vxl_byte, 8, MONO, SINGLE, 0, 0) | |
| vidl2_pt_mac (MONO_16,"Mono 16", vxl_uint_16, 16, MONO, SINGLE, 0, 0) | |
| vidl2_pp_mac (YUYV_422) | |
| vidl2_pp_mac (UYVY_422) | |
| vidl2_pp_mac (UYVY_411) | |
| unsigned | vidl2_pixel_color_num_channels (vidl2_pixel_color c) |
| Return the number of channels needed in a color mode. | |
| vidl2_pixel_traits | vidl2_pixel_format_traits (vidl2_pixel_format f) |
| Return the set of traits for pixel format f. | |
| unsigned | vidl2_pixel_format_bpp (vidl2_pixel_format f) |
| Return the effective number of bits per image pixel in pixel format f. | |
| unsigned | vidl2_pixel_format_num_channels (vidl2_pixel_format f) |
| Return the number of color channels encoded in pixel format f. | |
| vidl2_pixel_color | vidl2_pixel_format_color (vidl2_pixel_format f) |
| Return the color encoding for the pixel format. | |
| vidl2_pixel_arrangement | vidl2_pixel_format_arrangement (vidl2_pixel_format f) |
| Return the pixel arrangement for a given format. | |
| unsigned | vidl2_pixel_format_chroma_shift_x (vidl2_pixel_format f) |
| Return the chroma shift in the horizontal direction. | |
| unsigned | vidl2_pixel_format_chroma_shift_y (vidl2_pixel_format f) |
| Return the chroma shift in the vertical direction. | |
| vcl_ostream & | operator<< (vcl_ostream &os, vidl2_pixel_format f) |
| Output a pretty string representing the pixel format. | |
| vcl_string | vidl2_pixel_format_to_string (vidl2_pixel_format f) |
| Convert a string into a pixel format. | |
| vidl2_pixel_format | vidl2_pixel_format_from_string (const vcl_string &s) |
| Convert a string into a pixel format. | |
| unsigned | vidl2_pixel_format_buffer_size (unsigned ni, unsigned nj, vidl2_pixel_format f) |
| Compute the size (in bytes) of a ni x nj image buffer of pixel format f. | |
|
|
Value: VCL_DEFINE_SPECIALIZATION \ struct vidl2_color_traits_of<VIDL2_PIXEL_COLOR_##COL> \ {\ enum { num_channels = NC }; \ } Definition at line 185 of file vidl2_pixel_format.h. |
|
|
Value: VCL_DEFINE_SPECIALIZATION \ struct vidl2_pixel_pack_of<VIDL2_PIXEL_FORMAT_##FMT> \ {\ enum { macro_pix_size = 1<<vidl2_pixel_traits_of<VIDL2_PIXEL_FORMAT_##FMT>::chroma_shift_x }; \ enum { num_channels = vidl2_pixel_traits_of<VIDL2_PIXEL_FORMAT_##FMT>::num_channels }; \ static const vcl_ptrdiff_t offset[macro_pix_size][num_channels]; \ } Definition at line 270 of file vidl2_pixel_format.h. |
|
|
Value: VCL_DEFINE_SPECIALIZATION \ struct vidl2_pixel_traits_of<VIDL2_PIXEL_FORMAT_##FMT> \ {\ static inline vcl_string name() { return NAME; }\ typedef T type;\ enum { bits_per_pixel = BPP };\ enum { num_channels = vidl2_color_traits_of<VIDL2_PIXEL_COLOR_##CLR>::num_channels };\ static inline vidl2_pixel_color color() { return VIDL2_PIXEL_COLOR_##CLR; }\ enum { color_idx = VIDL2_PIXEL_COLOR_##CLR };\ static inline vidl2_pixel_arrangement arrangement() { return VIDL2_PIXEL_ARRANGE_##ARNG; }\ enum { arrangement_idx = VIDL2_PIXEL_ARRANGE_##ARNG };\ enum { chroma_shift_x = XCS };\ enum { chroma_shift_y = YCS };\ } Definition at line 209 of file vidl2_pixel_format.h. |
|
|
Describes the arrangement of pixels in a pixel format.
Definition at line 100 of file vidl2_pixel_format.h. |
|
|
Describes the color encoding of a pixel format.
Definition at line 84 of file vidl2_pixel_format.h. |
|
|
Describes the format of pixel encoding in a video frame buffer.
Definition at line 50 of file vidl2_pixel_format.h. |
|
||||||||||||
|
Output a pretty string representing the pixel format.
Definition at line 123 of file vidl2_pixel_format.cxx. |
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
Return the number of channels needed in a color mode.
Definition at line 91 of file vidl2_pixel_format.cxx. |
|
|
Return the pixel arrangement for a given format.
Definition at line 329 of file vidl2_pixel_format.h. |
|
|
Return the effective number of bits per image pixel in pixel format f.
Definition at line 305 of file vidl2_pixel_format.h. |
|
||||||||||||||||
|
Compute the size (in bytes) of a ni x nj image buffer of pixel format f.
Definition at line 146 of file vidl2_pixel_format.cxx. |
|
|
Return the chroma shift in the horizontal direction.
Definition at line 337 of file vidl2_pixel_format.h. |
|
|
Return the chroma shift in the vertical direction.
Definition at line 345 of file vidl2_pixel_format.h. |
|
|
Return the color encoding for the pixel format.
Definition at line 321 of file vidl2_pixel_format.h. |
|
|
Convert a string into a pixel format. This uses the same encoding as operator<<. Definition at line 135 of file vidl2_pixel_format.cxx. |
|
|
Return the number of color channels encoded in pixel format f.
Definition at line 313 of file vidl2_pixel_format.h. |
|
|
Convert a string into a pixel format.
Definition at line 358 of file vidl2_pixel_format.h. |
|
|
Return the set of traits for pixel format f.
Definition at line 111 of file vidl2_pixel_format.cxx. |
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
1.4.4