Go to the documentation of this file.
35 int start_pos,
type, temporal_id, spatial_id;
40 &
type, &temporal_id, &spatial_id);
84 int leading_zeros = 0;
92 if (leading_zeros >= 32)
105 seq_params->
bitdepth = 8 + (high_bitdepth * 2) + (twelve_bit * 2);
167 int reduced_still_picture_header;
168 int frame_width_bits_minus_1, frame_height_bits_minus_1;
179 memset(seq_params, 0,
sizeof(*seq_params));
184 reduced_still_picture_header =
get_bits1(&gb);
186 if (reduced_still_picture_header) {
188 seq_params->
tier = 0;
190 int initial_display_delay_present_flag, operating_points_cnt_minus_1;
191 int decoder_model_info_present_flag, buffer_delay_length_minus_1;
200 decoder_model_info_present_flag =
get_bits1(&gb);
201 if (decoder_model_info_present_flag) {
202 buffer_delay_length_minus_1 =
get_bits(&gb, 5);
208 decoder_model_info_present_flag = 0;
210 initial_display_delay_present_flag =
get_bits1(&gb);
212 operating_points_cnt_minus_1 =
get_bits(&gb, 5);
213 for (
int i = 0;
i <= operating_points_cnt_minus_1;
i++) {
214 int seq_level_idx, seq_tier;
219 if (seq_level_idx > 7)
224 if (decoder_model_info_present_flag) {
232 if (initial_display_delay_present_flag) {
238 seq_params->
level = seq_level_idx;
239 seq_params->
tier = seq_tier;
244 frame_width_bits_minus_1 =
get_bits(&gb, 4);
245 frame_height_bits_minus_1 =
get_bits(&gb, 4);
247 skip_bits(&gb, frame_width_bits_minus_1 + 1);
248 skip_bits(&gb, frame_height_bits_minus_1 + 1);
250 if (!reduced_still_picture_header) {
257 if (!reduced_still_picture_header) {
258 int enable_order_hint, seq_force_screen_content_tools;
264 if (enable_order_hint)
268 seq_force_screen_content_tools = 2;
270 seq_force_screen_content_tools =
get_bits1(&gb);
272 if (seq_force_screen_content_tools) {
277 if (enable_order_hint)
296 int start_pos,
type, temporal_id, spatial_id;
303 &
type, &temporal_id, &spatial_id);
331 int start_pos,
type, temporal_id, spatial_id;
332 int ret, nb_seq = 0, seq_size, meta_size;
346 &
type, &temporal_id, &spatial_id);
355 if (!obu_size || nb_seq > 1) {
static int parse_sequence_header(AV1SequenceParameters *seq_params, const uint8_t *buf, int size)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
@ AV1_OBU_REDUNDANT_FRAME_HEADER
static int get_bits_left(GetBitContext *gb)
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static av_cold int end(AVCodecContext *avctx)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size)
Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided AVIOContext.
@ AV1_OBU_TEMPORAL_DELIMITER
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
uint8_t chroma_subsampling_y
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
uint8_t color_description_present_flag
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
static int parse_obu_header(const uint8_t *buf, int buf_size, int64_t *obu_size, int *start_pos, int *type, int *temporal_id, int *spatial_id)
uint8_t chroma_sample_position
static void uvlc(GetBitContext *gb)
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
static unsigned int get_bits1(GetBitContext *s)
uint8_t transfer_characteristics
#define FF_PROFILE_AV1_MAIN
uint8_t matrix_coefficients
static int get_obu_bit_length(const uint8_t *buf, int size, int type)
@ AV1_OBU_SEQUENCE_HEADER
static const uint8_t header[24]
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *gb)
static void skip_bits1(GetBitContext *s)
#define i(width, name, range_min, range_max)
#define FF_PROFILE_AV1_PROFESSIONAL
int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size)
Parses a Sequence Header from the the provided buffer.
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write the resulting bitstream ...
uint8_t chroma_subsampling_x
int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and write the resulting bitstream ...
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define FF_PROFILE_AV1_HIGH