Go to the documentation of this file.
36 const uint8_t *start = buf, *end = buf +
size;
43 }
state = START_NOT_FOUND;
48 int start_pos,
type, temporal_id, spatial_id;
50 &
type, &temporal_id, &spatial_id);
59 if (
state == START_FOUND)
63 if (
state == START_NOT_FOUND) {
66 }
else if (
state == END_FOUND) {
67 state = OFFSET_IMPOSSIBLE;
100 *
out = (uint8_t *)in;
127 int leading_zeros = 0;
135 if (leading_zeros >= 32)
148 seq_params->
bitdepth = 8 + (high_bitdepth * 2) + (twelve_bit * 2);
210 int reduced_still_picture_header;
211 int frame_width_bits_minus_1, frame_height_bits_minus_1;
222 memset(seq_params, 0,
sizeof(*seq_params));
227 reduced_still_picture_header =
get_bits1(&gb);
229 if (reduced_still_picture_header) {
231 seq_params->
tier = 0;
233 int initial_display_delay_present_flag, operating_points_cnt_minus_1;
234 int decoder_model_info_present_flag, buffer_delay_length_minus_1;
243 decoder_model_info_present_flag =
get_bits1(&gb);
244 if (decoder_model_info_present_flag) {
245 buffer_delay_length_minus_1 =
get_bits(&gb, 5);
251 decoder_model_info_present_flag = 0;
253 initial_display_delay_present_flag =
get_bits1(&gb);
255 operating_points_cnt_minus_1 =
get_bits(&gb, 5);
256 for (
int i = 0;
i <= operating_points_cnt_minus_1;
i++) {
257 int seq_level_idx, seq_tier;
262 if (seq_level_idx > 7)
267 if (decoder_model_info_present_flag) {
275 if (initial_display_delay_present_flag) {
281 seq_params->
level = seq_level_idx;
282 seq_params->
tier = seq_tier;
287 frame_width_bits_minus_1 =
get_bits(&gb, 4);
288 frame_height_bits_minus_1 =
get_bits(&gb, 4);
290 skip_bits(&gb, frame_width_bits_minus_1 + 1);
291 skip_bits(&gb, frame_height_bits_minus_1 + 1);
293 if (!reduced_still_picture_header) {
300 if (!reduced_still_picture_header) {
301 int enable_order_hint, seq_force_screen_content_tools;
307 if (enable_order_hint)
311 seq_force_screen_content_tools = 2;
313 seq_force_screen_content_tools =
get_bits1(&gb);
315 if (seq_force_screen_content_tools) {
320 if (enable_order_hint)
343 is_av1c = !!(buf[0] & 0x80);
355 memset(seq, 0,
sizeof(*seq));
377 int start_pos,
type, temporal_id, spatial_id;
379 &
type, &temporal_id, &spatial_id);
400 int write_seq_header)
407 int ret, nb_seq = 0, seq_size, meta_size;
416 int config_record_version = buf[0] & 0x7f;
417 if (config_record_version != 1 ||
size < 4) {
432 int start_pos,
type, temporal_id, spatial_id;
434 &
type, &temporal_id, &spatial_id);
443 if (!obu_size || nb_seq > 1) {
490 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
#define AV_PROFILE_AV1_PROFESSIONAL
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
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
#define AV_PROFILE_AV1_HIGH
static void skip_bits1(GetBitContext *s)
#define i(width, name, range_min, range_max)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
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
void ffio_init_write_context(FFIOContext *s, uint8_t *buffer, int buffer_size)
Wrap a buffer in an AVIOContext for writing.
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 AV_PROFILE_AV1_MAIN