FFmpeg
Functions
av1.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavcodec/av1.h"
#include "libavcodec/av1_parse.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/put_bits.h"
#include "av1.h"
#include "avio.h"
#include "avio_internal.h"

Go to the source code of this file.

Functions

static int av1_filter_obus (AVIOContext *pb, const uint8_t *buf, int size, int *offset)
 
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 to the provided AVIOContext. More...
 
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 buffer, avoiding allocations and copies if possible. More...
 
static void uvlc (GetBitContext *gb)
 
static int parse_color_config (AV1SequenceParameters *seq_params, GetBitContext *gb)
 
static int parse_sequence_header (AV1SequenceParameters *seq_params, const uint8_t *buf, int size)
 
int ff_av1_parse_seq_header (AV1SequenceParameters *seq, const uint8_t *buf, int size)
 Parses a Sequence Header from the the provided buffer. More...
 
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. More...
 

Function Documentation

◆ av1_filter_obus()

static int av1_filter_obus ( AVIOContext pb,
const uint8_t *  buf,
int  size,
int offset 
)
static

Definition at line 32 of file av1.c.

Referenced by ff_av1_filter_obus(), and ff_av1_filter_obus_buf().

◆ 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 to the provided AVIOContext.

Parameters
pbpointer to the AVIOContext where the filtered bitstream shall be written; may be NULL, in which case nothing is written.
bufinput data buffer
sizesize of the input data buffer
Returns
the amount of bytes written (or would have been written in case pb had been supplied) in case of success, a negative AVERROR code in case of failure
Note
One can use NULL for pb to just get the output size.

Definition at line 82 of file av1.c.

Referenced by ff_mov_write_packet(), and mkv_reformat_av1().

◆ 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 buffer, avoiding allocations and copies if possible.

Parameters
ininput data buffer
outpointer to pointer for the returned buffer. In case of success, it is independently allocated if and only if *out differs from in.
sizesize of the input data buffer. The size of the resulting output data buffer will be written here
offsetoffset of the returned data inside *out: It runs from *out + offset (inclusive) to *out + offset + size (exclusive); is zero if *out is independently allocated.
Returns
0 in case of success, a negative AVERROR code in case of failure. On failure, *out and *size are unchanged
Note
*out will be treated as unintialized on input and will not be freed.

Definition at line 87 of file av1.c.

Referenced by ff_mov_write_packet().

◆ uvlc()

static void uvlc ( GetBitContext gb)
inlinestatic

Definition at line 124 of file av1.c.

Referenced by parse_sequence_header().

◆ parse_color_config()

static int parse_color_config ( AV1SequenceParameters seq_params,
GetBitContext gb 
)
static

Definition at line 140 of file av1.c.

Referenced by parse_sequence_header().

◆ parse_sequence_header()

static int parse_sequence_header ( AV1SequenceParameters seq_params,
const uint8_t *  buf,
int  size 
)
static

Definition at line 206 of file av1.c.

Referenced by ff_av1_parse_seq_header(), and ff_isom_write_av1c().

◆ 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.

Parameters
seqpointer to the AV1SequenceParameters where the parsed values will be written
bufinput data buffer
sizesize in bytes of the input data buffer
Returns
>= 0 in case of success, a negative AVERROR code in case of failure

Definition at line 335 of file av1.c.

Referenced by set_codec_str().

◆ 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.

Parameters
pbpointer to the AVIOContext where the av1C box shall be written
bufinput data buffer
sizesize in bytes of the input data buffer
write_seq_headerIf 1, Sequence Header OBU will be written inside the av1C box. Otherwise, Sequence Header OBU will be omitted.
Returns
>= 0 in case of success, a negative AVERROR code in case of failure

Definition at line 398 of file av1.c.

Referenced by mkv_check_new_extra_data(), mkv_write_native_codecprivate(), and mov_write_av1c_tag().