Go to the documentation of this file.
   28 #define UNCHECKED_BITSTREAM_READER 1 
   71                                   int buf_index, 
int next_avc)
 
   77     return FFMIN(buf_index, buf_size);
 
   81                                int buf_size, 
void *logctx)
 
   87     int next_avc = p->
is_avc ? 0 : buf_size;
 
   96     for (
i = 0; 
i < buf_size; 
i++) {
 
  101                 nalsize = (nalsize << 8) | buf[
i++];
 
  102             if (!nalsize || nalsize > buf_size - 
i) {
 
  104                        "remaining %d\n", nalsize, buf_size - 
i);
 
  107             next_avc = 
i + nalsize;
 
  115         } 
else if (
state <= 2) {
 
  122         } 
else if (
state <= 5) {
 
  123             int nalu_type = buf[
i] & 0x1F;
 
  175     int slice_type_nos = 
s->pict_type & 3;
 
  177     int list_count, ref_count[2];
 
  198                     if (reordering_of_pic_nums_idc < 3)
 
  200                     else if (reordering_of_pic_nums_idc > 3) {
 
  202                                "illegal reordering_of_pic_nums_idc %d\n",
 
  203                                reordering_of_pic_nums_idc);
 
  210                                "reference count %d overflow\n", 
index);
 
  229                        "illegal memory management control operation %d\n",
 
  259                                   const uint8_t * 
const buf, 
int buf_size)
 
  264     int buf_index, next_avc;
 
  266     unsigned int slice_type;
 
  267     int state = -1, got_reset = 0;
 
  268     int q264 = buf_size >=4 && !memcmp(
"Q264", buf, 4);
 
  289     next_avc      = p->
is_avc ? 0 : buf_size;
 
  292         int src_length, consumed, nalsize = 0;
 
  294         if (buf_index >= next_avc) {
 
  298             next_avc = buf_index + nalsize;
 
  301             if (buf_index >= buf_size)
 
  303             if (buf_index >= next_avc)
 
  306         src_length = next_avc - buf_index;
 
  308         state = buf[buf_index];
 
  309         switch (
state & 0x1f) {
 
  320                 if (src_length > 1000)
 
  329         buf_index += consumed;
 
  368                        "pps_id %u out of range\n", pps_id);
 
  373                        "non-existing PPS %u referenced\n", pps_id);
 
  387             s->coded_width  = 16 * 
sps->mb_width;
 
  388             s->coded_height = 16 * 
sps->mb_height;
 
  389             s->width        = 
s->coded_width  - (
sps->crop_right + 
sps->crop_left);
 
  390             s->height       = 
s->coded_height - (
sps->crop_top   + 
sps->crop_bottom);
 
  391             if (
s->width <= 0 || 
s->height <= 0) {
 
  392                 s->width  = 
s->coded_width;
 
  393                 s->height = 
s->coded_height;
 
  396             switch (
sps->bit_depth_luma) {
 
  419             if (
sps->frame_mbs_only_flag) {
 
  431             if (
sps->poc_type == 0) {
 
  439             if (
sps->poc_type == 1 &&
 
  440                 !
sps->delta_pic_order_always_zero_flag) {
 
  450             field_poc[0] = field_poc[1] = INT_MAX;
 
  535                     if (field_poc[0] < field_poc[1])
 
  537                     else if (field_poc[0] > field_poc[1])
 
  561             if (
sps->timing_info_present_flag) {
 
  566                           sps->num_units_in_tick * 2, den, 1 << 30);
 
  578     av_log(avctx, 
AV_LOG_ERROR, 
"missing picture in access unit with size %d\n", buf_size);
 
  586                       const uint8_t **poutbuf, 
int *poutbuf_size,
 
  587                       const uint8_t *buf, 
int buf_size)
 
  629         s->dts_sync_point    = INT_MIN;
 
  630         s->dts_ref_dts_delta = INT_MIN;
 
  631         s->pts_dts_delta     = INT_MIN;
 
  638     if (
s->dts_sync_point >= 0) {
 
  653             if (
s->dts_sync_point > 0)
 
  659     *poutbuf_size = buf_size;
 
  
H264_SEI_PicStructType pic_struct
 
const SPS * sps
ordinary pointer, no RefStruct reference
 
void ff_h264_sei_uninit(H264SEIContext *h)
Reset SEI values at the beginning of the frame.
 
int frame_num_offset
for POC type 2
 
static int get_bits_left(GetBitContext *gb)
 
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
 
void ff_h264_ps_uninit(H264ParamSets *ps)
Uninit H264 param sets structure.
 
@ AV_PICTURE_STRUCTURE_UNKNOWN
unknown
 
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
 
int recovery_frame_cnt
recovery_frame_cnt
 
@ H264_SEI_PIC_STRUCT_TOP_BOTTOM
3: top field, bottom field, in that order
 
const PPS * pps_list[MAX_PPS_COUNT]
RefStruct references.
 
int ref_idc
H.264 only, nal_ref_idc.
 
static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb, void *logctx)
 
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
 
#define AV_PIX_FMT_YUV420P10
 
#define PICT_BOTTOM_FIELD
 
int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps, const int *ref_count, int slice_type_nos, H264PredWeightTable *pwt, int picture_structure, void *logctx)
 
MMCOOpcode
Memory management control operation opcode.
 
uint32_t state
contains the last few bytes in MSB order
 
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
 
int prev_poc_lsb
poc_lsb of the last reference pic for POC type 0
 
int size_bits
Size, in bits, of just the data, excluding the stop bit and any trailing padding.
 
int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int bit_length)
Decode PPS.
 
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
 
@ AV_FIELD_TT
Top coded_first, top displayed first.
 
int prev_frame_num
frame_num of the last pic for POC type 1/2
 
int redundant_pic_cnt_present
redundant_pic_cnt_present_flag
 
int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb, const H264ParamSets *ps, void *logctx)
 
#define AV_PIX_FMT_YUV422P9
 
static void h264_close(AVCodecParserContext *s)
 
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
 
int ff_h264_sei_process_picture_timing(H264SEIPictureTiming *h, const SPS *sps, void *logctx)
Parse the contents of a picture timing message given an active SPS.
 
const uint8_t ff_h264_golomb_to_pict_type[5]
 
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
 
static int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *const buf, int buf_size)
Parse NAL units of found picture and decode some basic information.
 
static int h264_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
 
#define AV_PIX_FMT_YUV444P10
 
@ AV_PICTURE_STRUCTURE_FRAME
coded as frame
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
 
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
 
int arrangement_cancel_flag
is previous arrangement canceled, -1 if never received (currently H.264 only)
 
int prev_frame_num_offset
for POC type 2
 
int present
Buffering period SEI flag.
 
int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, int *is_avc, int *nal_length_size, int err_recognition, void *logctx)
 
#define AV_PIX_FMT_YUV420P9
 
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
 
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
 
int ref_frame_count
num_ref_frames
 
@ AV_PICTURE_STRUCTURE_BOTTOM_FIELD
coded as bottom field
 
int(* startcode_find_candidate)(const uint8_t *buf, int size)
Search buf from the start for up to size bytes.
 
int pic_order_present
bottom_field_pic_order_in_frame_present_flag
 
int dpb_output_delay
dpb_output_delay in picture timing SEI message, see H.264 C.2.2
 
H264SEIRecoveryPoint recovery_point
 
Rational number (pair of numerator and denominator).
 
@ AV_PICTURE_STRUCTURE_TOP_FIELD
coded as top field
 
@ AV_PICTURE_TYPE_I
Intra.
 
static unsigned int get_bits1(GetBitContext *s)
 
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 list
 
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
 
#define AV_PIX_FMT_YUV422P10
 
int level
Encoding level descriptor.
 
static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, int buf_size, void *logctx)
 
@ H264_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM
6: bottom field, top field, bottom field repeated, in that order
 
Context for storing H.264 DSP functions.
 
H2645SEIFramePacking frame_packing
 
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
 
int weighted_pred
weighted_pred_flag
 
#define AV_NOPTS_VALUE
Undefined timestamp value.
 
@ H264_SEI_PIC_STRUCT_BOTTOM_TOP
4: bottom field, top field, in that order
 
const AVCodecParser ff_h264_parser
 
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
 
@ H264_SEI_PIC_STRUCT_FRAME
0: frame
 
@ H264_SEI_PIC_STRUCT_FRAME_TRIPLING
8: frame tripling
 
int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int ignore_truncation)
Decode SPS.
 
#define PARSER_FLAG_COMPLETE_FRAMES
 
#define i(width, name, range_min, range_max)
 
@ H264_SEI_PIC_STRUCT_FRAME_DOUBLING
7: frame doubling
 
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
 
int ff_h2645_extract_rbsp(const uint8_t *src, int length, H2645RBSP *rbsp, H2645NAL *nal, int small_padding)
Extract the raw (unescaped) bitstream.
 
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
 
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
 
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
 
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
 
int ff_h264_parse_ref_count(int *plist_count, int ref_count[2], GetBitContext *gb, const PPS *pps, int slice_type_nos, int picture_structure, void *logctx)
 
H264SEIBufferingPeriod buffering_period
 
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
 
int last_picture_structure
 
#define AV_PIX_FMT_YUV444P9
 
int rbsp_buffer_alloc_size
 
av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
 
int ff_h264_init_poc(int pic_field_poc[2], int *pic_poc, const SPS *sps, H264POCContext *pc, int picture_structure, int nal_ref_idc)
 
const SPS * sps
RefStruct reference.
 
int ff_h264_get_profile(const SPS *sps)
Compute profile from profile_idc and constraint_set?_flags.
 
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
 
void ff_refstruct_replace(void *dstp, const void *src)
Ensure *dstp refers to the same object as src.
 
H2645SEIUnregistered unregistered
 
main external API structure.
 
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
 
static int find_start_code(const uint8_t *buf, int buf_size, int buf_index, int next_avc)
 
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
 
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
 
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
 
@ AV_PICTURE_TYPE_P
Predicted.
 
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
 
static av_cold int init(AVCodecParserContext *s)
 
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
 
@ H264_SEI_PIC_STRUCT_BOTTOM_FIELD
2: bottom field
 
int cpb_removal_delay
cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
 
static int get_nalsize(int nal_length_size, const uint8_t *buf, int buf_size, int *buf_index, void *logctx)
 
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
 
const PPS * pps
RefStruct reference.
 
int prev_poc_msb
poc_msb of the last reference pic for POC type 0
 
@ H264_SEI_PIC_STRUCT_TOP_FIELD
1: top field
 
@ H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP
5: top field, bottom field, top field repeated, in that order
 
H264SEIPictureTiming picture_timing