FFmpeg
Loading...
Searching...
No Matches
cbs_lcevc.h
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef AVCODEC_CBS_LCEVC_H
20#define AVCODEC_CBS_LCEVC_H
21
22#include <stddef.h>
23#include <stdint.h>
24
25#include "cbs_h2645.h"
26#include "cbs_sei.h"
27#include "lcevc.h"
28
33
48
86
113
131
150
151typedef struct LCEVCRawSEI {
153
155 uint32_t payload_size;
156 void *payload;
157 void *payload_ref; ///< RefStruct reference
159
162
165
166 uint32_t payload_size;
167 void *payload;
168 void *payload_ref; ///< RefStruct reference
170
171typedef struct LCEVCRawFiller {
172 uint32_t filler_size;
174
175typedef struct LCEVCRawProcessBlock {
176 uint32_t payload_type;
177 uint32_t payload_size;
178 void *payload;
179 void *payload_ref; ///< RefStruct reference
180 uint8_t *extension_data; ///< RefStruct reference
183
189
195
197 // The type of the payload being written.
198 uint32_t payload_type;
199 // When reading, contains the size of the payload to allow finding the
200 // end of variable-length fields (such as user_data_payload_byte[]).
201 // (When writing, the size will be derived from the total number of
202 // bytes actually written.)
203 uint32_t payload_size;
204 // When writing, indicates that payload extension data is present so
205 // all extended fields must be written. May be updated by the writer
206 // to indicate that extended fields have been written, so the extension
207 // end bits must be written too.
210
212 struct GetBitContext *rw,
213 void *current,
215 int nal_unit_type);
216
218 struct PutBitContext *rw,
219 void *current,
221 int nal_unit_type);
222
224 // Payload type for the block. (-1 in this field ends a list.)
226 // Size of the decomposed structure.
228 // Read bitstream into Process Block.
230 // Write bitstream from Process Block.
233
234// End-of-list sentinel element.
235#define LCEVC_PROCESS_BLOCK_TYPE_END { .payload_type = -1 }
236
238 // Reader/writer context in common with the H.264 implementation.
240
242
243 // All currently available parameter sets. These are updated when
244 // any parameter set NAL unit is read/written with this context.
245 LCEVCRawSequenceConfig *sc; ///< RefStruct references
246 LCEVCRawGlobalConfig *gc; ///< RefStruct references
247 LCEVCRawPictureConfig *pc; ///< RefStruct references
249
250/**
251 * Find the type descriptor for the given payload type.
252 *
253 * Returns NULL if the payload type is not known.
254 */
256 int payload_type);
257
258/**
259 * Allocate a new payload for the given Process Block.
260 */
263
264/**
265 * Allocate a new empty Process Block in a block list at a given position.
266 */
267int ff_cbs_lcevc_list_add(LCEVCRawProcessBlockList *list, int position);
268
269/**
270 * Free all Process Block in a block list.
271 */
273
274/**
275 * Add a process block to an access unit.
276 *
277 * An existing NAL unit of type IDR or NON_IDR are required.
278 *
279 * If set, payload_ref must be a RefStruct reference backing payload_data.
280 * This function creates a new reference to payload_ref in this case.
281 * If payload_ref is NULL, the new message will not be reference counted.
282 */
285 int position,
286 uint32_t payload_type,
287 void *payload_data,
288 void *payload_ref);
289
290/**
291 * Iterate over blocks with the given payload type in an access unit.
292 *
293 * Set block to NULL in the first call. Returns 0 while more blocks
294 * are available, AVERROR(ENOENT) when all blocks have been found.
295 */
298 uint32_t payload_type,
300
301/**
302 * Delete all blocks with the given payload type from an access unit.
303 */
306 uint32_t payload_type);
307
308#endif /* AVCODEC_CBS_LCEVC_H */
int ff_cbs_lcevc_alloc_process_block_payload(LCEVCRawProcessBlock *block, const LCEVCProcessBlockTypeDescriptor *desc)
Allocate a new payload for the given Process Block.
Definition cbs_lcevc.c:522
int ff_cbs_lcevc_add_process_block(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, int position, uint32_t payload_type, void *payload_data, void *payload_ref)
Add a process block to an access unit.
Definition cbs_lcevc.c:610
int ff_cbs_lcevc_find_process_block(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, uint32_t payload_type, LCEVCRawProcessBlock **block)
Iterate over blocks with the given payload type in an access unit.
Definition cbs_lcevc.c:662
void ff_cbs_lcevc_delete_process_block_type(CodedBitstreamContext *ctx, CodedBitstreamFragment *au, uint32_t payload_type)
Delete all blocks with the given payload type from an access unit.
Definition cbs_lcevc.c:717
const LCEVCProcessBlockTypeDescriptor * ff_cbs_lcevc_process_block_find_type(CodedBitstreamContext *ctx, int payload_type)
Find the type descriptor for the given payload type.
Definition cbs_lcevc.c:808
int(* LCEVCRawProcessBlockWriteFunction)(CodedBitstreamContext *ctx, struct PutBitContext *rw, void *current, LCEVCProcessBlockState *state, int nal_unit_type)
Definition cbs_lcevc.h:217
int(* LCEVCRawProcessBlockReadFunction)(CodedBitstreamContext *ctx, struct GetBitContext *rw, void *current, LCEVCProcessBlockState *state, int nal_unit_type)
Definition cbs_lcevc.h:211
void ff_cbs_lcevc_free_process_block_list(LCEVCRawProcessBlockList *list)
Free all Process Block in a block list.
Definition cbs_lcevc.c:588
int ff_cbs_lcevc_list_add(LCEVCRawProcessBlockList *list, int position)
Allocate a new empty Process Block in a block list at a given position.
Definition cbs_lcevc.c:549
static int16_t block[64]
Definition dct.c:125
static struct @346255127015250356166251341105367306144006377143 state
static struct @111144215057303131116103221376075045141373005341 current
LCEVC common definitions.
const char * desc
Definition libsvtav1.c:83
A reference to a data buffer.
Definition buffer.h:82
Context structure for coded bitstream operations.
Definition cbs.h:226
Coded bitstream fragment structure, combining one or more units.
Definition cbs.h:129
LCEVCRawGlobalConfig * gc
RefStruct references.
Definition cbs_lcevc.h:246
LCEVCRawSequenceConfig * sc
RefStruct references.
Definition cbs_lcevc.h:245
LCEVCRawPictureConfig * pc
RefStruct references.
Definition cbs_lcevc.h:247
CodedBitstreamH2645Context common
Definition cbs_lcevc.h:239
LCEVCRawProcessBlockReadFunction read
Definition cbs_lcevc.h:229
LCEVCRawProcessBlockWriteFunction write
Definition cbs_lcevc.h:231
void * payload_ref
RefStruct reference.
Definition cbs_lcevc.h:168
LCEVCRawNALUnitHeader nal_unit_header
Definition cbs_lcevc.h:115
LCEVCRawPictureConfig * pc
RefStruct references.
Definition cbs_lcevc.h:129
LCEVCRawSequenceConfig * sc
RefStruct references.
Definition cbs_lcevc.h:127
LCEVCRawGlobalConfig * gc
RefStruct references.
Definition cbs_lcevc.h:128
uint8_t temporal_surfaces_rle_only_flag[3]
Definition cbs_lcevc.h:120
uint8_t surfaces_rle_only_flag[3][3][16]
Definition cbs_lcevc.h:118
uint8_t surfaces_entropy_enabled_flag[3][3][16]
Definition cbs_lcevc.h:117
uint8_t temporal_surfaces_entropy_enabled_flag[3]
Definition cbs_lcevc.h:119
AVBufferRef * data_ref
Definition cbs_lcevc.h:123
uint32_t filler_size
Definition cbs_lcevc.h:172
uint8_t chroma_sampling_type
Definition cbs_lcevc.h:53
uint8_t level1_filtering_first_coefficient
Definition cbs_lcevc.h:75
uint16_t custom_resolution_width
Definition cbs_lcevc.h:82
uint8_t resolution_type
Definition cbs_lcevc.h:51
uint16_t reserved_zeros_5bit
Definition cbs_lcevc.h:79
uint8_t temporal_tile_intra_signalling_enabled_flag
Definition cbs_lcevc.h:58
uint8_t tile_dimensions_type
Definition cbs_lcevc.h:64
uint8_t user_data_enabled
Definition cbs_lcevc.h:65
uint16_t upsampler_coeff3
Definition cbs_lcevc.h:73
uint8_t level1_filtering_second_coefficient
Definition cbs_lcevc.h:76
uint16_t custom_tile_height
Definition cbs_lcevc.h:78
uint16_t upsampler_coeff1
Definition cbs_lcevc.h:71
uint8_t level1_filtering_signalled_flag
Definition cbs_lcevc.h:61
uint8_t compression_type_size_per_tile
Definition cbs_lcevc.h:81
uint8_t scaling_mode_level1
Definition cbs_lcevc.h:62
uint8_t level1_depth_flag
Definition cbs_lcevc.h:66
uint8_t enhancement_depth_type
Definition cbs_lcevc.h:55
uint16_t custom_resolution_height
Definition cbs_lcevc.h:83
uint8_t compression_type_entropy_enabled_per_tile_flag
Definition cbs_lcevc.h:80
uint8_t predicted_residual_mode_flag
Definition cbs_lcevc.h:57
uint16_t upsampler_coeff2
Definition cbs_lcevc.h:72
uint8_t base_depth_type
Definition cbs_lcevc.h:54
uint8_t scaling_mode_level2
Definition cbs_lcevc.h:63
uint8_t chroma_step_width_multiplier
Definition cbs_lcevc.h:84
uint16_t upsampler_coeff4
Definition cbs_lcevc.h:74
uint8_t chroma_step_width_flag
Definition cbs_lcevc.h:67
uint8_t temporal_enabled_flag
Definition cbs_lcevc.h:59
uint8_t temporal_step_width_modifier
Definition cbs_lcevc.h:70
uint16_t custom_tile_width
Definition cbs_lcevc.h:77
uint8_t reserved_zeros_4bit
Definition cbs_lcevc.h:69
uint8_t temporal_step_width_modifier_signalled_flag
Definition cbs_lcevc.h:56
uint8_t processed_planes_type_flag
Definition cbs_lcevc.h:50
LCEVCRawNALUnitHeader nal_unit_header
Definition cbs_lcevc.h:191
LCEVCRawProcessBlockList process_block_list
Definition cbs_lcevc.h:193
uint8_t reserved_zeros_7bit
Definition cbs_lcevc.h:99
uint8_t picture_type_bit_flag
Definition cbs_lcevc.h:91
uint8_t dequant_offset_mode_flag
Definition cbs_lcevc.h:104
LCEVCRawGlobalConfig * gc
RefStruct references.
Definition cbs_lcevc.h:111
uint16_t step_width_sublayer2
Definition cbs_lcevc.h:94
uint8_t field_type_bit_flag
Definition cbs_lcevc.h:98
uint8_t temporal_refresh_bit_flag
Definition cbs_lcevc.h:92
uint8_t temporal_signalling_present_flag
Definition cbs_lcevc.h:97
uint8_t dequant_offset_signalled_flag
Definition cbs_lcevc.h:90
uint16_t step_width_sublayer1
Definition cbs_lcevc.h:100
uint8_t step_width_sublayer1_enabled_flag
Definition cbs_lcevc.h:93
uint8_t level1_filtering_enabled_flag
Definition cbs_lcevc.h:101
uint8_t quant_matrix_mode
Definition cbs_lcevc.h:89
uint8_t qm_coefficient_1[16]
Definition cbs_lcevc.h:103
uint8_t no_enhancement_bit_flag
Definition cbs_lcevc.h:88
uint8_t reserved_zeros_4bit
Definition cbs_lcevc.h:96
uint8_t qm_coefficient_0[16]
Definition cbs_lcevc.h:102
uint8_t reserved_zeros_5bit
Definition cbs_lcevc.h:109
uint8_t dithering_control_flag
Definition cbs_lcevc.h:95
LCEVCRawProcessBlock * blocks
Definition cbs_lcevc.h:185
uint8_t * extension_data
RefStruct reference.
Definition cbs_lcevc.h:180
void * payload_ref
RefStruct reference.
Definition cbs_lcevc.h:179
size_t extension_bit_length
Definition cbs_lcevc.h:181
uint8_t payload_type
Definition cbs_lcevc.h:154
void * payload
Definition cbs_lcevc.h:156
uint32_t payload_size
Definition cbs_lcevc.h:155
void * payload_ref
RefStruct reference.
Definition cbs_lcevc.h:157
SEIRawMessage message
Definition cbs_lcevc.h:152
uint8_t conformance_window_flag
Definition cbs_lcevc.h:38
uint8_t reserved_zeros_1bit
Definition cbs_lcevc.h:42
uint32_t conf_win_right_offset
Definition cbs_lcevc.h:44
uint8_t reserved_zeros_5bit
Definition cbs_lcevc.h:39
uint32_t conf_win_bottom_offset
Definition cbs_lcevc.h:46
uint32_t conf_win_left_offset
Definition cbs_lcevc.h:43
uint8_t extended_profile_idc
Definition cbs_lcevc.h:40
uint32_t conf_win_top_offset
Definition cbs_lcevc.h:45
uint8_t overscan_appropriate_flag
Definition cbs_lcevc.h:138
uint8_t matrix_coefficients
Definition cbs_lcevc.h:145
uint8_t video_full_range_flag
Definition cbs_lcevc.h:141
uint8_t aspect_ratio_info_present_flag
Definition cbs_lcevc.h:133
uint8_t overscan_info_present_flag
Definition cbs_lcevc.h:137
uint8_t video_format
Definition cbs_lcevc.h:140
uint8_t chroma_sample_loc_type_bottom_field
Definition cbs_lcevc.h:148
uint8_t transfer_characteristics
Definition cbs_lcevc.h:144
uint8_t colour_description_present_flag
Definition cbs_lcevc.h:142
uint16_t sar_width
Definition cbs_lcevc.h:135
uint8_t chroma_loc_info_present_flag
Definition cbs_lcevc.h:146
uint8_t chroma_sample_loc_type_top_field
Definition cbs_lcevc.h:147
uint8_t colour_primaries
Definition cbs_lcevc.h:143
uint8_t aspect_ratio_idc
Definition cbs_lcevc.h:134
uint8_t video_signal_type_present_flag
Definition cbs_lcevc.h:139
uint8_t sar_height
Definition cbs_lcevc.h:136
static AVFormatContext * ctx
Definition movenc.c:49