AOMedia Codec SDK: aom/aom_image.h Source File

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,
43 AOM_IMG_FMT_YV12 =
44 AOM_IMG_FMT_PLANAR | AOM_IMG_FMT_UV_FLIP | 1,
45 AOM_IMG_FMT_I420 = AOM_IMG_FMT_PLANAR | 2,
46 AOM_IMG_FMT_AOMYV12 = AOM_IMG_FMT_PLANAR | AOM_IMG_FMT_UV_FLIP |
47 3,
48 AOM_IMG_FMT_AOMI420 = AOM_IMG_FMT_PLANAR | 4,
49 AOM_IMG_FMT_I422 = AOM_IMG_FMT_PLANAR | 5,
50 AOM_IMG_FMT_I444 = AOM_IMG_FMT_PLANAR | 6,
51 AOM_IMG_FMT_444A = AOM_IMG_FMT_PLANAR | AOM_IMG_FMT_HAS_ALPHA | 6,
52 AOM_IMG_FMT_I42016 = AOM_IMG_FMT_I420 | AOM_IMG_FMT_HIGHBITDEPTH,
53 AOM_IMG_FMT_I42216 = AOM_IMG_FMT_I422 | AOM_IMG_FMT_HIGHBITDEPTH,
54 AOM_IMG_FMT_I44416 = AOM_IMG_FMT_I444 | AOM_IMG_FMT_HIGHBITDEPTH,
55 } aom_img_fmt_t;
58 typedef enum aom_color_primaries {
59 AOM_CICP_CP_RESERVED_0 = 0,
60 AOM_CICP_CP_BT_709 = 1,
61 AOM_CICP_CP_UNSPECIFIED = 2,
62 AOM_CICP_CP_RESERVED_3 = 3,
63 AOM_CICP_CP_BT_470_M = 4,
64 AOM_CICP_CP_BT_470_B_G = 5,
65 AOM_CICP_CP_BT_601 = 6,
66 AOM_CICP_CP_SMPTE_240 = 7,
67 AOM_CICP_CP_GENERIC_FILM =
68 8,
69 AOM_CICP_CP_BT_2020 = 9,
70 AOM_CICP_CP_XYZ = 10,
71 AOM_CICP_CP_SMPTE_431 = 11,
72 AOM_CICP_CP_SMPTE_432 = 12,
73 AOM_CICP_CP_RESERVED_13 = 13,
74 AOM_CICP_CP_EBU_3213 = 22,
75 AOM_CICP_CP_RESERVED_23 = 23
76 } aom_color_primaries_t;
79 typedef enum aom_transfer_characteristics {
80 AOM_CICP_TC_RESERVED_0 = 0,
81 AOM_CICP_TC_BT_709 = 1,
82 AOM_CICP_TC_UNSPECIFIED = 2,
83 AOM_CICP_TC_RESERVED_3 = 3,
84 AOM_CICP_TC_BT_470_M = 4,
85 AOM_CICP_TC_BT_470_B_G = 5,
86 AOM_CICP_TC_BT_601 = 6,
87 AOM_CICP_TC_SMPTE_240 = 7,
88 AOM_CICP_TC_LINEAR = 8,
89 AOM_CICP_TC_LOG_100 = 9,
90 AOM_CICP_TC_LOG_100_SQRT10 =
91 10,
92 AOM_CICP_TC_IEC_61966 = 11,
93 AOM_CICP_TC_BT_1361 = 12,
94 AOM_CICP_TC_SRGB = 13,
95 AOM_CICP_TC_BT_2020_10_BIT = 14,
96 AOM_CICP_TC_BT_2020_12_BIT = 15,
97 AOM_CICP_TC_SMPTE_2084 = 16,
98 AOM_CICP_TC_SMPTE_428 = 17,
99 AOM_CICP_TC_HLG = 18,
100 AOM_CICP_TC_RESERVED_19 = 19
101 } aom_transfer_characteristics_t;
104 typedef enum aom_matrix_coefficients {
105 AOM_CICP_MC_IDENTITY = 0,
106 AOM_CICP_MC_BT_709 = 1,
107 AOM_CICP_MC_UNSPECIFIED = 2,
108 AOM_CICP_MC_RESERVED_3 = 3,
109 AOM_CICP_MC_FCC = 4,
110 AOM_CICP_MC_BT_470_B_G = 5,
111 AOM_CICP_MC_BT_601 = 6,
112 AOM_CICP_MC_SMPTE_240 = 7,
113 AOM_CICP_MC_SMPTE_YCGCO = 8,
114 AOM_CICP_MC_BT_2020_NCL =
115 9,
116 AOM_CICP_MC_BT_2020_CL = 10,
117 AOM_CICP_MC_SMPTE_2085 = 11,
118 AOM_CICP_MC_CHROMAT_NCL =
119 12,
120 AOM_CICP_MC_CHROMAT_CL = 13,
121 AOM_CICP_MC_ICTCP = 14,
122 AOM_CICP_MC_RESERVED_15 = 15
123 } aom_matrix_coefficients_t;
124
126 typedef enum aom_color_range {
127 AOM_CR_STUDIO_RANGE = 0,
128 AOM_CR_FULL_RANGE = 1
129 } aom_color_range_t;
132 typedef enum aom_chroma_sample_position {
133 AOM_CSP_UNKNOWN = 0,
134 AOM_CSP_VERTICAL = 1,
136 AOM_CSP_COLOCATED = 2,
137 AOM_CSP_RESERVED = 3
138 } aom_chroma_sample_position_t;
141 typedef struct aom_image {
142 aom_img_fmt_t fmt;
143 aom_color_primaries_t cp;
144 aom_transfer_characteristics_t tc;
145 aom_matrix_coefficients_t mc;
146 int monochrome;
147 aom_chroma_sample_position_t csp;
148 aom_color_range_t range;
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;
189 int img_data_owner;
190 int self_allocd;
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;
201 } aom_image_rect_t;
221 aom_image_t *aom_img_alloc(aom_image_t *img, aom_img_fmt_t fmt,
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
269 aom_image_t *aom_img_alloc_with_border(aom_image_t *img, aom_img_fmt_t fmt,
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_
AOM_CICP_TC_BT_601
Definition: aom_image.h:86
aom_image::img_data
unsigned char * img_data
Definition: aom_image.h:188
aom_image::d_h
unsigned int d_h
Definition: aom_image.h:157
aom_image::r_w
unsigned int r_w
Definition: aom_image.h:160
aom_image::fb_priv
void * fb_priv
Definition: aom_image.h:192
AOM_IMG_FMT_HAS_ALPHA
#define AOM_IMG_FMT_HAS_ALPHA
Definition: aom_image.h:37
AOM_CICP_TC_IEC_61966
Definition: aom_image.h:92
AOM_CICP_MC_RESERVED_15
Definition: aom_image.h:122
AOM_CSP_UNKNOWN
Definition: aom_image.h:133
aom_image::mc
aom_matrix_coefficients_t mc
Definition: aom_image.h:145
AOM_CR_FULL_RANGE
Definition: aom_image.h:128
aom_chroma_sample_position
aom_chroma_sample_position
List of chroma sample positions.
Definition: aom_image.h:132
AOM_CICP_CP_SMPTE_240
Definition: aom_image.h:66
aom_img_fmt_t
enum aom_img_fmt aom_img_fmt_t
List of supported image formats.
aom_image_rect::h
unsigned int h
Definition: aom_image.h:200
AOM_CICP_TC_SMPTE_240
Definition: aom_image.h:87
AOM_CICP_MC_BT_2020_NCL
Definition: aom_image.h:114
aom_image_rect::w
unsigned int w
Definition: aom_image.h:199
AOM_CICP_CP_BT_601
Definition: aom_image.h:65
AOM_IMG_FMT_I444
Definition: aom_image.h:50
AOM_CICP_TC_BT_709
Definition: aom_image.h:81
AOM_CICP_TC_BT_2020_12_BIT
Definition: aom_image.h:96
aom_color_primaries_t
enum aom_color_primaries aom_color_primaries_t
List of supported color primaries.
AOM_CICP_MC_SMPTE_2085
Definition: aom_image.h:117
AOM_IMG_FMT_AOMI420
Definition: aom_image.h:48
aom_matrix_coefficients_t
enum aom_matrix_coefficients aom_matrix_coefficients_t
List of supported matrix coefficients.
AOM_IMG_FMT_HIGHBITDEPTH
#define AOM_IMG_FMT_HIGHBITDEPTH
Definition: aom_image.h:38
AOM_CICP_CP_BT_709
Definition: aom_image.h:60
aom_image::y_chroma_shift
unsigned int y_chroma_shift
Definition: aom_image.h:165
AOM_CR_STUDIO_RANGE
Definition: aom_image.h:127
AOM_CICP_TC_RESERVED_3
Definition: aom_image.h:83
AOM_CICP_CP_SMPTE_432
Definition: aom_image.h:72
AOM_IMG_FMT_I422
Definition: aom_image.h:49
aom_image::monochrome
int monochrome
Definition: aom_image.h:146
aom_image
Image Descriptor.
Definition: aom_image.h:141
AOM_CICP_MC_ICTCP
Definition: aom_image.h:121
aom_img_alloc
aom_image_t * aom_img_alloc(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align)
Open a descriptor, allocating storage for the underlying image.
aom_image_rect
Representation of a rectangle on a surface.
Definition: aom_image.h:196
AOM_IMG_FMT_I44416
Definition: aom_image.h:54
AOM_CICP_TC_LINEAR
Definition: aom_image.h:88
AOM_CICP_CP_XYZ
Definition: aom_image.h:70
aom_image::w
unsigned int w
Definition: aom_image.h:151
aom_color_primaries
aom_color_primaries
List of supported color primaries.
Definition: aom_image.h:58
AOM_CSP_VERTICAL
Definition: aom_image.h:134
AOM_CICP_CP_BT_470_B_G
Definition: aom_image.h:64
aom_img_alloc_with_border
aom_image_t * aom_img_alloc_with_border(aom_image_t *img, aom_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align, unsigned int size_align, unsigned int border)
Open a descriptor, allocating storage for the underlying image with a border.
AOM_IMG_FMT_I42216
Definition: aom_image.h:53
AOM_CICP_TC_SMPTE_428
Definition: aom_image.h:98
AOM_CICP_MC_BT_601
Definition: aom_image.h:111
aom_img_free
void aom_img_free(aom_image_t *img)
Close an image descriptor.
AOM_IMG_FMT_444A
Definition: aom_image.h:51
aom_image::tc
aom_transfer_characteristics_t tc
Definition: aom_image.h:144
AOM_CICP_TC_UNSPECIFIED
Definition: aom_image.h:82
AOM_CICP_TC_BT_2020_10_BIT
Definition: aom_image.h:95
AOM_CICP_CP_EBU_3213
Definition: aom_image.h:74
AOM_CICP_TC_LOG_100_SQRT10
Definition: aom_image.h:90
AOM_CICP_MC_BT_470_B_G
Definition: aom_image.h:110
AOM_CICP_MC_UNSPECIFIED
Definition: aom_image.h:107
aom_img_wrap
aom_image_t * aom_img_wrap(aom_image_t *img, aom_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.
aom_image::self_allocd
int self_allocd
Definition: aom_image.h:190
AOM_CICP_CP_RESERVED_13
Definition: aom_image.h:73
AOM_CICP_TC_HLG
Definition: aom_image.h:99
aom_image_t
struct aom_image aom_image_t
Image Descriptor.
aom_image_rect_t
struct aom_image_rect aom_image_rect_t
Representation of a rectangle on a surface.
aom_img_plane_width
int aom_img_plane_width(const aom_image_t *img, int plane)
Get the width of a plane.
AOM_CICP_TC_LOG_100
Definition: aom_image.h:89
aom_image::csp
aom_chroma_sample_position_t csp
Definition: aom_image.h:147
AOM_CICP_CP_RESERVED_3
Definition: aom_image.h:62
aom_color_range
aom_color_range
List of supported color range.
Definition: aom_image.h:126
aom_image_rect::x
unsigned int x
Definition: aom_image.h:197
AOM_CICP_TC_BT_1361
Definition: aom_image.h:93
aom_img_plane_height
int aom_img_plane_height(const aom_image_t *img, int plane)
Get the height of a plane.
AOM_CICP_CP_RESERVED_0
Definition: aom_image.h:59
AOM_CICP_MC_RESERVED_3
Definition: aom_image.h:108
AOM_CICP_MC_FCC
Definition: aom_image.h:109
aom_image::x_chroma_shift
unsigned int x_chroma_shift
Definition: aom_image.h:164
aom_image::h
unsigned int h
Definition: aom_image.h:152
AOM_CICP_MC_SMPTE_YCGCO
Definition: aom_image.h:113
AOM_IMG_FMT_PLANAR
#define AOM_IMG_FMT_PLANAR
Definition: aom_image.h:35
aom_transfer_characteristics
aom_transfer_characteristics
List of supported transfer functions.
Definition: aom_image.h:79
aom_color_range_t
enum aom_color_range aom_color_range_t
List of supported color range.
AOM_CSP_COLOCATED
Definition: aom_image.h:136
AOM_CICP_TC_SMPTE_2084
Definition: aom_image.h:97
AOM_CSP_RESERVED
Definition: aom_image.h:137
aom_image_rect::y
unsigned int y
Definition: aom_image.h:198
AOM_IMG_FMT_AOMYV12
Definition: aom_image.h:46
AOM_IMG_FMT_I42016
Definition: aom_image.h:52
aom_chroma_sample_position_t
enum aom_chroma_sample_position aom_chroma_sample_position_t
List of chroma sample positions.
AOM_CICP_TC_SRGB
Definition: aom_image.h:94
AOM_CICP_MC_BT_709
Definition: aom_image.h:106
AOM_CICP_TC_RESERVED_19
Definition: aom_image.h:100
AOM_CICP_CP_BT_470_M
Definition: aom_image.h:63
aom_img_flip
void aom_img_flip(aom_image_t *img)
Flip the image vertically (top for bottom)
AOM_CICP_MC_BT_2020_CL
Definition: aom_image.h:116
AOM_CICP_MC_CHROMAT_CL
Definition: aom_image.h:120
aom_image::range
aom_color_range_t range
Definition: aom_image.h:148
AOM_CICP_MC_CHROMAT_NCL
Definition: aom_image.h:118
AOM_CICP_TC_BT_470_B_G
Definition: aom_image.h:85
AOM_CICP_TC_BT_470_M
Definition: aom_image.h:84
AOM_IMG_FMT_I420
Definition: aom_image.h:45
AOM_CICP_CP_GENERIC_FILM
Definition: aom_image.h:67
AOM_IMG_FMT_UV_FLIP
#define AOM_IMG_FMT_UV_FLIP
Definition: aom_image.h:36
AOM_CICP_MC_IDENTITY
Definition: aom_image.h:105
aom_transfer_characteristics_t
enum aom_transfer_characteristics aom_transfer_characteristics_t
List of supported transfer functions.
AOM_CICP_CP_RESERVED_23
Definition: aom_image.h:75
AOM_CICP_TC_RESERVED_0
Definition: aom_image.h:80
AOM_CICP_MC_SMPTE_240
Definition: aom_image.h:112
aom_image::bit_depth
unsigned int bit_depth
Definition: aom_image.h:153
aom_image::r_h
unsigned int r_h
Definition: aom_image.h:161
aom_image::d_w
unsigned int d_w
Definition: aom_image.h:156
AOM_CICP_CP_UNSPECIFIED
Definition: aom_image.h:61
AOM_IMG_FMT_YV12
Definition: aom_image.h:43
aom_matrix_coefficients
aom_matrix_coefficients
List of supported matrix coefficients.
Definition: aom_image.h:104
aom_image::fmt
aom_img_fmt_t fmt
Definition: aom_image.h:142
AOM_CICP_CP_SMPTE_431
Definition: aom_image.h:71
AOM_CICP_CP_BT_2020
Definition: aom_image.h:69
aom_img_set_rect
int aom_img_set_rect(aom_image_t *img, unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int border)
Set the rectangle identifying the displayed portion of the image.
aom_image::cp
aom_color_primaries_t cp
Definition: aom_image.h:143
aom_image::img_data_owner
int img_data_owner
Definition: aom_image.h:189