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 #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,
59  }
62 #if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
63 #define IMG_FMT_PLANAR VPX_IMG_FMT_PLANAR
64 #define IMG_FMT_UV_FLIP VPX_IMG_FMT_UV_FLIP
65 #define IMG_FMT_HAS_ALPHA VPX_IMG_FMT_HAS_ALPHA
70 #define img_fmt vpx_img_fmt
71 
74 #define img_fmt_t vpx_img_fmt_t
75 
76 #define IMG_FMT_NONE VPX_IMG_FMT_NONE
77 #define IMG_FMT_RGB24 VPX_IMG_FMT_RGB24
78 #define IMG_FMT_RGB32 VPX_IMG_FMT_RGB32
79 #define IMG_FMT_RGB565 VPX_IMG_FMT_RGB565
80 #define IMG_FMT_RGB555 VPX_IMG_FMT_RGB555
81 #define IMG_FMT_UYVY VPX_IMG_FMT_UYVY
82 #define IMG_FMT_YUY2 VPX_IMG_FMT_YUY2
83 #define IMG_FMT_YVYU VPX_IMG_FMT_YVYU
84 #define IMG_FMT_BGR24 VPX_IMG_FMT_BGR24
85 #define IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE
86 #define IMG_FMT_ARGB VPX_IMG_FMT_ARGB
87 #define IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE
88 #define IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE
89 #define IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE
90 #define IMG_FMT_YV12 VPX_IMG_FMT_YV12
91 #define IMG_FMT_I420 VPX_IMG_FMT_I420
92 #define IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12
93 #define IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420
94 #endif /* VPX_CODEC_DISABLE_COMPAT */
95 
97  typedef struct vpx_image
98  {
101  /* Image storage dimensions */
102  unsigned int w;
103  unsigned int h;
105  /* Image display dimensions */
106  unsigned int d_w;
107  unsigned int d_h;
109  /* Chroma subsampling info */
110  unsigned int x_chroma_shift;
111  unsigned int y_chroma_shift;
113  /* Image data pointers. */
114 #define VPX_PLANE_PACKED 0
115 #define VPX_PLANE_Y 0
116 #define VPX_PLANE_U 1
117 #define VPX_PLANE_V 2
118 #define VPX_PLANE_ALPHA 3
119 #if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
120 #define PLANE_PACKED VPX_PLANE_PACKED
121 #define PLANE_Y VPX_PLANE_Y
122 #define PLANE_U VPX_PLANE_U
123 #define PLANE_V VPX_PLANE_V
124 #define PLANE_ALPHA VPX_PLANE_ALPHA
125 #endif
126  unsigned char *planes[4];
127  int stride[4];
129  int bps;
131  /* The following member may be set by the application to associate data
132  * with this image.
133  */
134  void *user_priv;
137  /* The following members should be treated as private. */
138  unsigned char *img_data;
141  } vpx_image_t;
144  typedef struct vpx_image_rect
145  {
146  unsigned int x;
147  unsigned int y;
148  unsigned int w;
149  unsigned int h;
150  } vpx_image_rect_t;
171  vpx_img_fmt_t fmt,
172  unsigned int d_w,
173  unsigned int d_h,
174  unsigned int align);
175 
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