WebM VP8 Codec SDK: vpx/vpx_image.h Source File

WebM VP8 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 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 #ifndef VPX_IMAGE_H
21 #define VPX_IMAGE_H
22
31 #define VPX_IMAGE_ABI_VERSION (1)
34 #define VPX_IMG_FMT_PLANAR 0x100
35 #define VPX_IMG_FMT_UV_FLIP 0x200
36 #define VPX_IMG_FMT_HAS_ALPHA 0x400
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_444A = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_HAS_ALPHA | 7
62 } vpx_img_fmt_t;
64 #if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
65 #define IMG_FMT_PLANAR VPX_IMG_FMT_PLANAR
66 #define IMG_FMT_UV_FLIP VPX_IMG_FMT_UV_FLIP
67 #define IMG_FMT_HAS_ALPHA VPX_IMG_FMT_HAS_ALPHA
72 #define img_fmt vpx_img_fmt
73
76 #define img_fmt_t vpx_img_fmt_t
77
78 #define IMG_FMT_NONE VPX_IMG_FMT_NONE
79 #define IMG_FMT_RGB24 VPX_IMG_FMT_RGB24
80 #define IMG_FMT_RGB32 VPX_IMG_FMT_RGB32
81 #define IMG_FMT_RGB565 VPX_IMG_FMT_RGB565
82 #define IMG_FMT_RGB555 VPX_IMG_FMT_RGB555
83 #define IMG_FMT_UYVY VPX_IMG_FMT_UYVY
84 #define IMG_FMT_YUY2 VPX_IMG_FMT_YUY2
85 #define IMG_FMT_YVYU VPX_IMG_FMT_YVYU
86 #define IMG_FMT_BGR24 VPX_IMG_FMT_BGR24
87 #define IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE
88 #define IMG_FMT_ARGB VPX_IMG_FMT_ARGB
89 #define IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE
90 #define IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE
91 #define IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE
92 #define IMG_FMT_YV12 VPX_IMG_FMT_YV12
93 #define IMG_FMT_I420 VPX_IMG_FMT_I420
94 #define IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12
95 #define IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420
96 #endif /* VPX_CODEC_DISABLE_COMPAT */
97
99 typedef struct vpx_image {
100 vpx_img_fmt_t fmt;
102 /* Image storage dimensions */
103 unsigned int w;
104 unsigned int h;
106 /* Image display dimensions */
107 unsigned int d_w;
108 unsigned int d_h;
110 /* Chroma subsampling info */
111 unsigned int x_chroma_shift;
112 unsigned int y_chroma_shift;
114 /* Image data pointers. */
115 #define VPX_PLANE_PACKED 0
116 #define VPX_PLANE_Y 0
117 #define VPX_PLANE_U 1
118 #define VPX_PLANE_V 2
119 #define VPX_PLANE_ALPHA 3
120 #if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
121 #define PLANE_PACKED VPX_PLANE_PACKED
122 #define PLANE_Y VPX_PLANE_Y
123 #define PLANE_U VPX_PLANE_U
124 #define PLANE_V VPX_PLANE_V
125 #define PLANE_ALPHA VPX_PLANE_ALPHA
126 #endif
127 unsigned char *planes[4];
128 int stride[4];
130 int bps;
132 /* The following member may be set by the application to associate data
133 * with this image.
134 */
135 void *user_priv;
138 /* The following members should be treated as private. */
139 unsigned char *img_data;
140 int img_data_owner;
141 int self_allocd;
142 } vpx_image_t;
145 typedef struct vpx_image_rect {
146 unsigned int x;
147 unsigned int y;
148 unsigned int w;
149 unsigned int h;
150 } vpx_image_rect_t;
170 vpx_image_t *vpx_img_alloc(vpx_image_t *img,
171 vpx_img_fmt_t fmt,
172 unsigned int d_w,
173 unsigned int d_h,
174 unsigned int align);
175
195 vpx_image_t *vpx_img_wrap(vpx_image_t *img,
196 vpx_img_fmt_t fmt,
197 unsigned int d_w,
198 unsigned int d_h,
199 unsigned int align,
200 unsigned char *img_data);
201
202
216 int vpx_img_set_rect(vpx_image_t *img,
217 unsigned int x,
218 unsigned int y,
219 unsigned int w,
220 unsigned int h);
221
222
230 void vpx_img_flip(vpx_image_t *img);
231
238 void vpx_img_free(vpx_image_t *img);
239
240 #endif
241 #ifdef __cplusplus
242 }
243 #endif
VPX_IMG_FMT_UYVY
Definition: vpx_image.h:46
vpx_image
Image Descriptor.
Definition: vpx_image.h:99
VPX_IMG_FMT_444A
Definition: vpx_image.h:61
VPX_IMG_FMT_VPXI420
Definition: vpx_image.h:58
vpx_image_rect::x
unsigned int x
Definition: vpx_image.h:146
VPX_IMG_FMT_YV12
Definition: vpx_image.h:55
vpx_image::self_allocd
int self_allocd
Definition: vpx_image.h:141
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:140
VPX_IMG_FMT_RGB555
Definition: vpx_image.h:45
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::bps
int bps
Definition: vpx_image.h:130
vpx_image::y_chroma_shift
unsigned int y_chroma_shift
Definition: vpx_image.h:112
vpx_image::x_chroma_shift
unsigned int x_chroma_shift
Definition: vpx_image.h:111
VPX_IMG_FMT_RGB565_LE
Definition: vpx_image.h:53
vpx_image_rect::y
unsigned int y
Definition: vpx_image.h:147
VPX_IMG_FMT_RGB555_LE
Definition: vpx_image.h:54
vpx_image_rect
Representation of a rectangle on a surface.
Definition: vpx_image.h:145
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:149
vpx_image::d_w
unsigned int d_w
Definition: vpx_image.h:107
VPX_IMG_FMT_ARGB
Definition: vpx_image.h:51
vpx_img_fmt_t
enum vpx_img_fmt vpx_img_fmt_t
List of supported image formats.
vpx_image::stride
int stride[4]
Definition: vpx_image.h:128
VPX_IMG_FMT_YUY2
Definition: vpx_image.h:47
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:100
VPX_IMG_FMT_I422
Definition: vpx_image.h:59
vpx_image::planes
unsigned char * planes[4]
Definition: vpx_image.h:127
vpx_image::img_data
unsigned char * img_data
Definition: vpx_image.h:139
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:104
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_image_rect::w
unsigned int w
Definition: vpx_image.h:148
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:135
vpx_image::d_h
unsigned int d_h
Definition: vpx_image.h:108
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:103
VPX_IMG_FMT_RGB565
Definition: vpx_image.h:44
VPX_IMG_FMT_RGB24
Definition: vpx_image.h:42