WebM VP8 Codec SDK
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 (2)
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_HIGH 0x800
40  typedef enum vpx_img_fmt {
41  VPX_IMG_FMT_NONE,
65  } vpx_img_fmt_t;
67 #if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
68 #define IMG_FMT_PLANAR VPX_IMG_FMT_PLANAR
69 #define IMG_FMT_UV_FLIP VPX_IMG_FMT_UV_FLIP
70 #define IMG_FMT_HAS_ALPHA VPX_IMG_FMT_HAS_ALPHA
75 #define img_fmt vpx_img_fmt
76 
79 #define img_fmt_t vpx_img_fmt_t
80 
81 #define IMG_FMT_NONE VPX_IMG_FMT_NONE
82 #define IMG_FMT_RGB24 VPX_IMG_FMT_RGB24
83 #define IMG_FMT_RGB32 VPX_IMG_FMT_RGB32
84 #define IMG_FMT_RGB565 VPX_IMG_FMT_RGB565
85 #define IMG_FMT_RGB555 VPX_IMG_FMT_RGB555
86 #define IMG_FMT_UYVY VPX_IMG_FMT_UYVY
87 #define IMG_FMT_YUY2 VPX_IMG_FMT_YUY2
88 #define IMG_FMT_YVYU VPX_IMG_FMT_YVYU
89 #define IMG_FMT_BGR24 VPX_IMG_FMT_BGR24
90 #define IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE
91 #define IMG_FMT_ARGB VPX_IMG_FMT_ARGB
92 #define IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE
93 #define IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE
94 #define IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE
95 #define IMG_FMT_YV12 VPX_IMG_FMT_YV12
96 #define IMG_FMT_I420 VPX_IMG_FMT_I420
97 #define IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12
98 #define IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420
99 #endif /* VPX_CODEC_DISABLE_COMPAT */
100 
102  typedef struct vpx_image {
105  /* Image storage dimensions */
106  unsigned int w;
107  unsigned int h;
108  unsigned int bit_depth;
110  /* Image display dimensions */
111  unsigned int d_w;
112  unsigned int d_h;
114  /* Chroma subsampling info */
115  unsigned int x_chroma_shift;
116  unsigned int y_chroma_shift;
118  /* Image data pointers. */
119 #define VPX_PLANE_PACKED 0
120 #define VPX_PLANE_Y 0
121 #define VPX_PLANE_U 1
122 #define VPX_PLANE_V 2
123 #define VPX_PLANE_ALPHA 3
124 #if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
125 #define PLANE_PACKED VPX_PLANE_PACKED
126 #define PLANE_Y VPX_PLANE_Y
127 #define PLANE_U VPX_PLANE_U
128 #define PLANE_V VPX_PLANE_V
129 #define PLANE_ALPHA VPX_PLANE_ALPHA
130 #endif
131  unsigned char *planes[4];
132  int stride[4];
134  int bps;
136  /* The following member may be set by the application to associate data
137  * with this image.
138  */
139  void *user_priv;
142  /* The following members should be treated as private. */
143  unsigned char *img_data;
147  void *fb_priv;
148  } vpx_image_t;
151  typedef struct vpx_image_rect {
152  unsigned int x;
153  unsigned int y;
154  unsigned int w;
155  unsigned int h;
156  } vpx_image_rect_t;
177  vpx_img_fmt_t fmt,
178  unsigned int d_w,
179  unsigned int d_h,
180  unsigned int align);
181 
202  vpx_img_fmt_t fmt,
203  unsigned int d_w,
204  unsigned int d_h,
205  unsigned int align,
206  unsigned char *img_data);
207 
208 
222  int vpx_img_set_rect(vpx_image_t *img,
223  unsigned int x,
224  unsigned int y,
225  unsigned int w,
226  unsigned int h);
227 
228 
236  void vpx_img_flip(vpx_image_t *img);
237 
244  void vpx_img_free(vpx_image_t *img);
245 
246 #ifdef __cplusplus
247 } // extern "C"
248 #endif
249 
250 #endif // VPX_VPX_IMAGE_H_
Definition: vpx_image.h:46
Image Descriptor.
Definition: vpx_image.h:102
Definition: vpx_image.h:61
Definition: vpx_image.h:58
unsigned int x
Definition: vpx_image.h:152
Definition: vpx_image.h:55
int self_allocd
Definition: vpx_image.h:145
#define VPX_IMG_FMT_PLANAR
Definition: vpx_image.h:34
#define VPX_IMG_FMT_UV_FLIP
Definition: vpx_image.h:35
int img_data_owner
Definition: vpx_image.h:144
Definition: vpx_image.h:45
unsigned int bit_depth
Definition: vpx_image.h:108
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.
void * fb_priv
Definition: vpx_image.h:147
int bps
Definition: vpx_image.h:134
unsigned int y_chroma_shift
Definition: vpx_image.h:116
unsigned int x_chroma_shift
Definition: vpx_image.h:115
Definition: vpx_image.h:53
unsigned int y
Definition: vpx_image.h:153
Definition: vpx_image.h:54
Representation of a rectangle on a surface.
Definition: vpx_image.h:151
Definition: vpx_image.h:64
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.
Definition: vpx_image.h:56
unsigned int h
Definition: vpx_image.h:155
unsigned int d_w
Definition: vpx_image.h:111
Definition: vpx_image.h:63
Definition: vpx_image.h:51
enum vpx_img_fmt vpx_img_fmt_t
List of supported image formats.
int stride[4]
Definition: vpx_image.h:132
Definition: vpx_image.h:47
#define VPX_IMG_FMT_HIGH
Definition: vpx_image.h:37
void vpx_img_free(vpx_image_t *img)
Close an image descriptor.
vpx_img_fmt_t fmt
Definition: vpx_image.h:103
Definition: vpx_image.h:59
unsigned char * planes[4]
Definition: vpx_image.h:131
unsigned char * img_data
Definition: vpx_image.h:143
void vpx_img_flip(vpx_image_t *img)
Flip the image vertically (top for bottom)
Definition: vpx_image.h:43
unsigned int h
Definition: vpx_image.h:107
Definition: vpx_image.h:57
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.
Definition: vpx_image.h:62
unsigned int w
Definition: vpx_image.h:154
Definition: vpx_image.h:60
struct vpx_image vpx_image_t
Image Descriptor.
struct vpx_image_rect vpx_image_rect_t
Representation of a rectangle on a surface.
Definition: vpx_image.h:49
Definition: vpx_image.h:48
#define VPX_IMG_FMT_HAS_ALPHA
Definition: vpx_image.h:36
void * user_priv
Definition: vpx_image.h:139
unsigned int d_h
Definition: vpx_image.h:112
Definition: vpx_image.h:52
Definition: vpx_image.h:50
unsigned int w
Definition: vpx_image.h:106
Definition: vpx_image.h:44
Definition: vpx_image.h:42