33 #define START_CODE 0x000001
35 #define IS_IRAP_NAL(nal) (nal->type >= 16 && nal->type <= 23)
36 #define IS_IDR_NAL(nal) (nal->type == HEVC_NAL_IDR_W_RADL || nal->type == HEVC_NAL_IDR_N_LP)
61 int i, num = 0, den = 0;
105 if (num != 0 && den != 0)
110 int slice_address_length;
262 for (i = 0; i < buf_size; i++) {
270 nut = (pc->
state64 >> 2 * 8 + 1) & 0x3F;
273 (nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) {
280 int first_slice_segment_in_pic_flag = buf[i] >> 7;
281 if (first_slice_segment_in_pic_flag) {
296 const uint8_t **poutbuf,
int *poutbuf_size,
322 *poutbuf_size = buf_size;
340 nut = (state >> 1) & 0x3F;
349 if (has_vps && has_sps) {
350 while (ptr - 4 > buf && ptr[-5] == 0)
352 return ptr - 4 -
buf;
int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length, void *logctx, int is_nalff, int nal_length_size, enum AVCodecID codec_id, int small_padding)
Split an input packet into NAL units.
#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 int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, AVCodecContext *avctx)
HEVCSEIPictureTiming picture_timing
AVBufferRef * vps_list[HEVC_MAX_VPS_COUNT]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int hevc_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
int width
Dimensions of the decoded video intended for presentation.
enum AVFieldOrder field_order
int coded_width
Dimensions of the coded video.
AVBufferRef * sps_list[HEVC_MAX_SPS_COUNT]
enum AVPictureStructure picture_structure
Indicate whether a picture is coded as a frame, top field or bottom field.
uint8_t vps_timing_info_present_flag
static av_cold int end(AVCodecContext *avctx)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void ff_h2645_packet_uninit(H2645Packet *pkt)
Free all the allocated memory in the packet.
AVBufferRef * pps_list[HEVC_MAX_PPS_COUNT]
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
unsigned int log2_max_poc_lsb
int ff_hevc_compute_poc(const HEVCSPS *sps, int pocTid0, int poc_lsb, int nal_unit_type)
Compute POC of the current frame and return it.
int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
int vui_timing_info_present_flag
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)
static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, int buf_size, AVCodecContext *avctx)
Parse NAL units of found picture and decode some basic information.
uint32_t vps_num_units_in_tick
uint8_t output_flag_present_flag
#define FF_ARRAY_ELEMS(a)
enum AVPixelFormat pix_fmt
#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
uint32_t vui_num_units_in_tick
static unsigned int get_bits1(GetBitContext *s)
int ff_hevc_decode_nal_sei(GetBitContext *gb, void *logctx, HEVCSEIContext *s, const HEVCParamSets *ps, int type)
static void skip_bits(GetBitContext *s, int n)
uint64_t state64
contains the last 8 bytes in MSB order
#define HEVC_MAX_SPS_COUNT
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps)
int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx, HEVCParamSets *ps, int apply_defdispwin)
void ff_hevc_reset_sei(HEVCSEIContext *s)
Reset SEI values that are stored on the Context.
int output_picture_number
Picture number incremented in presentation or output order.
common internal api header.
common internal and external API header
#define HEVC_MAX_PPS_COUNT
#define PARSER_FLAG_COMPLETE_FRAMES
int format
The format of the coded data, corresponds to enum AVPixelFormat for video and for enum AVSampleFormat...
int temporal_id
HEVC only, nuh_temporal_id_plus_1 - 1.
unsigned int right_offset
static int hevc_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
static void hevc_parser_close(AVCodecParserContext *s)
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.
uint8_t separate_colour_plane_flag
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
unsigned int bottom_offset
uint8_t dependent_slice_segments_enabled_flag