WebM Codec SDK

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

vpx_image.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11
16 #ifndef VPX_VPX_IMAGE_H_
17 #define VPX_VPX_IMAGE_H_
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
31 #define VPX_IMAGE_ABI_VERSION (3)
34 #define VPX_IMG_FMT_PLANAR 0x100
35 #define VPX_IMG_FMT_UV_FLIP 0x200
36 #define VPX_IMG_FMT_HAS_ALPHA 0x400
37 #define VPX_IMG_FMT_HIGHBITDEPTH 0x800
40 typedef enum vpx_img_fmt {
41 VPX_IMG_FMT_NONE,
42 VPX_IMG_FMT_RGB24,
43 VPX_IMG_FMT_RGB32,
44 VPX_IMG_FMT_RGB565,
45 VPX_IMG_FMT_RGB555,
46 VPX_IMG_FMT_UYVY,
47 VPX_IMG_FMT_YUY2,
48 VPX_IMG_FMT_YVYU,
49 VPX_IMG_FMT_BGR24,
50 VPX_IMG_FMT_RGB32_LE,
51 VPX_IMG_FMT_ARGB,
52 VPX_IMG_FMT_ARGB_LE,
53 VPX_IMG_FMT_RGB565_LE,
54 VPX_IMG_FMT_RGB555_LE,
55 VPX_IMG_FMT_YV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1,
56 VPX_IMG_FMT_I420 = VPX_IMG_FMT_PLANAR | 2,
57 VPX_IMG_FMT_VPXYV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 3,
58 VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4,
59 VPX_IMG_FMT_I422 = VPX_IMG_FMT_PLANAR | 5,
60 VPX_IMG_FMT_I444 = VPX_IMG_FMT_PLANAR | 6,
61 VPX_IMG_FMT_I440 = VPX_IMG_FMT_PLANAR | 7,
62 VPX_IMG_FMT_444A = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_HAS_ALPHA | 6,
63 VPX_IMG_FMT_I42016 = VPX_IMG_FMT_I420 | VPX_IMG_FMT_HIGHBITDEPTH,
64 VPX_IMG_FMT_I42216 = VPX_IMG_FMT_I422 | VPX_IMG_FMT_HIGHBITDEPTH,
65 VPX_IMG_FMT_I44416 = VPX_IMG_FMT_I444 | VPX_IMG_FMT_HIGHBITDEPTH,
66 VPX_IMG_FMT_I44016 = VPX_IMG_FMT_I440 | VPX_IMG_FMT_HIGHBITDEPTH
67 } vpx_img_fmt_t;
70 typedef enum vpx_color_space {
71 VPX_CS_UNKNOWN = 0,
72 VPX_CS_BT_601 = 1,
73 VPX_CS_BT_709 = 2,
74 VPX_CS_SMPTE_170 = 3,
75 VPX_CS_SMPTE_240 = 4,
76 VPX_CS_BT_2020 = 5,
77 VPX_CS_RESERVED = 6,
78 VPX_CS_SRGB = 7
79 } vpx_color_space_t;
82 typedef struct vpx_image {
83 vpx_img_fmt_t fmt;
84 vpx_color_space_t cs;
86 /* Image storage dimensions */
87 unsigned int w;
88 unsigned int h;
89 unsigned int bit_depth;
91 /* Image display dimensions */
92 unsigned int d_w;
93 unsigned int d_h;
95 /* Chroma subsampling info */
96 unsigned int x_chroma_shift;
97 unsigned int y_chroma_shift;
99 /* Image data pointers. */
100 #define VPX_PLANE_PACKED 0
101 #define VPX_PLANE_Y 0
102 #define VPX_PLANE_U 1
103 #define VPX_PLANE_V 2
104 #define VPX_PLANE_ALPHA 3
105 unsigned char *planes[4];
106 int stride[4];
108 int bps;
110 /* The following member may be set by the application to associate data
111 * with this image.
112 */
113 void *user_priv;
116 /* The following members should be treated as private. */
117 unsigned char *img_data;
118 int img_data_owner;
119 int self_allocd;
121 void *fb_priv;
122 } vpx_image_t;
125 typedef struct vpx_image_rect {
126 unsigned int x;
127 unsigned int y;
128 unsigned int w;
129 unsigned int h;
130 } vpx_image_rect_t;
150 vpx_image_t *vpx_img_alloc(vpx_image_t *img,
151 vpx_img_fmt_t fmt,
152 unsigned int d_w,
153 unsigned int d_h,
154 unsigned int align);
155
175 vpx_image_t *vpx_img_wrap(vpx_image_t *img,
176 vpx_img_fmt_t fmt,
177 unsigned int d_w,
178 unsigned int d_h,
179 unsigned int align,
180 unsigned char *img_data);
181
182
196 int vpx_img_set_rect(vpx_image_t *img,
197 unsigned int x,
198 unsigned int y,
199 unsigned int w,
200 unsigned int h);
201
202
210 void vpx_img_flip(vpx_image_t *img);
211
218 void vpx_img_free(vpx_image_t *img);
219
220 #ifdef __cplusplus
221 } // extern "C"
222 #endif
223
224 #endif // VPX_VPX_IMAGE_H_
VPX_IMG_FMT_I44016
Definition: vpx_image.h:66
vpx_color_space
vpx_color_space
List of supported color spaces.
Definition: vpx_image.h:70
VPX_IMG_FMT_UYVY
Definition: vpx_image.h:46
vpx_image
Image Descriptor.
Definition: vpx_image.h:82
VPX_IMG_FMT_444A
Definition: vpx_image.h:62
VPX_CS_BT_709
Definition: vpx_image.h:73
VPX_IMG_FMT_VPXI420
Definition: vpx_image.h:58
vpx_image_rect::x
unsigned int x
Definition: vpx_image.h:126
VPX_IMG_FMT_YV12
Definition: vpx_image.h:55
vpx_image::self_allocd
int self_allocd
Definition: vpx_image.h:119
VPX_CS_RESERVED
Definition: vpx_image.h:77
VPX_IMG_FMT_PLANAR
#define VPX_IMG_FMT_PLANAR
Definition: vpx_image.h:34
VPX_IMG_FMT_UV_FLIP
#define VPX_IMG_FMT_UV_FLIP
Definition: vpx_image.h:35
vpx_image::img_data_owner
int img_data_owner
Definition: vpx_image.h:118
VPX_IMG_FMT_RGB555
Definition: vpx_image.h:45
VPX_CS_SRGB
Definition: vpx_image.h:78
VPX_CS_SMPTE_240
Definition: vpx_image.h:75
vpx_image::bit_depth
unsigned int bit_depth
Definition: vpx_image.h:89
vpx_img_set_rect
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.
vpx_image::fb_priv
void * fb_priv
Definition: vpx_image.h:121
vpx_image::y_chroma_shift
unsigned int y_chroma_shift
Definition: vpx_image.h:97
vpx_image::x_chroma_shift
unsigned int x_chroma_shift
Definition: vpx_image.h:96
VPX_IMG_FMT_HIGHBITDEPTH
#define VPX_IMG_FMT_HIGHBITDEPTH
Definition: vpx_image.h:37
VPX_IMG_FMT_RGB565_LE
Definition: vpx_image.h:53
vpx_image_rect::y
unsigned int y
Definition: vpx_image.h:127
VPX_IMG_FMT_RGB555_LE
Definition: vpx_image.h:54
vpx_image_rect
Representation of a rectangle on a surface.
Definition: vpx_image.h:125
VPX_IMG_FMT_I44416
Definition: vpx_image.h:65
vpx_img_alloc
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.
VPX_IMG_FMT_I420
Definition: vpx_image.h:56
vpx_image_rect::h
unsigned int h
Definition: vpx_image.h:129
vpx_image::d_w
unsigned int d_w
Definition: vpx_image.h:92
VPX_IMG_FMT_I42216
Definition: vpx_image.h:64
VPX_IMG_FMT_ARGB
Definition: vpx_image.h:51
vpx_color_space_t
enum vpx_color_space vpx_color_space_t
List of supported color spaces.
vpx_img_fmt_t
enum vpx_img_fmt vpx_img_fmt_t
List of supported image formats.
VPX_IMG_FMT_YUY2
Definition: vpx_image.h:47
VPX_CS_SMPTE_170
Definition: vpx_image.h:74
vpx_img_free
void vpx_img_free(vpx_image_t *img)
Close an image descriptor.
vpx_image::fmt
vpx_img_fmt_t fmt
Definition: vpx_image.h:83
VPX_IMG_FMT_I422
Definition: vpx_image.h:59
VPX_CS_BT_601
Definition: vpx_image.h:72
vpx_image::img_data
unsigned char * img_data
Definition: vpx_image.h:117
vpx_img_flip
void vpx_img_flip(vpx_image_t *img)
Flip the image vertically (top for bottom)
VPX_IMG_FMT_RGB32
Definition: vpx_image.h:43
vpx_image::h
unsigned int h
Definition: vpx_image.h:88
VPX_IMG_FMT_VPXYV12
Definition: vpx_image.h:57
vpx_img_wrap
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.
VPX_IMG_FMT_I42016
Definition: vpx_image.h:63
vpx_image_rect::w
unsigned int w
Definition: vpx_image.h:128
vpx_image::cs
vpx_color_space_t cs
Definition: vpx_image.h:84
VPX_IMG_FMT_I444
Definition: vpx_image.h:60
vpx_image_t
struct vpx_image vpx_image_t
Image Descriptor.
vpx_image_rect_t
struct vpx_image_rect vpx_image_rect_t
Representation of a rectangle on a surface.
VPX_IMG_FMT_BGR24
Definition: vpx_image.h:49
VPX_IMG_FMT_YVYU
Definition: vpx_image.h:48
VPX_IMG_FMT_HAS_ALPHA
#define VPX_IMG_FMT_HAS_ALPHA
Definition: vpx_image.h:36
vpx_image::user_priv
void * user_priv
Definition: vpx_image.h:113
vpx_image::d_h
unsigned int d_h
Definition: vpx_image.h:93
VPX_CS_UNKNOWN
Definition: vpx_image.h:71
VPX_IMG_FMT_ARGB_LE
Definition: vpx_image.h:52
VPX_IMG_FMT_RGB32_LE
Definition: vpx_image.h:50
vpx_image::w
unsigned int w
Definition: vpx_image.h:87
VPX_IMG_FMT_RGB565
Definition: vpx_image.h:44
VPX_IMG_FMT_RGB24
Definition: vpx_image.h:42
VPX_CS_BT_2020
Definition: vpx_image.h:76
VPX_IMG_FMT_I440
Definition: vpx_image.h:61