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_IMAGE_H_
16 #define VPX_VPX_IMAGE_H_
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
30 #define VPX_IMAGE_ABI_VERSION (4)
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,
57  3,
67 } vpx_img_fmt_t;
70 typedef enum vpx_color_space {
82 typedef enum vpx_color_range {
88 typedef struct vpx_image {
93  /* Image storage dimensions */
94  unsigned int w;
95  unsigned int h;
96  unsigned int bit_depth;
98  /* Image display dimensions */
99  unsigned int d_w;
100  unsigned int d_h;
102  /* Image intended rendering dimensions */
103  unsigned int r_w;
104  unsigned int r_h;
106  /* Chroma subsampling info */
107  unsigned int x_chroma_shift;
108  unsigned int y_chroma_shift;
110 /* Image data pointers. */
111 #define VPX_PLANE_PACKED 0
112 #define VPX_PLANE_Y 0
113 #define VPX_PLANE_U 1
114 #define VPX_PLANE_V 2
115 #define VPX_PLANE_ALPHA 3
116  unsigned char *planes[4];
117  int stride[4];
119  int bps;
124  void *user_priv;
125 
126  /* The following members should be treated as private. */
127  unsigned char *img_data;
131  void *fb_priv;
132 } vpx_image_t;
135 typedef struct vpx_image_rect {
136  unsigned int x;
137  unsigned int y;
138  unsigned int w;
139  unsigned int h;
164  unsigned int d_w, unsigned int d_h,
165  unsigned int align);
166 
189 vpx_image_t *vpx_img_wrap(vpx_image_t *img, vpx_img_fmt_t fmt, unsigned int d_w,
190  unsigned int d_h, unsigned int align,
191  unsigned char *img_data);
192 
206 int vpx_img_set_rect(vpx_image_t *img, unsigned int x, unsigned int y,
207  unsigned int w, unsigned int h);
208 
216 void vpx_img_flip(vpx_image_t *img);
217 
224 void vpx_img_free(vpx_image_t *img);
225 
226 #ifdef __cplusplus
227 } // extern "C"
228 #endif
229 
230 #endif // VPX_VPX_IMAGE_H_
VPX_IMG_FMT_444A
@ VPX_IMG_FMT_444A
Definition: vpx_image.h:62
vpx_image_rect::x
unsigned int x
Definition: vpx_image.h:136
VPX_IMG_FMT_VPXI420
@ VPX_IMG_FMT_VPXI420
Definition: vpx_image.h:58
VPX_CS_RESERVED
@ VPX_CS_RESERVED
Definition: vpx_image.h:77
VPX_CS_BT_709
@ VPX_CS_BT_709
Definition: vpx_image.h:73
VPX_IMG_FMT_YV12
@ VPX_IMG_FMT_YV12
Definition: vpx_image.h:53
VPX_IMG_FMT_ARGB_LE
@ VPX_IMG_FMT_ARGB_LE
Definition: vpx_image.h:50
vpx_img_flip
void vpx_img_flip(vpx_image_t *img)
Flip the image vertically (top for bottom)
vpx_image::d_h
unsigned int d_h
Definition: vpx_image.h:100
VPX_CS_SRGB
@ VPX_CS_SRGB
Definition: vpx_image.h:78
VPX_IMG_FMT_HIGHBITDEPTH
#define VPX_IMG_FMT_HIGHBITDEPTH
Definition: vpx_image.h:35
vpx_image::r_w
unsigned int r_w
Definition: vpx_image.h:103
VPX_CS_SMPTE_240
@ VPX_CS_SMPTE_240
Definition: vpx_image.h:75
VPX_IMG_FMT_RGB32_LE
@ VPX_IMG_FMT_RGB32_LE
Definition: vpx_image.h:48
VPX_IMG_FMT_RGB565
@ VPX_IMG_FMT_RGB565
Definition: vpx_image.h:42
vpx_img_free
void vpx_img_free(vpx_image_t *img)
Close an image descriptor.
VPX_IMG_FMT_RGB555
@ VPX_IMG_FMT_RGB555
Definition: vpx_image.h:43
vpx_image::img_data_owner
int img_data_owner
Definition: vpx_image.h:128
vpx_image::fb_priv
void * fb_priv
Definition: vpx_image.h:131
VPX_IMG_FMT_I42216
@ VPX_IMG_FMT_I42216
Definition: vpx_image.h:64
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_image_rect::y
unsigned int y
Definition: vpx_image.h:137
vpx_image::y_chroma_shift
unsigned int y_chroma_shift
Definition: vpx_image.h:108
vpx_image::x_chroma_shift
unsigned int x_chroma_shift
Definition: vpx_image.h:107
vpx_color_space_t
enum vpx_color_space vpx_color_space_t
List of supported color spaces.
VPX_IMG_FMT_RGB565_LE
@ VPX_IMG_FMT_RGB565_LE
Definition: vpx_image.h:51
vpx_image::self_allocd
int self_allocd
Definition: vpx_image.h:129
VPX_IMG_FMT_I44416
@ VPX_IMG_FMT_I44416
Definition: vpx_image.h:65
vpx_image_rect::h
unsigned int h
Definition: vpx_image.h:139
VPX_IMG_FMT_I422
@ VPX_IMG_FMT_I422
Definition: vpx_image.h:59
vpx_image::d_w
unsigned int d_w
Definition: vpx_image.h:99
VPX_IMG_FMT_ARGB
@ VPX_IMG_FMT_ARGB
Definition: vpx_image.h:49
vpx_image::bit_depth
unsigned int bit_depth
Definition: vpx_image.h:96
vpx_image::fmt
vpx_img_fmt_t fmt
Definition: vpx_image.h:89
vpx_image_rect_t
struct vpx_image_rect vpx_image_rect_t
Representation of a rectangle on a surface.
VPX_IMG_FMT_HAS_ALPHA
#define VPX_IMG_FMT_HAS_ALPHA
Definition: vpx_image.h:34
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_color_range_t
enum vpx_color_range vpx_color_range_t
List of supported color range.
VPX_IMG_FMT_I420
@ VPX_IMG_FMT_I420
Definition: vpx_image.h:55
VPX_CS_BT_601
@ VPX_CS_BT_601
Definition: vpx_image.h:72
vpx_image::range
vpx_color_range_t range
Definition: vpx_image.h:91
vpx_image
Image Descriptor.
Definition: vpx_image.h:88
VPX_IMG_FMT_RGB555_LE
@ VPX_IMG_FMT_RGB555_LE
Definition: vpx_image.h:52
VPX_IMG_FMT_YUY2
@ VPX_IMG_FMT_YUY2
Definition: vpx_image.h:45
VPX_CS_SMPTE_170
@ VPX_CS_SMPTE_170
Definition: vpx_image.h:74
vpx_image::img_data
unsigned char * img_data
Definition: vpx_image.h:127
VPX_IMG_FMT_I444
@ VPX_IMG_FMT_I444
Definition: vpx_image.h:60
VPX_IMG_FMT_RGB32
@ VPX_IMG_FMT_RGB32
Definition: vpx_image.h:41
VPX_IMG_FMT_BGR24
@ VPX_IMG_FMT_BGR24
Definition: vpx_image.h:47
VPX_IMG_FMT_I42016
@ VPX_IMG_FMT_I42016
Definition: vpx_image.h:63
VPX_IMG_FMT_PLANAR
#define VPX_IMG_FMT_PLANAR
Definition: vpx_image.h:32
VPX_IMG_FMT_VPXYV12
@ VPX_IMG_FMT_VPXYV12
Definition: vpx_image.h:56
vpx_image::h
unsigned int h
Definition: vpx_image.h:95
vpx_img_fmt_t
enum vpx_img_fmt vpx_img_fmt_t
List of supported image formats.
vpx_image_rect::w
unsigned int w
Definition: vpx_image.h:138
VPX_CR_STUDIO_RANGE
@ VPX_CR_STUDIO_RANGE
Definition: vpx_image.h:83
vpx_image_rect
Representation of a rectangle on a surface.
Definition: vpx_image.h:135
vpx_color_space
vpx_color_space
List of supported color spaces.
Definition: vpx_image.h:70
vpx_image_t
struct vpx_image vpx_image_t
Image Descriptor.
VPX_IMG_FMT_I440
@ VPX_IMG_FMT_I440
Definition: vpx_image.h:61
VPX_CR_FULL_RANGE
@ VPX_CR_FULL_RANGE
Definition: vpx_image.h:84
VPX_IMG_FMT_YVYU
@ VPX_IMG_FMT_YVYU
Definition: vpx_image.h:46
VPX_IMG_FMT_I44016
@ VPX_IMG_FMT_I44016
Definition: vpx_image.h:66
vpx_color_range
vpx_color_range
List of supported color range.
Definition: vpx_image.h:82
VPX_IMG_FMT_RGB24
@ VPX_IMG_FMT_RGB24
Definition: vpx_image.h:40
vpx_image::cs
vpx_color_space_t cs
Definition: vpx_image.h:90
VPX_CS_UNKNOWN
@ VPX_CS_UNKNOWN
Definition: vpx_image.h:71
vpx_image::r_h
unsigned int r_h
Definition: vpx_image.h:104
VPX_IMG_FMT_UV_FLIP
#define VPX_IMG_FMT_UV_FLIP
Definition: vpx_image.h:33
VPX_CS_BT_2020
@ VPX_CS_BT_2020
Definition: vpx_image.h:76
vpx_image::w
unsigned int w
Definition: vpx_image.h:94
VPX_IMG_FMT_UYVY
@ VPX_IMG_FMT_UYVY
Definition: vpx_image.h:44
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.