FFmpeg
av1.c
Go to the documentation of this file.
1 /*
2  * AV1 helper functions for muxers
3  * Copyright (c) 2018 James Almer <jamrial@gmail.com>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/avassert.h"
23 #include "libavutil/mem.h"
24 #include "libavcodec/av1.h"
25 #include "libavcodec/av1_parse.h"
26 #include "libavcodec/avcodec.h"
27 #include "libavcodec/put_bits.h"
28 #include "av1.h"
29 #include "avio.h"
30 #include "avio_internal.h"
31 
32 static int av1_filter_obus(AVIOContext *pb, const uint8_t *buf,
33  int size, int *offset)
34 {
35  const uint8_t *start = buf, *end = buf + size;
36  int off;
37  enum {
38  START_NOT_FOUND,
39  START_FOUND,
40  END_FOUND,
41  OFFSET_IMPOSSIBLE,
42  } state = START_NOT_FOUND;
43 
44  off = size = 0;
45  while (buf < end) {
46  int64_t obu_size;
47  int start_pos, type, temporal_id, spatial_id;
48  int len = parse_obu_header(buf, end - buf, &obu_size, &start_pos,
49  &type, &temporal_id, &spatial_id);
50  if (len < 0)
51  return len;
52 
53  switch (type) {
56  case AV1_OBU_TILE_LIST:
57  case AV1_OBU_PADDING:
58  if (state == START_FOUND)
59  state = END_FOUND;
60  break;
61  default:
62  if (state == START_NOT_FOUND) {
63  off = buf - start;
64  state = START_FOUND;
65  } else if (state == END_FOUND) {
66  state = OFFSET_IMPOSSIBLE;
67  }
68  if (pb)
69  avio_write(pb, buf, len);
70  size += len;
71  break;
72  }
73  buf += len;
74  }
75 
76  if (offset)
77  *offset = state != OFFSET_IMPOSSIBLE ? off : -1;
78 
79  return size;
80 }
81 
82 int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size)
83 {
84  return av1_filter_obus(pb, buf, size, NULL);
85 }
86 
87 int ff_av1_filter_obus_buf(const uint8_t *in, uint8_t **out,
88  int *size, int *offset)
89 {
90  FFIOContext pb;
91  uint8_t *buf;
92  int len, off, ret;
93 
94  len = ret = av1_filter_obus(NULL, in, *size, &off);
95  if (ret < 0) {
96  return ret;
97  }
98  if (off >= 0) {
99  *out = (uint8_t *)in;
100  *size = len;
101  *offset = off;
102 
103  return 0;
104  }
105 
107  if (!buf)
108  return AVERROR(ENOMEM);
109 
110  ffio_init_context(&pb, buf, len, 1, NULL, NULL, NULL, NULL);
111 
112  ret = av1_filter_obus(&pb.pub, in, *size, NULL);
113  av_assert1(ret == len);
114 
115  memset(buf + len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
116 
117  *out = buf;
118  *size = len;
119  *offset = 0;
120 
121  return 0;
122 }
123 
124 static inline void uvlc(GetBitContext *gb)
125 {
126  int leading_zeros = 0;
127 
128  while (get_bits_left(gb)) {
129  if (get_bits1(gb))
130  break;
131  leading_zeros++;
132  }
133 
134  if (leading_zeros >= 32)
135  return;
136 
137  skip_bits_long(gb, leading_zeros);
138 }
139 
141 {
142  int twelve_bit = 0;
143  int high_bitdepth = get_bits1(gb);
144  if (seq_params->profile == FF_PROFILE_AV1_PROFESSIONAL && high_bitdepth)
145  twelve_bit = get_bits1(gb);
146 
147  seq_params->bitdepth = 8 + (high_bitdepth * 2) + (twelve_bit * 2);
148 
149  if (seq_params->profile == FF_PROFILE_AV1_HIGH)
150  seq_params->monochrome = 0;
151  else
152  seq_params->monochrome = get_bits1(gb);
153 
154  seq_params->color_description_present_flag = get_bits1(gb);
155  if (seq_params->color_description_present_flag) {
156  seq_params->color_primaries = get_bits(gb, 8);
157  seq_params->transfer_characteristics = get_bits(gb, 8);
158  seq_params->matrix_coefficients = get_bits(gb, 8);
159  } else {
163  }
164 
165  if (seq_params->monochrome) {
166  seq_params->color_range = get_bits1(gb);
167  seq_params->chroma_subsampling_x = 1;
168  seq_params->chroma_subsampling_y = 1;
169  seq_params->chroma_sample_position = 0;
170  return 0;
171  } else if (seq_params->color_primaries == AVCOL_PRI_BT709 &&
173  seq_params->matrix_coefficients == AVCOL_SPC_RGB) {
174  seq_params->chroma_subsampling_x = 0;
175  seq_params->chroma_subsampling_y = 0;
176  } else {
177  seq_params->color_range = get_bits1(gb);
178 
179  if (seq_params->profile == FF_PROFILE_AV1_MAIN) {
180  seq_params->chroma_subsampling_x = 1;
181  seq_params->chroma_subsampling_y = 1;
182  } else if (seq_params->profile == FF_PROFILE_AV1_HIGH) {
183  seq_params->chroma_subsampling_x = 0;
184  seq_params->chroma_subsampling_y = 0;
185  } else {
186  if (twelve_bit) {
187  seq_params->chroma_subsampling_x = get_bits1(gb);
188  if (seq_params->chroma_subsampling_x)
189  seq_params->chroma_subsampling_y = get_bits1(gb);
190  else
191  seq_params->chroma_subsampling_y = 0;
192  } else {
193  seq_params->chroma_subsampling_x = 1;
194  seq_params->chroma_subsampling_y = 0;
195  }
196  }
197  if (seq_params->chroma_subsampling_x && seq_params->chroma_subsampling_y)
198  seq_params->chroma_sample_position = get_bits(gb, 2);
199  }
200 
201  skip_bits1(gb); // separate_uv_delta_q
202 
203  return 0;
204 }
205 
206 static int parse_sequence_header(AV1SequenceParameters *seq_params, const uint8_t *buf, int size)
207 {
208  GetBitContext gb;
209  int reduced_still_picture_header;
210  int frame_width_bits_minus_1, frame_height_bits_minus_1;
211  int size_bits, ret;
212 
214  if (size_bits < 0)
215  return size_bits;
216 
217  ret = init_get_bits(&gb, buf, size_bits);
218  if (ret < 0)
219  return ret;
220 
221  memset(seq_params, 0, sizeof(*seq_params));
222 
223  seq_params->profile = get_bits(&gb, 3);
224 
225  skip_bits1(&gb); // still_picture
226  reduced_still_picture_header = get_bits1(&gb);
227 
228  if (reduced_still_picture_header) {
229  seq_params->level = get_bits(&gb, 5);
230  seq_params->tier = 0;
231  } else {
232  int initial_display_delay_present_flag, operating_points_cnt_minus_1;
233  int decoder_model_info_present_flag, buffer_delay_length_minus_1;
234 
235  if (get_bits1(&gb)) { // timing_info_present_flag
236  skip_bits_long(&gb, 32); // num_units_in_display_tick
237  skip_bits_long(&gb, 32); // time_scale
238 
239  if (get_bits1(&gb)) // equal_picture_interval
240  uvlc(&gb); // num_ticks_per_picture_minus_1
241 
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);
245  skip_bits_long(&gb, 32); // num_units_in_decoding_tick
246  skip_bits(&gb, 10); // buffer_removal_time_length_minus_1 (5)
247  // frame_presentation_time_length_minus_1 (5)
248  }
249  } else
250  decoder_model_info_present_flag = 0;
251 
252  initial_display_delay_present_flag = get_bits1(&gb);
253 
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;
257 
258  skip_bits(&gb, 12); // operating_point_idc
259  seq_level_idx = get_bits(&gb, 5);
260 
261  if (seq_level_idx > 7)
262  seq_tier = get_bits1(&gb);
263  else
264  seq_tier = 0;
265 
266  if (decoder_model_info_present_flag) {
267  if (get_bits1(&gb)) { // decoder_model_present_for_this_op
268  skip_bits_long(&gb, buffer_delay_length_minus_1 + 1); // decoder_buffer_delay
269  skip_bits_long(&gb, buffer_delay_length_minus_1 + 1); // encoder_buffer_delay
270  skip_bits1(&gb); // low_delay_mode_flag
271  }
272  }
273 
274  if (initial_display_delay_present_flag) {
275  if (get_bits1(&gb)) // initial_display_delay_present_for_this_op
276  skip_bits(&gb, 4); // initial_display_delay_minus_1
277  }
278 
279  if (i == 0) {
280  seq_params->level = seq_level_idx;
281  seq_params->tier = seq_tier;
282  }
283  }
284  }
285 
286  frame_width_bits_minus_1 = get_bits(&gb, 4);
287  frame_height_bits_minus_1 = get_bits(&gb, 4);
288 
289  skip_bits(&gb, frame_width_bits_minus_1 + 1); // max_frame_width_minus_1
290  skip_bits(&gb, frame_height_bits_minus_1 + 1); // max_frame_height_minus_1
291 
292  if (!reduced_still_picture_header) {
293  if (get_bits1(&gb)) // frame_id_numbers_present_flag
294  skip_bits(&gb, 7); // delta_frame_id_length_minus_2 (4), additional_frame_id_length_minus_1 (3)
295  }
296 
297  skip_bits(&gb, 3); // use_128x128_superblock (1), enable_filter_intra (1), enable_intra_edge_filter (1)
298 
299  if (!reduced_still_picture_header) {
300  int enable_order_hint, seq_force_screen_content_tools;
301 
302  skip_bits(&gb, 4); // enable_interintra_compound (1), enable_masked_compound (1)
303  // enable_warped_motion (1), enable_dual_filter (1)
304 
305  enable_order_hint = get_bits1(&gb);
306  if (enable_order_hint)
307  skip_bits(&gb, 2); // enable_jnt_comp (1), enable_ref_frame_mvs (1)
308 
309  if (get_bits1(&gb)) // seq_choose_screen_content_tools
310  seq_force_screen_content_tools = 2;
311  else
312  seq_force_screen_content_tools = get_bits1(&gb);
313 
314  if (seq_force_screen_content_tools) {
315  if (!get_bits1(&gb)) // seq_choose_integer_mv
316  skip_bits1(&gb); // seq_force_integer_mv
317  }
318 
319  if (enable_order_hint)
320  skip_bits(&gb, 3); // order_hint_bits_minus_1
321  }
322 
323  skip_bits(&gb, 3); // enable_superres (1), enable_cdef (1), enable_restoration (1)
324 
325  parse_color_config(seq_params, &gb);
326 
327  skip_bits1(&gb); // film_grain_params_present
328 
329  if (get_bits_left(&gb))
330  return AVERROR_INVALIDDATA;
331 
332  return 0;
333 }
334 
335 int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size)
336 {
337  int is_av1c;
338 
339  if (size <= 0)
340  return AVERROR_INVALIDDATA;
341 
342  is_av1c = !!(buf[0] & 0x80);
343  if (is_av1c) {
344  GetBitContext gb;
345  int ret, version = buf[0] & 0x7F;
346 
347  if (version != 1 || size < 4)
348  return AVERROR_INVALIDDATA;
349 
350  ret = init_get_bits8(&gb, buf, 4);
351  if (ret < 0)
352  return ret;
353 
354  memset(seq, 0, sizeof(*seq));
355 
356  skip_bits(&gb, 8);
357  seq->profile = get_bits(&gb, 3);
358  seq->level = get_bits(&gb, 5);
359  seq->tier = get_bits(&gb, 1);
360  seq->bitdepth = get_bits(&gb, 1) * 2 + 8;
361  seq->bitdepth += get_bits(&gb, 1) * 2;
362  seq->monochrome = get_bits(&gb, 1);
363  seq->chroma_subsampling_x = get_bits(&gb, 1);
364  seq->chroma_subsampling_y = get_bits(&gb, 1);
365  seq->chroma_sample_position = get_bits(&gb, 2);
369 
370  size -= 4;
371  buf += 4;
372  }
373 
374  while (size > 0) {
375  int64_t obu_size;
376  int start_pos, type, temporal_id, spatial_id;
377  int len = parse_obu_header(buf, size, &obu_size, &start_pos,
378  &type, &temporal_id, &spatial_id);
379  if (len < 0)
380  return len;
381 
382  switch (type) {
384  if (!obu_size)
385  return AVERROR_INVALIDDATA;
386 
387  return parse_sequence_header(seq, buf + start_pos, obu_size);
388  default:
389  break;
390  }
391  size -= len;
392  buf += len;
393  }
394 
395  return is_av1c ? 0 : AVERROR_INVALIDDATA;
396 }
397 
398 int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size,
399  int write_seq_header)
400 {
401  AVIOContext *meta_pb;
402  AV1SequenceParameters seq_params;
403  PutBitContext pbc;
404  uint8_t header[4], *meta;
405  const uint8_t *seq;
406  int ret, nb_seq = 0, seq_size, meta_size;
407 
408  if (size <= 0)
409  return AVERROR_INVALIDDATA;
410 
411  if (buf[0] & 0x80) {
412  // first bit is nonzero, the passed data does not consist purely of
413  // OBUs. Expect that the data is already in AV1CodecConfigurationRecord
414  // format.
415  int config_record_version = buf[0] & 0x7f;
416  if (config_record_version != 1 || size < 4) {
417  return AVERROR_INVALIDDATA;
418  }
419 
420  avio_write(pb, buf, size);
421 
422  return 0;
423  }
424 
425  ret = avio_open_dyn_buf(&meta_pb);
426  if (ret < 0)
427  return ret;
428 
429  while (size > 0) {
430  int64_t obu_size;
431  int start_pos, type, temporal_id, spatial_id;
432  int len = parse_obu_header(buf, size, &obu_size, &start_pos,
433  &type, &temporal_id, &spatial_id);
434  if (len < 0) {
435  ret = len;
436  goto fail;
437  }
438 
439  switch (type) {
441  nb_seq++;
442  if (!obu_size || nb_seq > 1) {
444  goto fail;
445  }
446  ret = parse_sequence_header(&seq_params, buf + start_pos, obu_size);
447  if (ret < 0)
448  goto fail;
449 
450  seq = buf;
451  seq_size = len;
452  break;
453  case AV1_OBU_METADATA:
454  if (!obu_size) {
456  goto fail;
457  }
458  avio_write(meta_pb, buf, len);
459  break;
460  default:
461  break;
462  }
463  size -= len;
464  buf += len;
465  }
466 
467  if (!nb_seq) {
469  goto fail;
470  }
471 
472  init_put_bits(&pbc, header, sizeof(header));
473 
474  put_bits(&pbc, 1, 1); // marker
475  put_bits(&pbc, 7, 1); // version
476  put_bits(&pbc, 3, seq_params.profile);
477  put_bits(&pbc, 5, seq_params.level);
478  put_bits(&pbc, 1, seq_params.tier);
479  put_bits(&pbc, 1, seq_params.bitdepth > 8);
480  put_bits(&pbc, 1, seq_params.bitdepth == 12);
481  put_bits(&pbc, 1, seq_params.monochrome);
482  put_bits(&pbc, 1, seq_params.chroma_subsampling_x);
483  put_bits(&pbc, 1, seq_params.chroma_subsampling_y);
484  put_bits(&pbc, 2, seq_params.chroma_sample_position);
485  put_bits(&pbc, 8, 0); // padding
486  flush_put_bits(&pbc);
487 
488  avio_write(pb, header, sizeof(header));
489  if (write_seq_header) {
490  avio_write(pb, seq, seq_size);
491  }
492 
493  meta_size = avio_get_dyn_buf(meta_pb, &meta);
494  if (meta_size)
495  avio_write(pb, meta, meta_size);
496 
497 fail:
498  ffio_free_dyn_buf(&meta_pb);
499 
500  return ret;
501 }
parse_sequence_header
static int parse_sequence_header(AV1SequenceParameters *seq_params, const uint8_t *buf, int size)
Definition: av1.c:206
skip_bits_long
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:291
AV1_OBU_REDUNDANT_FRAME_HEADER
@ AV1_OBU_REDUNDANT_FRAME_HEADER
Definition: av1.h:36
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:839
AVERROR
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
out
FILE * out
Definition: movenc.c:54
init_put_bits
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
Definition: put_bits.h:62
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:221
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:499
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition: pixfmt.h:526
AV1_OBU_TEMPORAL_DELIMITER
@ AV1_OBU_TEMPORAL_DELIMITER
Definition: av1.h:31
avio_get_dyn_buf
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
Definition: aviobuf.c:1495
FFIOContext
Definition: avio_internal.h:29
init_get_bits
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:649
AV1SequenceParameters::chroma_subsampling_y
uint8_t chroma_subsampling_y
Definition: av1.h:35
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:467
av1_filter_obus
static int av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size, int *offset)
Definition: av1.c:32
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
av1_parse.h
AVCOL_TRC_IEC61966_2_1
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
Definition: pixfmt.h:510
fail
#define fail()
Definition: checkasm.h:131
GetBitContext
Definition: get_bits.h:61
type
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
Definition: writing_filters.txt:86
AV1SequenceParameters::color_description_present_flag
uint8_t color_description_present_flag
Definition: av1.h:37
avassert.h
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:667
avio_open_dyn_buf
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
Definition: aviobuf.c:1483
parse_obu_header
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)
Definition: av1_parse.h:107
ff_av1_filter_obus_buf
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...
Definition: av1.c:87
AV1SequenceParameters::color_range
uint8_t color_range
Definition: av1.h:41
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:474
PutBitContext
Definition: put_bits.h:50
AV1SequenceParameters::chroma_sample_position
uint8_t chroma_sample_position
Definition: av1.h:36
uvlc
static void uvlc(GetBitContext *gb)
Definition: av1.c:124
NULL
#define NULL
Definition: coverity.c:32
AVCOL_PRI_BT709
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
Definition: pixfmt.h:473
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
AV1SequenceParameters::transfer_characteristics
uint8_t transfer_characteristics
Definition: av1.h:39
AV1SequenceParameters::tier
uint8_t tier
Definition: av1.h:31
AV1SequenceParameters::monochrome
uint8_t monochrome
Definition: av1.h:33
AVIOContext
Bytestream IO Context.
Definition: avio.h:162
FF_PROFILE_AV1_MAIN
#define FF_PROFILE_AV1_MAIN
Definition: avcodec.h:1643
AV1SequenceParameters::matrix_coefficients
uint8_t matrix_coefficients
Definition: av1.h:40
get_obu_bit_length
static int get_obu_bit_length(const uint8_t *buf, int size, int type)
Definition: av1_parse.h:151
FFIOContext::pub
AVIOContext pub
Definition: avio_internal.h:30
size
int size
Definition: twinvq_data.h:10344
avio.h
state
static struct @327 state
AV1_OBU_SEQUENCE_HEADER
@ AV1_OBU_SEQUENCE_HEADER
Definition: av1.h:30
av1.h
header
static const uint8_t header[24]
Definition: sdr2.c:67
ff_isom_write_av1c
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.
Definition: av1.c:398
avio_write
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Definition: aviobuf.c:232
parse_color_config
static int parse_color_config(AV1SequenceParameters *seq_params, GetBitContext *gb)
Definition: av1.c:140
offset
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
Definition: writing_filters.txt:86
skip_bits1
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:538
version
version
Definition: libkvazaar.c:313
AV1SequenceParameters::profile
uint8_t profile
Definition: av1.h:29
AV1SequenceParameters::color_primaries
uint8_t color_primaries
Definition: av1.h:38
AV1_OBU_PADDING
@ AV1_OBU_PADDING
Definition: av1.h:39
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
avio_internal.h
ffio_init_context
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))
Definition: aviobuf.c:81
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:53
AV1SequenceParameters::level
uint8_t level
Definition: av1.h:30
len
int len
Definition: vorbis_enc_data.h:426
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:528
FF_PROFILE_AV1_PROFESSIONAL
#define FF_PROFILE_AV1_PROFESSIONAL
Definition: avcodec.h:1645
avcodec.h
ff_av1_parse_seq_header
int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int size)
Parses a Sequence Header from the the provided buffer.
Definition: av1.c:335
ffio_free_dyn_buf
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
Definition: aviobuf.c:1556
ret
ret
Definition: filter_design.txt:187
AV1_OBU_TILE_LIST
@ AV1_OBU_TILE_LIST
Definition: av1.h:37
ff_av1_filter_obus
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 ...
Definition: av1.c:82
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
AV1SequenceParameters::chroma_subsampling_x
uint8_t chroma_subsampling_x
Definition: av1.h:34
mem.h
flush_put_bits
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:143
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV1SequenceParameters::bitdepth
uint8_t bitdepth
Definition: av1.h:32
FF_PROFILE_AV1_HIGH
#define FF_PROFILE_AV1_HIGH
Definition: avcodec.h:1644
AV1SequenceParameters
Definition: av1.h:28
put_bits.h
AV1_OBU_METADATA
@ AV1_OBU_METADATA
Definition: av1.h:34