blob: cbaeb45acb8f48a64655bc8759fc6846e69a2292 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_CBS_APV_H
#define AVCODEC_CBS_APV_H
#include <stddef.h>
#include <stdint.h>
#include "libavutil/buffer.h"
#include "apv.h"
// Arbitrary limits to avoid large structures.
#define CBS_APV_MAX_AU_FRAMES 8
#define CBS_APV_MAX_METADATA_PAYLOADS 8
typedef struct APVRawPBUHeader {
uint8_t pbu_type;
uint16_t group_id;
uint8_t reserved_zero_8bits;
} APVRawPBUHeader;
typedef struct APVRawFiller {
size_t filler_size;
} APVRawFiller;
typedef struct APVRawFrameInfo {
uint8_t profile_idc;
uint8_t level_idc;
uint8_t band_idc;
uint8_t reserved_zero_5bits;
uint32_t frame_width;
uint32_t frame_height;
uint8_t chroma_format_idc;
uint8_t bit_depth_minus8;
uint8_t capture_time_distance;
uint8_t reserved_zero_8bits;
} APVRawFrameInfo;
typedef struct APVRawQuantizationMatrix {
uint8_t q_matrix[APV_MAX_NUM_COMP][APV_TR_SIZE][APV_TR_SIZE];
} APVRawQuantizationMatrix;
typedef struct APVRawTileInfo {
uint32_t tile_width_in_mbs;
uint32_t tile_height_in_mbs;
uint8_t tile_size_present_in_fh_flag;
uint32_t tile_size_in_fh[APV_MAX_TILE_COUNT];
} APVRawTileInfo;
typedef struct APVRawFrameHeader {
APVRawFrameInfo frame_info;
uint8_t reserved_zero_8bits;
uint8_t color_description_present_flag;
uint8_t color_primaries;
uint8_t transfer_characteristics;
uint8_t matrix_coefficients;
uint8_t full_range_flag;
uint8_t use_q_matrix;
APVRawQuantizationMatrix quantization_matrix;
APVRawTileInfo tile_info;
uint8_t reserved_zero_8bits_2;
} APVRawFrameHeader;
typedef struct APVRawTileHeader {
uint16_t tile_header_size;
uint16_t tile_index;
uint32_t tile_data_size[APV_MAX_NUM_COMP];
uint8_t tile_qp [APV_MAX_NUM_COMP];
uint8_t reserved_zero_8bits;
} APVRawTileHeader;
typedef struct APVRawTile {
APVRawTileHeader tile_header;
uint8_t *tile_data[APV_MAX_NUM_COMP];
uint8_t *tile_dummy_byte;
uint32_t tile_dummy_byte_size;
} APVRawTile;
typedef struct APVRawFrame {
APVRawPBUHeader pbu_header;
APVRawFrameHeader frame_header;
uint32_t tile_size[APV_MAX_TILE_COUNT];
APVRawTile tile [APV_MAX_TILE_COUNT];
APVRawFiller filler;
AVBufferRef *tile_data_ref;
} APVRawFrame;
typedef struct APVRawAUInfo {
uint16_t num_frames;
uint8_t pbu_type [CBS_APV_MAX_AU_FRAMES];
uint8_t group_id [CBS_APV_MAX_AU_FRAMES];
uint8_t reserved_zero_8bits[CBS_APV_MAX_AU_FRAMES];
APVRawFrameInfo frame_info [CBS_APV_MAX_AU_FRAMES];
uint8_t reserved_zero_8bits_2;
APVRawFiller filler;
} APVRawAUInfo;
typedef struct APVRawMetadataITUTT35 {
uint8_t itu_t_t35_country_code;
uint8_t itu_t_t35_country_code_extension;
uint8_t *data;
AVBufferRef *data_ref;
size_t data_size;
} APVRawMetadataITUTT35;
typedef struct APVRawMetadataMDCV {
uint16_t primary_chromaticity_x[3];
uint16_t primary_chromaticity_y[3];
uint16_t white_point_chromaticity_x;
uint16_t white_point_chromaticity_y;
uint32_t max_mastering_luminance;
uint32_t min_mastering_luminance;
} APVRawMetadataMDCV;
typedef struct APVRawMetadataCLL {
uint16_t max_cll;
uint16_t max_fall;
} APVRawMetadataCLL;
typedef struct APVRawMetadataFiller {
uint32_t payload_size;
} APVRawMetadataFiller;
typedef struct APVRawMetadataUserDefined {
uint8_t uuid[16];
uint8_t *data;
AVBufferRef *data_ref;
size_t data_size;
} APVRawMetadataUserDefined;
typedef struct APVRawMetadataUndefined {
uint8_t *data;
AVBufferRef *data_ref;
size_t data_size;
} APVRawMetadataUndefined;
typedef struct APVRawMetadataPayload {
uint32_t payload_type;
uint32_t payload_size;
union {
APVRawMetadataITUTT35 itu_t_t35;
APVRawMetadataMDCV mdcv;
APVRawMetadataCLL cll;
APVRawMetadataFiller filler;
APVRawMetadataUserDefined user_defined;
APVRawMetadataUndefined undefined;
};
} APVRawMetadataPayload;
typedef struct APVRawMetadata {
APVRawPBUHeader pbu_header;
uint32_t metadata_size;
uint32_t metadata_count;
APVRawMetadataPayload payloads[CBS_APV_MAX_METADATA_PAYLOADS];
APVRawFiller filler;
} APVRawMetadata;
typedef struct APVDerivedTileInfo {
uint8_t tile_cols;
uint8_t tile_rows;
uint16_t num_tiles;
// The spec uses an extra element on the end of these arrays
// not corresponding to any tile.
uint16_t col_starts[APV_MAX_TILE_COLS + 1];
uint16_t row_starts[APV_MAX_TILE_ROWS + 1];
} APVDerivedTileInfo;
typedef struct CodedBitstreamAPVContext {
int bit_depth;
int num_comp;
APVDerivedTileInfo tile_info;
} CodedBitstreamAPVContext;
#endif /* AVCODEC_CBS_APV_H */
|