AOMedia Codec SDK
aom_image.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3  *
4  * This source code is subject to the terms of the BSD 2 Clause License and
5  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6  * was not distributed with this source code in the LICENSE file, you can
7  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8  * Media Patent License 1.0 was not distributed with this source code in the
9  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10  */
11 
16 #ifndef AOM_AOM_IMAGE_H_
17 #define AOM_AOM_IMAGE_H_
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include "aom/aom_integer.h"
24 
33 #define AOM_IMAGE_ABI_VERSION (4)
35 #define AOM_IMG_FMT_PLANAR 0x100
36 #define AOM_IMG_FMT_UV_FLIP 0x200
37 #define AOM_IMG_FMT_HAS_ALPHA 0x400
38 #define AOM_IMG_FMT_HIGHBITDEPTH 0x800
41 typedef enum aom_img_fmt {
42  AOM_IMG_FMT_NONE,
47  3,
55 } aom_img_fmt_t;
58 typedef enum aom_color_primaries {
68  8,
91  10,
115  9,
119  12,
124 
126 typedef enum aom_color_range {
141 typedef struct aom_image {
150  /* Image storage dimensions */
151  unsigned int w;
152  unsigned int h;
153  unsigned int bit_depth;
155  /* Image display dimensions */
156  unsigned int d_w;
157  unsigned int d_h;
159  /* Image intended rendering dimensions */
160  unsigned int r_w;
161  unsigned int r_h;
163  /* Chroma subsampling info */
164  unsigned int x_chroma_shift;
165  unsigned int y_chroma_shift;
167 /* Image data pointers. */
168 #define AOM_PLANE_PACKED 0
169 #define AOM_PLANE_Y 0
170 #define AOM_PLANE_U 1
171 #define AOM_PLANE_V 2
172 #define AOM_PLANE_ALPHA 3
173  unsigned char *planes[4];
174  int stride[4];
175  size_t sz;
177  int bps;
179  int temporal_id;
180  int spatial_id;
185  void *user_priv;
186 
187  /* The following members should be treated as private. */
188  unsigned char *img_data;
192  void *fb_priv;
193 } aom_image_t;
196 typedef struct aom_image_rect {
197  unsigned int x;
198  unsigned int y;
199  unsigned int w;
200  unsigned int h;
222  unsigned int d_w, unsigned int d_h,
223  unsigned int align);
224 
244 aom_image_t *aom_img_wrap(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w,
245  unsigned int d_h, unsigned int align,
246  unsigned char *img_data);
247 
270  unsigned int d_w, unsigned int d_h,
271  unsigned int align,
272  unsigned int size_align,
273  unsigned int border);
274 
289 int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y,
290  unsigned int w, unsigned int h, unsigned int border);
291 
299 void aom_img_flip(aom_image_t *img);
300 
307 void aom_img_free(aom_image_t *img);
308 
316 int aom_img_plane_width(const aom_image_t *img, int plane);
317 
325 int aom_img_plane_height(const aom_image_t *img, int plane);
326 
327 #ifdef __cplusplus
328 } // extern "C"
329 #endif
330 
331 #endif // AOM_AOM_IMAGE_H_