vpx_image.h
Go to the documentation of this file.
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VPX_VPX_VPX_IMAGE_H_
#define VPX_VPX_VPX_IMAGE_H_
#ifdef __cplusplus
extern "C" {
#endif
#define VPX_IMAGE_ABI_VERSION (5)
#define VPX_IMG_FMT_PLANAR 0x100
#define VPX_IMG_FMT_UV_FLIP 0x200
#define VPX_IMG_FMT_HAS_ALPHA 0x400
#define VPX_IMG_FMT_HIGHBITDEPTH 0x800
typedef enum vpx_img_fmt {
VPX_IMG_FMT_NONE,
VPX_IMG_FMT_YV12 =
VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1,
VPX_IMG_FMT_I420 = VPX_IMG_FMT_PLANAR | 2,
VPX_IMG_FMT_I422 = VPX_IMG_FMT_PLANAR | 5,
VPX_IMG_FMT_I444 = VPX_IMG_FMT_PLANAR | 6,
VPX_IMG_FMT_I440 = VPX_IMG_FMT_PLANAR | 7,
VPX_IMG_FMT_NV12 = VPX_IMG_FMT_PLANAR | 9,
VPX_IMG_FMT_I42016 = VPX_IMG_FMT_I420 | VPX_IMG_FMT_HIGHBITDEPTH,
VPX_IMG_FMT_I42216 = VPX_IMG_FMT_I422 | VPX_IMG_FMT_HIGHBITDEPTH,
VPX_IMG_FMT_I44416 = VPX_IMG_FMT_I444 | VPX_IMG_FMT_HIGHBITDEPTH,
VPX_IMG_FMT_I44016 = VPX_IMG_FMT_I440 | VPX_IMG_FMT_HIGHBITDEPTH
} vpx_img_fmt_t;
typedef enum vpx_color_space {
VPX_CS_UNKNOWN = 0,
VPX_CS_BT_601 = 1,
VPX_CS_BT_709 = 2,
VPX_CS_SMPTE_170 = 3,
VPX_CS_SMPTE_240 = 4,
VPX_CS_BT_2020 = 5,
VPX_CS_RESERVED = 6,
VPX_CS_SRGB = 7
} vpx_color_space_t;
typedef enum vpx_color_range {
VPX_CR_STUDIO_RANGE = 0,
VPX_CR_FULL_RANGE = 1
} vpx_color_range_t;
typedef struct vpx_image {
vpx_img_fmt_t fmt;
vpx_color_space_t cs;
vpx_color_range_t range;
/* Image storage dimensions */
unsigned int w;
unsigned int h;
unsigned int bit_depth;
/* Image display dimensions */
unsigned int d_w;
unsigned int d_h;
/* Image intended rendering dimensions */
unsigned int r_w;
unsigned int r_h;
/* Chroma subsampling info */
unsigned int x_chroma_shift;
unsigned int y_chroma_shift;
/* Image data pointers. */
#define VPX_PLANE_PACKED 0
#define VPX_PLANE_Y 0
#define VPX_PLANE_U 1
#define VPX_PLANE_V 2
#define VPX_PLANE_ALPHA 3
unsigned char *planes[4];
int stride[4];
int bps;
void *user_priv;
/* The following members should be treated as private. */
unsigned char *img_data;
int img_data_owner;
int self_allocd;
void *fb_priv;
} vpx_image_t;
typedef struct vpx_image_rect {
unsigned int x;
unsigned int y;
unsigned int w;
unsigned int h;
} vpx_image_rect_t;
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);
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);
int vpx_img_set_rect(vpx_image_t *img, unsigned int x, unsigned int y,
unsigned int w, unsigned int h);
void vpx_img_flip(vpx_image_t *img);
void vpx_img_free(vpx_image_t *img);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // VPX_VPX_VPX_IMAGE_H_
vpx_image_rect
Representation of a rectangle on a surface.
Definition: vpx_image.h:119
vpx_image_rect::w
unsigned int w
Definition: vpx_image.h:122
vpx_image_rect::y
unsigned int y
Definition: vpx_image.h:121
vpx_image_rect::x
unsigned int x
Definition: vpx_image.h:120
vpx_image_rect::h
unsigned int h
Definition: vpx_image.h:123
vpx_image
Image Descriptor.
Definition: vpx_image.h:72
vpx_image::fmt
vpx_img_fmt_t fmt
Definition: vpx_image.h:73
vpx_image::y_chroma_shift
unsigned int y_chroma_shift
Definition: vpx_image.h:92
vpx_image::r_w
unsigned int r_w
Definition: vpx_image.h:87
vpx_image::user_priv
void * user_priv
The following member may be set by the application to associate data with this image.
Definition: vpx_image.h:108
vpx_image::d_h
unsigned int d_h
Definition: vpx_image.h:84
vpx_image::self_allocd
int self_allocd
Definition: vpx_image.h:113
vpx_image::img_data
unsigned char * img_data
Definition: vpx_image.h:111
vpx_image::fb_priv
void * fb_priv
Definition: vpx_image.h:115
vpx_image::img_data_owner
int img_data_owner
Definition: vpx_image.h:112
vpx_image::bps
int bps
Definition: vpx_image.h:103
vpx_image::d_w
unsigned int d_w
Definition: vpx_image.h:83
vpx_image::cs
vpx_color_space_t cs
Definition: vpx_image.h:74
vpx_image::h
unsigned int h
Definition: vpx_image.h:79
vpx_image::bit_depth
unsigned int bit_depth
Definition: vpx_image.h:80
vpx_image::planes
unsigned char * planes[4]
Definition: vpx_image.h:100
vpx_image::w
unsigned int w
Definition: vpx_image.h:78
vpx_image::stride
int stride[4]
Definition: vpx_image.h:101
vpx_image::r_h
unsigned int r_h
Definition: vpx_image.h:88
vpx_image::range
vpx_color_range_t range
Definition: vpx_image.h:75
vpx_image::x_chroma_shift
unsigned int x_chroma_shift
Definition: vpx_image.h:91
vpx_img_flip
void vpx_img_flip(vpx_image_t *img)
Flip the image vertically (top for bottom)
vpx_color_space
vpx_color_space
List of supported color spaces.
Definition: vpx_image.h:54
VPX_CS_BT_709
@ VPX_CS_BT_709
Definition: vpx_image.h:57
VPX_CS_SRGB
@ VPX_CS_SRGB
Definition: vpx_image.h:62
VPX_CS_BT_601
@ VPX_CS_BT_601
Definition: vpx_image.h:56
VPX_CS_BT_2020
@ VPX_CS_BT_2020
Definition: vpx_image.h:60
VPX_CS_SMPTE_170
@ VPX_CS_SMPTE_170
Definition: vpx_image.h:58
VPX_CS_UNKNOWN
@ VPX_CS_UNKNOWN
Definition: vpx_image.h:55
VPX_CS_SMPTE_240
@ VPX_CS_SMPTE_240
Definition: vpx_image.h:59
VPX_CS_RESERVED
@ VPX_CS_RESERVED
Definition: vpx_image.h:61
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 stride_align, unsigned char *img_data)
Open a descriptor, using existing storage for the underlying image.
VPX_IMG_FMT_HIGHBITDEPTH
#define VPX_IMG_FMT_HIGHBITDEPTH
Definition: vpx_image.h:35
VPX_IMG_FMT_UV_FLIP
#define VPX_IMG_FMT_UV_FLIP
Definition: vpx_image.h:33
vpx_img_fmt
vpx_img_fmt
List of supported image formats.
Definition: vpx_image.h:38
VPX_IMG_FMT_I42216
@ VPX_IMG_FMT_I42216
Definition: vpx_image.h:48
VPX_IMG_FMT_I44016
@ VPX_IMG_FMT_I44016
Definition: vpx_image.h:50
VPX_IMG_FMT_NV12
@ VPX_IMG_FMT_NV12
Definition: vpx_image.h:46
VPX_IMG_FMT_YV12
@ VPX_IMG_FMT_YV12
Definition: vpx_image.h:40
VPX_IMG_FMT_I42016
@ VPX_IMG_FMT_I42016
Definition: vpx_image.h:47
VPX_IMG_FMT_I444
@ VPX_IMG_FMT_I444
Definition: vpx_image.h:44
VPX_IMG_FMT_I440
@ VPX_IMG_FMT_I440
Definition: vpx_image.h:45
VPX_IMG_FMT_I44416
@ VPX_IMG_FMT_I44416
Definition: vpx_image.h:49
VPX_IMG_FMT_I420
@ VPX_IMG_FMT_I420
Definition: vpx_image.h:42
VPX_IMG_FMT_I422
@ VPX_IMG_FMT_I422
Definition: vpx_image.h:43
vpx_color_space_t
enum vpx_color_space vpx_color_space_t
List of supported color spaces.
vpx_color_range
vpx_color_range
List of supported color range.
Definition: vpx_image.h:66
VPX_CR_STUDIO_RANGE
@ VPX_CR_STUDIO_RANGE
Definition: vpx_image.h:67
VPX_CR_FULL_RANGE
@ VPX_CR_FULL_RANGE
Definition: vpx_image.h:68
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_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_PLANAR
#define VPX_IMG_FMT_PLANAR
Definition: vpx_image.h:32
vpx_image_rect_t
struct vpx_image_rect vpx_image_rect_t
Representation of a rectangle on a surface.
vpx_img_fmt_t
enum vpx_img_fmt vpx_img_fmt_t
List of supported image formats.
vpx_image_t
struct vpx_image vpx_image_t
Image Descriptor.
vpx_img_free
void vpx_img_free(vpx_image_t *img)
Close an image descriptor.
vpx_color_range_t
enum vpx_color_range vpx_color_range_t
List of supported color range.