21 #ifndef AVCODEC_AV1_PARSE_H
22 #define AVCODEC_AV1_PARSE_H
90 for (i = 0; i < 8; i++) {
92 ret |= (int64_t)(byte & 0x7f) << (i * 7);
100 int64_t *obu_size,
int *start_pos,
int *
type,
101 int *temporal_id,
int *spatial_id)
104 int ret, extension_flag, has_size_flag;
119 if (extension_flag) {
124 *temporal_id = *spatial_id = 0;
127 *obu_size = has_size_flag ?
leb128(&gb)
128 : buf_size - 1 - extension_flag;
135 size = *obu_size + *start_pos;
149 if (size > INT_MAX / 8)
155 while (size > 0 && buf[size - 1] == 0)
163 if (size > INT_MAX / 8)
int ff_av1_extract_obu(AV1OBU *obu, const uint8_t *buf, int length, void *logctx)
Extract an OBU from a raw bitstream.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_av1_packet_split(AV1Packet *pkt, const uint8_t *buf, int length, void *logctx)
Split an input packet into OBUs.
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
static int get_bits_left(GetBitContext *gb)
GetBitContext gb
GetBitContext initialized to the start of the payload.
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)
Libavcodec external API header.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL byte
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
int size_bits
Size, in bits, of just the data, excluding the trailing_one_bit and any trailing padding.
An input packet split into OBUs.
int raw_size
Size of entire OBU, including header.
static int64_t leb128(GetBitContext *gb)
static int get_obu_bit_length(const uint8_t *buf, int size, int type)
void ff_av1_packet_uninit(AV1Packet *pkt)
Free all the allocated memory in the packet.