Go to the documentation of this file.
35 const uint8_t *start = buf, *end = buf +
size;
42 }
state = START_NOT_FOUND;
47 int start_pos,
type, temporal_id, spatial_id;
49 &
type, &temporal_id, &spatial_id);
58 if (
state == START_FOUND)
62 if (
state == START_NOT_FOUND) {
65 }
else if (
state == END_FOUND) {
66 state = OFFSET_IMPOSSIBLE;
126 int leading_zeros = 0;
134 if (leading_zeros >= 32)
147 seq_params->
bitdepth = 8 + (high_bitdepth * 2) + (twelve_bit * 2);
209 int reduced_still_picture_header;
210 int frame_width_bits_minus_1, frame_height_bits_minus_1;
221 memset(seq_params, 0,
sizeof(*seq_params));
226 reduced_still_picture_header =
get_bits1(&gb);
228 if (reduced_still_picture_header) {
230 seq_params->
tier = 0;
232 int initial_display_delay_present_flag, operating_points_cnt_minus_1;
233 int decoder_model_info_present_flag, buffer_delay_length_minus_1;
242 decoder_model_info_present_flag =
get_bits1(&gb);
243 if (decoder_model_info_present_flag) {
244 buffer_delay_length_minus_1 =
get_bits(&gb, 5);
250 decoder_model_info_present_flag = 0;
252 initial_display_delay_present_flag =
get_bits1(&gb);
254 operating_points_cnt_minus_1 =
get_bits(&gb, 5);
255 for (
int i = 0;
i <= operating_points_cnt_minus_1;
i++) {
256 int seq_level_idx, seq_tier;
261 if (seq_level_idx > 7)
266 if (decoder_model_info_present_flag) {
274 if (initial_display_delay_present_flag) {
280 seq_params->
level = seq_level_idx;
281 seq_params->
tier = seq_tier;
286 frame_width_bits_minus_1 =
get_bits(&gb, 4);
287 frame_height_bits_minus_1 =
get_bits(&gb, 4);
289 skip_bits(&gb, frame_width_bits_minus_1 + 1);
290 skip_bits(&gb, frame_height_bits_minus_1 + 1);
292 if (!reduced_still_picture_header) {
299 if (!reduced_still_picture_header) {
300 int enable_order_hint, seq_force_screen_content_tools;
306 if (enable_order_hint)
310 seq_force_screen_content_tools = 2;
312 seq_force_screen_content_tools =
get_bits1(&gb);
314 if (seq_force_screen_content_tools) {
319 if (enable_order_hint)
342 is_av1c = !!(buf[0] & 0x80);
354 memset(seq, 0,
sizeof(*seq));
376 int start_pos,
type, temporal_id, spatial_id;
378 &
type, &temporal_id, &spatial_id);
399 int write_seq_header)
406 int ret, nb_seq = 0, seq_size, meta_size;
415 int config_record_version = buf[0] & 0x7f;
416 if (config_record_version != 1 ||
size < 4) {
431 int start_pos,
type, temporal_id, spatial_id;
433 &
type, &temporal_id, &spatial_id);
442 if (!obu_size || nb_seq > 1) {
489 if (write_seq_header) {
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)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
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), YZX and ST 428-1
@ AV1_OBU_TEMPORAL_DELIMITER
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
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 int av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size, int *offset)
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
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
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)
int ff_av1_filter_obus_buf(const uint8_t *in, uint8_t **out, int *size, int *offset)
Filter out AV1 OBUs not meant to be present in ISOBMFF sample data and return the result in a data bu...
uint8_t chroma_sample_position
static void uvlc(GetBitContext *gb)
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 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]
int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, int write_seq_header)
Writes AV1 extradata (Sequence Header and Metadata OBUs) to the provided AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *gb)
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 offset
static void skip_bits1(GetBitContext *s)
#define i(width, name, range_min, range_max)
void ffio_init_context(FFIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#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 ...
#define AV_INPUT_BUFFER_PADDING_SIZE
uint8_t chroma_subsampling_x
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