WebM 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 
15 #ifndef VPX_VPX_VPX_IMAGE_H_
16 #define VPX_VPX_VPX_IMAGE_H_
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
30 #define VPX_IMAGE_ABI_VERSION (5)
32 #define VPX_IMG_FMT_PLANAR 0x100
33 #define VPX_IMG_FMT_UV_FLIP 0x200
34 #define VPX_IMG_FMT_HAS_ALPHA 0x400
35 #define VPX_IMG_FMT_HIGHBITDEPTH 0x800
38 typedef enum vpx_img_fmt {
39  VPX_IMG_FMT_NONE,
51 } vpx_img_fmt_t;
54 typedef enum vpx_color_space {
66 typedef enum vpx_color_range {
72 typedef struct vpx_image {
77  /* Image storage dimensions */
78  unsigned int w;
79  unsigned int h;
80  unsigned int bit_depth;
82  /* Image display dimensions */
83  unsigned int d_w;
84  unsigned int d_h;
86  /* Image intended rendering dimensions */
87  unsigned int r_w;
88  unsigned int r_h;
90  /* Chroma subsampling info */
91  unsigned int x_chroma_shift;
92  unsigned int y_chroma_shift;
94 /* Image data pointers. */
95 #define VPX_PLANE_PACKED 0
96 #define VPX_PLANE_Y 0
97 #define VPX_PLANE_U 1
98 #define VPX_PLANE_V 2
99 #define VPX_PLANE_ALPHA 3
100  unsigned char *planes[4];
101  int stride[4];
103  int bps;
108  void *user_priv;
109 
110  /* The following members should be treated as private. */
111  unsigned char *img_data;
115  void *fb_priv;
116 } vpx_image_t;
119 typedef struct vpx_image_rect {
120  unsigned int x;
121  unsigned int y;
122  unsigned int w;
123  unsigned int h;
145  unsigned int d_w, unsigned int d_h,
146  unsigned int align);
147 
168  unsigned int d_h, unsigned int stride_align,
169  unsigned char *img_data);
170 
184 int vpx_img_set_rect(vpx_image_t *img, unsigned int x, unsigned int y,
185  unsigned int w, unsigned int h);
186 
194 void vpx_img_flip(vpx_image_t *img);
195 
202 void vpx_img_free(vpx_image_t *img);
203 
204 #ifdef __cplusplus
205 } // extern "C"
206 #endif
207 
208 #endif // VPX_VPX_VPX_IMAGE_H_
unsigned int r_w
Definition: vpx_image.h:87
Definition: vpx_image.h:50
vpx_color_space
List of supported color spaces.
Definition: vpx_image.h:54
Image Descriptor.
Definition: vpx_image.h:72
Definition: vpx_image.h:57
unsigned int x
Definition: vpx_image.h:120
Definition: vpx_image.h:40
unsigned int r_h
Definition: vpx_image.h:88
int self_allocd
Definition: vpx_image.h:113
Definition: vpx_image.h:61
#define VPX_IMG_FMT_PLANAR
Definition: vpx_image.h:32
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 stride_align, unsigned char *img_data)
Open a descriptor, using existing storage for the underlying image.
#define VPX_IMG_FMT_UV_FLIP
Definition: vpx_image.h:33
int img_data_owner
Definition: vpx_image.h:112
Definition: vpx_image.h:62
Definition: vpx_image.h:46
Definition: vpx_image.h:59
unsigned int bit_depth
Definition: vpx_image.h:80
vpx_color_range
List of supported color range.
Definition: vpx_image.h:66
enum vpx_color_range vpx_color_range_t
List of supported color range.
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_color_range_t range
Definition: vpx_image.h:75
void * fb_priv
Definition: vpx_image.h:115
unsigned int y_chroma_shift
Definition: vpx_image.h:92
unsigned int x_chroma_shift
Definition: vpx_image.h:91
#define VPX_IMG_FMT_HIGHBITDEPTH
Definition: vpx_image.h:35
unsigned int y
Definition: vpx_image.h:121
Representation of a rectangle on a surface.
Definition: vpx_image.h:119
Definition: vpx_image.h:49
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:42
unsigned int h
Definition: vpx_image.h:123
unsigned int d_w
Definition: vpx_image.h:83
Definition: vpx_image.h:48
enum vpx_color_space vpx_color_space_t
List of supported color spaces.
enum vpx_img_fmt vpx_img_fmt_t
List of supported image formats.
Definition: vpx_image.h:58
void vpx_img_free(vpx_image_t *img)
Close an image descriptor.
vpx_img_fmt_t fmt
Definition: vpx_image.h:73
Definition: vpx_image.h:43
Definition: vpx_image.h:56
unsigned char * img_data
Definition: vpx_image.h:111
void vpx_img_flip(vpx_image_t *img)
Flip the image vertically (top for bottom)
Definition: vpx_image.h:67
unsigned int h
Definition: vpx_image.h:79
Definition: vpx_image.h:47
unsigned int w
Definition: vpx_image.h:122
Definition: vpx_image.h:68
vpx_color_space_t cs
Definition: vpx_image.h:74
Definition: vpx_image.h:44
struct vpx_image vpx_image_t
Image Descriptor.
struct vpx_image_rect vpx_image_rect_t
Representation of a rectangle on a surface.
unsigned int d_h
Definition: vpx_image.h:84
Definition: vpx_image.h:55
unsigned int w
Definition: vpx_image.h:78
Definition: vpx_image.h:60
Definition: vpx_image.h:45