WebM VP8 Codec SDK
|
00001 /* 00002 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 00003 * 00004 * Use of this source code is governed by a BSD-style license 00005 * that can be found in the LICENSE file in the root of the source 00006 * tree. An additional intellectual property rights grant can be found 00007 * in the file PATENTS. All contributing project authors may 00008 * be found in the AUTHORS file in the root of the source tree. 00009 */ 00010 00011 00016 #ifdef __cplusplus 00017 extern "C" { 00018 #endif 00019 00020 #ifndef VPX_IMAGE_H 00021 #define VPX_IMAGE_H 00022 00031 #define VPX_IMAGE_ABI_VERSION (1) 00034 #define VPX_IMG_FMT_PLANAR 0x100 00035 #define VPX_IMG_FMT_UV_FLIP 0x200 00036 #define VPX_IMG_FMT_HAS_ALPHA 0x400 00040 typedef enum vpx_img_fmt { 00041 VPX_IMG_FMT_NONE, 00042 VPX_IMG_FMT_RGB24, 00043 VPX_IMG_FMT_RGB32, 00044 VPX_IMG_FMT_RGB565, 00045 VPX_IMG_FMT_RGB555, 00046 VPX_IMG_FMT_UYVY, 00047 VPX_IMG_FMT_YUY2, 00048 VPX_IMG_FMT_YVYU, 00049 VPX_IMG_FMT_BGR24, 00050 VPX_IMG_FMT_RGB32_LE, 00051 VPX_IMG_FMT_ARGB, 00052 VPX_IMG_FMT_ARGB_LE, 00053 VPX_IMG_FMT_RGB565_LE, 00054 VPX_IMG_FMT_RGB555_LE, 00055 VPX_IMG_FMT_YV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1, 00056 VPX_IMG_FMT_I420 = VPX_IMG_FMT_PLANAR | 2, 00057 VPX_IMG_FMT_VPXYV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 3, 00058 VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4 00059 } 00060 vpx_img_fmt_t; 00062 #if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT 00063 #define IMG_FMT_PLANAR VPX_IMG_FMT_PLANAR 00064 #define IMG_FMT_UV_FLIP VPX_IMG_FMT_UV_FLIP 00065 #define IMG_FMT_HAS_ALPHA VPX_IMG_FMT_HAS_ALPHA 00070 #define img_fmt vpx_img_fmt 00071 00074 #define img_fmt_t vpx_img_fmt_t 00075 00076 #define IMG_FMT_NONE VPX_IMG_FMT_NONE 00077 #define IMG_FMT_RGB24 VPX_IMG_FMT_RGB24 00078 #define IMG_FMT_RGB32 VPX_IMG_FMT_RGB32 00079 #define IMG_FMT_RGB565 VPX_IMG_FMT_RGB565 00080 #define IMG_FMT_RGB555 VPX_IMG_FMT_RGB555 00081 #define IMG_FMT_UYVY VPX_IMG_FMT_UYVY 00082 #define IMG_FMT_YUY2 VPX_IMG_FMT_YUY2 00083 #define IMG_FMT_YVYU VPX_IMG_FMT_YVYU 00084 #define IMG_FMT_BGR24 VPX_IMG_FMT_BGR24 00085 #define IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE 00086 #define IMG_FMT_ARGB VPX_IMG_FMT_ARGB 00087 #define IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE 00088 #define IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE 00089 #define IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE 00090 #define IMG_FMT_YV12 VPX_IMG_FMT_YV12 00091 #define IMG_FMT_I420 VPX_IMG_FMT_I420 00092 #define IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12 00093 #define IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420 00094 #endif /* VPX_CODEC_DISABLE_COMPAT */ 00095 00097 typedef struct vpx_image { 00098 vpx_img_fmt_t fmt; 00100 /* Image storage dimensions */ 00101 unsigned int w; 00102 unsigned int h; 00104 /* Image display dimensions */ 00105 unsigned int d_w; 00106 unsigned int d_h; 00108 /* Chroma subsampling info */ 00109 unsigned int x_chroma_shift; 00110 unsigned int y_chroma_shift; 00112 /* Image data pointers. */ 00113 #define VPX_PLANE_PACKED 0 00114 #define VPX_PLANE_Y 0 00115 #define VPX_PLANE_U 1 00116 #define VPX_PLANE_V 2 00117 #define VPX_PLANE_ALPHA 3 00118 #if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT 00119 #define PLANE_PACKED VPX_PLANE_PACKED 00120 #define PLANE_Y VPX_PLANE_Y 00121 #define PLANE_U VPX_PLANE_U 00122 #define PLANE_V VPX_PLANE_V 00123 #define PLANE_ALPHA VPX_PLANE_ALPHA 00124 #endif 00125 unsigned char *planes[4]; 00126 int stride[4]; 00128 int bps; 00130 /* The following member may be set by the application to associate data 00131 * with this image. 00132 */ 00133 void *user_priv; 00136 /* The following members should be treated as private. */ 00137 unsigned char *img_data; 00138 int img_data_owner; 00139 int self_allocd; 00140 } vpx_image_t; 00143 typedef struct vpx_image_rect { 00144 unsigned int x; 00145 unsigned int y; 00146 unsigned int w; 00147 unsigned int h; 00148 } vpx_image_rect_t; 00168 vpx_image_t *vpx_img_alloc(vpx_image_t *img, 00169 vpx_img_fmt_t fmt, 00170 unsigned int d_w, 00171 unsigned int d_h, 00172 unsigned int align); 00173 00193 vpx_image_t *vpx_img_wrap(vpx_image_t *img, 00194 vpx_img_fmt_t fmt, 00195 unsigned int d_w, 00196 unsigned int d_h, 00197 unsigned int align, 00198 unsigned char *img_data); 00199 00200 00214 int vpx_img_set_rect(vpx_image_t *img, 00215 unsigned int x, 00216 unsigned int y, 00217 unsigned int w, 00218 unsigned int h); 00219 00220 00228 void vpx_img_flip(vpx_image_t *img); 00229 00236 void vpx_img_free(vpx_image_t *img); 00237 00238 #endif 00239 #ifdef __cplusplus 00240 } 00241 #endif