FreeSWITCH API Documentation  1.7.0
Data Structures | Macros | Typedefs | Enumerations | Functions
switch_image.h File Reference

Describes the vpx image descriptor and associated operations. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vpx_image
 Image Descriptor. More...
 
struct  vpx_image_rect
 Representation of a rectangle on a surface. More...
 

Macros

#define VPX_IMAGE_ABI_VERSION
 Current ABI version number. More...
 
#define VPX_IMG_FMT_PLANAR   0x100
 
#define VPX_IMG_FMT_UV_FLIP   0x200
 
#define VPX_IMG_FMT_HAS_ALPHA   0x400
 
#define VPX_IMG_FMT_HIGHBITDEPTH   0x800
 
#define VPX_PLANE_PACKED   0
 
#define VPX_PLANE_Y   0
 
#define VPX_PLANE_U   1
 
#define VPX_PLANE_V   2
 
#define VPX_PLANE_ALPHA   3
 

Typedefs

typedef enum vpx_img_fmt vpx_img_fmt_t
 List of supported image formats. More...
 
typedef enum vpx_color_space vpx_color_space_t
 List of supported color spaces. More...
 
typedef enum vpx_color_range vpx_color_range_t
 List of supported color range. More...
 
typedef struct vpx_image vpx_image_t
 Image Descriptor. More...
 
typedef struct vpx_image_rect vpx_image_rect_t
 Representation of a rectangle on a surface. More...
 

Enumerations

enum  vpx_img_fmt {
  VPX_IMG_FMT_NONE, VPX_IMG_FMT_RGB24, VPX_IMG_FMT_RGB32, VPX_IMG_FMT_RGB565,
  VPX_IMG_FMT_RGB555, VPX_IMG_FMT_UYVY, VPX_IMG_FMT_YUY2, VPX_IMG_FMT_YVYU,
  VPX_IMG_FMT_BGR24, VPX_IMG_FMT_RGB32_LE, VPX_IMG_FMT_ARGB, VPX_IMG_FMT_ARGB_LE,
  VPX_IMG_FMT_RGB565_LE, VPX_IMG_FMT_RGB555_LE, VPX_IMG_FMT_YV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1, VPX_IMG_FMT_I420 = VPX_IMG_FMT_PLANAR | 2,
  VPX_IMG_FMT_VPXYV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 3, VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4, VPX_IMG_FMT_I422 = VPX_IMG_FMT_PLANAR | 5, VPX_IMG_FMT_I444 = VPX_IMG_FMT_PLANAR | 6,
  VPX_IMG_FMT_I440 = VPX_IMG_FMT_PLANAR | 7, VPX_IMG_FMT_444A = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_HAS_ALPHA | 6, VPX_IMG_FMT_I42016 = VPX_IMG_FMT_I420 | VPX_IMG_FMT_HIGHBITDEPTH, VPX_IMG_FMT_I42216 = VPX_IMG_FMT_I422 | VPX_IMG_FMT_HIGHBITDEPTH,
  VPX_IMG_FMT_I44416 = VPX_IMG_FMT_I444 | VPX_IMG_FMT_HIGHBITDEPTH, VPX_IMG_FMT_I44016 = VPX_IMG_FMT_I440 | VPX_IMG_FMT_HIGHBITDEPTH
}
 List of supported image formats. More...
 
enum  vpx_color_space {
  VPX_CS_UNKNOWN = 0, VPX_CS_BT_601 = 1, VPX_CS_BT_709 = 2, VPX_CS_SMPTE_170 = 3,
  VPX_CS_SMPTE_240 = 4, VPX_CS_BT_2020 = 5, VPX_CS_RESERVED = 6, VPX_CS_SRGB = 7
}
 List of supported color spaces. More...
 
enum  vpx_color_range { VPX_CR_STUDIO_RANGE = 0, VPX_CR_FULL_RANGE = 1 }
 List of supported color range. More...
 

Functions

vpx_image_tvpx_img_alloc (vpx_image_t *img, vpx_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align)
 Open a descriptor, allocating storage for the underlying image. More...
 
vpx_image_tvpx_img_wrap (vpx_image_t *img, vpx_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align, unsigned char *img_data)
 Open a descriptor, using existing storage for the underlying image. More...
 
int vpx_img_set_rect (vpx_image_t *img, unsigned int x, unsigned int y, unsigned int w, unsigned int h)
 Set the rectangle identifying the displayed portion of the image. More...
 
void vpx_img_flip (vpx_image_t *img)
 Flip the image vertically (top for bottom) More...
 
void vpx_img_free (vpx_image_t *img)
 Close an image descriptor. More...
 

Detailed Description

Describes the vpx image descriptor and associated operations.

Definition in file switch_image.h.

Macro Definition Documentation

#define VPX_IMAGE_ABI_VERSION

Current ABI version number.

Definition at line 31 of file switch_image.h.

#define VPX_IMG_FMT_HAS_ALPHA   0x400

Image has an alpha channel.

Definition at line 36 of file switch_image.h.

#define VPX_IMG_FMT_HIGHBITDEPTH   0x800

Image uses 16bit framebuffer.

Definition at line 37 of file switch_image.h.

#define VPX_IMG_FMT_PLANAR   0x100

Image is a planar format.

Definition at line 34 of file switch_image.h.

#define VPX_IMG_FMT_UV_FLIP   0x200

V plane precedes U in memory.

Definition at line 35 of file switch_image.h.

#define VPX_PLANE_ALPHA   3

A (Transparency) plane

Definition at line 115 of file switch_image.h.

#define VPX_PLANE_PACKED   0

To be used for all packed formats

Definition at line 111 of file switch_image.h.

#define VPX_PLANE_U   1

U (Chroma) plane

Definition at line 113 of file switch_image.h.

#define VPX_PLANE_V   2

V (Chroma) plane

Definition at line 114 of file switch_image.h.

#define VPX_PLANE_Y   0

Y (Luminance) plane

Definition at line 112 of file switch_image.h.

Typedef Documentation

List of supported color range.

alias for enum vpx_color_range

List of supported color spaces.

alias for enum vpx_color_space

Representation of a rectangle on a surface.

alias for struct vpx_image_rect

typedef struct vpx_image vpx_image_t

Image Descriptor.

alias for struct vpx_image

typedef enum vpx_img_fmt vpx_img_fmt_t

List of supported image formats.

alias for enum vpx_img_fmt

Enumeration Type Documentation

List of supported color range.

Enumerator
VPX_CR_STUDIO_RANGE 

Y [16..235], UV [16..240]

VPX_CR_FULL_RANGE 

YUV/RGB [0..255]

Definition at line 82 of file switch_image.h.

82  {
83  VPX_CR_STUDIO_RANGE = 0, /**< Y [16..235], UV [16..240] */
84  VPX_CR_FULL_RANGE = 1 /**< YUV/RGB [0..255] */
85  } vpx_color_range_t; /**< alias for enum vpx_color_range */
enum vpx_color_range vpx_color_range_t
List of supported color range.

List of supported color spaces.

Enumerator
VPX_CS_UNKNOWN 

Unknown

VPX_CS_BT_601 

BT.601

VPX_CS_BT_709 

BT.709

VPX_CS_SMPTE_170 

SMPTE.170

VPX_CS_SMPTE_240 

SMPTE.240

VPX_CS_BT_2020 

BT.2020

VPX_CS_RESERVED 

Reserved

VPX_CS_SRGB 

sRGB

Definition at line 70 of file switch_image.h.

70  {
71  VPX_CS_UNKNOWN = 0, /**< Unknown */
72  VPX_CS_BT_601 = 1, /**< BT.601 */
73  VPX_CS_BT_709 = 2, /**< BT.709 */
74  VPX_CS_SMPTE_170 = 3, /**< SMPTE.170 */
75  VPX_CS_SMPTE_240 = 4, /**< SMPTE.240 */
76  VPX_CS_BT_2020 = 5, /**< BT.2020 */
77  VPX_CS_RESERVED = 6, /**< Reserved */
78  VPX_CS_SRGB = 7 /**< sRGB */
79  } vpx_color_space_t; /**< alias for enum vpx_color_space */
enum vpx_color_space vpx_color_space_t
List of supported color spaces.

List of supported image formats.

Enumerator
VPX_IMG_FMT_NONE 
VPX_IMG_FMT_RGB24 

24 bit per pixel packed RGB

VPX_IMG_FMT_RGB32 

32 bit per pixel packed 0RGB

VPX_IMG_FMT_RGB565 

16 bit per pixel, 565

VPX_IMG_FMT_RGB555 

16 bit per pixel, 555

VPX_IMG_FMT_UYVY 

UYVY packed YUV

VPX_IMG_FMT_YUY2 

YUYV packed YUV

VPX_IMG_FMT_YVYU 

YVYU packed YUV

VPX_IMG_FMT_BGR24 

24 bit per pixel packed BGR

VPX_IMG_FMT_RGB32_LE 

32 bit packed BGR0

VPX_IMG_FMT_ARGB 

32 bit packed ARGB, alpha=255

VPX_IMG_FMT_ARGB_LE 

32 bit packed BGRA, alpha=255

VPX_IMG_FMT_RGB565_LE 

16 bit per pixel, gggbbbbb rrrrrggg

VPX_IMG_FMT_RGB555_LE 

16 bit per pixel, gggbbbbb 0rrrrrgg

VPX_IMG_FMT_YV12 

planar YVU

VPX_IMG_FMT_I420 
VPX_IMG_FMT_VPXYV12 
VPX_IMG_FMT_VPXI420 

< planar 4:2:0 format with vpx color space

VPX_IMG_FMT_I422 
VPX_IMG_FMT_I444 
VPX_IMG_FMT_I440 
VPX_IMG_FMT_444A 
VPX_IMG_FMT_I42016 
VPX_IMG_FMT_I42216 
VPX_IMG_FMT_I44416 
VPX_IMG_FMT_I44016 

Definition at line 40 of file switch_image.h.

40  {
42  VPX_IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
43  VPX_IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
44  VPX_IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
45  VPX_IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
46  VPX_IMG_FMT_UYVY, /**< UYVY packed YUV */
47  VPX_IMG_FMT_YUY2, /**< YUYV packed YUV */
48  VPX_IMG_FMT_YVYU, /**< YVYU packed YUV */
49  VPX_IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
50  VPX_IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
51  VPX_IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
52  VPX_IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
53  VPX_IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
54  VPX_IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
55  VPX_IMG_FMT_YV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1, /**< planar YVU */
57  VPX_IMG_FMT_VPXYV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 3, /** < planar 4:2:0 format with vpx color space */
67  } vpx_img_fmt_t; /**< alias for enum vpx_img_fmt */
#define VPX_IMG_FMT_PLANAR
Definition: switch_image.h:34
#define VPX_IMG_FMT_HAS_ALPHA
Definition: switch_image.h:36
#define VPX_IMG_FMT_HIGHBITDEPTH
Definition: switch_image.h:37
enum vpx_img_fmt vpx_img_fmt_t
List of supported image formats.
#define VPX_IMG_FMT_UV_FLIP
Definition: switch_image.h:35

Function Documentation

vpx_image_t* vpx_img_alloc ( vpx_image_t img,
vpx_img_fmt_t  fmt,
unsigned int  d_w,
unsigned int  d_h,
unsigned int  align 
)

Open a descriptor, allocating storage for the underlying image.

Returns a descriptor for storing an image of the given format. The storage for the descriptor is allocated on the heap.

Parameters
[in]imgPointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap.
[in]fmtFormat for the image
[in]d_wWidth of the image
[in]d_hHeight of the image
[in]alignAlignment, in bytes, of the image buffer and each row in the image(stride).
Returns
Returns a pointer to the initialized image descriptor. If the img parameter is non-null, the value of the img parameter will be returned.

Referenced by switch_img_alloc().

void vpx_img_flip ( vpx_image_t img)

Flip the image vertically (top for bottom)

Adjusts the image descriptor's pointers and strides to make the image be referenced upside-down.

Parameters
[in]imgImage descriptor
void vpx_img_free ( vpx_image_t img)

Close an image descriptor.

Frees all allocated storage associated with an image descriptor.

Parameters
[in]imgImage descriptor

Referenced by switch_img_free().

int vpx_img_set_rect ( vpx_image_t img,
unsigned int  x,
unsigned int  y,
unsigned int  w,
unsigned int  h 
)

Set the rectangle identifying the displayed portion of the image.

Updates the displayed rectangle (aka viewport) on the image surface to match the specified coordinates and size.

Parameters
[in]imgImage descriptor
[in]xleftmost column
[in]ytopmost row
[in]wwidth
[in]hheight
Returns
0 if the requested rectangle is valid, nonzero otherwise.

Referenced by switch_img_set_rect().

vpx_image_t* vpx_img_wrap ( vpx_image_t img,
vpx_img_fmt_t  fmt,
unsigned int  d_w,
unsigned int  d_h,
unsigned int  align,
unsigned char *  img_data 
)

Open a descriptor, using existing storage for the underlying image.

Returns a descriptor for storing an image of the given format. The storage for descriptor has been allocated elsewhere, and a descriptor is desired to "wrap" that storage.

Parameters
[in]imgPointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap.
[in]fmtFormat for the image
[in]d_wWidth of the image
[in]d_hHeight of the image
[in]alignAlignment, in bytes, of each row in the image.
[in]img_dataStorage to use for the image
Returns
Returns a pointer to the initialized image descriptor. If the img parameter is non-null, the value of the img parameter will be returned.

Referenced by switch_img_copy_rect(), switch_img_patch_rect(), and switch_img_wrap().