29 #define START_CODE 0x000001
46 for (i = 0; i < buf_size; i++) {
54 nut = (pc->
state64 >> 2 * 8 + 1) & 0x3F;
57 (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) {
64 int first_slice_segment_in_pic_flag = buf[i] >> 7;
65 if (first_slice_segment_in_pic_flag) {
93 const uint8_t *buf_end = buf + buf_size;
112 memset(h->
nals, 0,
sizeof(*tmp));
119 int src_length, consumed;
121 if (--buf + 2 >= buf_end)
123 src_length = buf_end -
buf;
194 int slice_address_length;
262 const uint8_t **poutbuf,
int *poutbuf_size,
282 *poutbuf_size = buf_size;
297 nut = (state >> 1) & 0x3F;
301 return ptr - 4 -
buf;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_hevc_decode_nal_sps(HEVCContext *s)
static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
static int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size)
Parse NAL units of found picture and decode some basic information.
enum AVFieldOrder field_order
#define FF_ARRAY_ELEMS(a)
enum AVPictureStructure picture_structure
Indicate whether a picture is coded as a frame, top field or bottom field.
static av_cold int end(AVCodecContext *avctx)
int ff_hevc_decode_nal_sei(HEVCContext *s)
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
int temporal_id
temporal_id_plus1 - 1
static int hevc_init(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int get_ue_golomb(GetBitContext *gb)
read unsigned exp golomb code.
unsigned int log2_max_poc_lsb
AVBufferRef * vps_list[MAX_VPS_COUNT]
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
#define PARSER_FLAG_COMPLETE_FRAMES
int ff_hevc_compute_poc(HEVCContext *s, int poc_lsb)
Compute POC of the current frame and return it.
static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf, int buf_size)
Find the end of the current frame in the bitstream.
static char * split(char *message, char delim)
int ff_hevc_decode_nal_vps(HEVCContext *s)
AVBufferRef * sps_list[MAX_SPS_COUNT]
uint8_t output_flag_present_flag
AVBufferRef * pps_list[MAX_PPS_COUNT]
static void hevc_close(AVCodecParserContext *s)
int ff_hevc_decode_nal_pps(HEVCContext *s)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define START_CODE
start_code_prefix_one_3bytes
unsigned int sps_id
seq_parameter_set_id
main external API structure.
int num_extra_slice_header_bits
uint8_t * data
The data buffer.
AVCodecParser ff_hevc_parser
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
uint64_t state64
contains the last 8 bytes in MSB order
enum NALUnitType nal_unit_type
HEVCLocalContext * HEVClc
int output_picture_number
Picture number incremented in presentation or output order.
int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length, HEVCNAL *nal)
int skipped_bytes_pos_size
common internal and external API header
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
static int hevc_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
static av_always_inline av_const int av_ceil_log2_c(int x)
Compute ceil(log2(x)).
int key_frame
Set by parser to 1 for key frames and 0 for non-key frames.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
uint8_t separate_colour_plane_flag
output (i.e. cropped) values
uint8_t dependent_slice_segments_enabled_flag