28 #define UNCHECKED_BITSTREAM_READER 1
67 int mb_x,
int mb_y,
int mb_intra,
int mb_skipped)
125 offset[2] = (y >> vshift) * src->
linesize[1];
142 static const int8_t top[12] = {
145 static const int8_t left[12] = {
151 for (i = 0; i < 4; i++) {
155 "top block unavailable for requested intra4x4 mode %d at %d %d\n",
165 static const int mask[4] = { 0x8000, 0x2000, 0x80, 0x20 };
166 for (i = 0; i < 4; i++)
171 "left block unavailable for requested intra4x4 mode %d at %d %d\n",
188 int mode,
int is_chroma)
195 "out of range intra chroma pred mode at %d %d\n",
204 "top block unavailable for requested intra mode at %d %d\n",
214 "left block unavailable for requested intra mode at %d %d\n",
231 int *dst_length,
int *consumed,
int length)
243 #define STARTCODE_TEST \
244 if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
245 if (src[i + 2] != 3 && src[i + 2] != 0) { \
252 #if HAVE_FAST_UNALIGNED
253 #define FIND_FIRST_ZERO \
254 if (i > 0 && !src[i]) \
260 for (i = 0; i + 1 <
length; i += 9) {
262 (
AV_RN64A(src + i) - 0x0100010001000101ULL)) &
263 0x8000800080008080ULL))
270 for (i = 0; i + 1 <
length; i += 5) {
272 (
AV_RN32A(src + i) - 0x01000101U)) &
281 for (i = 0; i + 1 <
length; i += 2) {
284 if (i > 0 && src[i - 1] == 0)
302 memcpy(dst, src, length);
309 while (si + 2 < length) {
311 if (src[si + 2] > 3) {
312 dst[di++] = src[si++];
313 dst[di++] = src[si++];
314 }
else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) {
315 if (src[si + 2] == 3) {
324 dst[di++] = src[si++];
327 dst[di++] = src[si++];
350 for (r = 1; r < 9; r++) {
416 big_mb_num *
sizeof(uint16_t),
fail)
436 big_mb_num *
sizeof(uint32_t),
fail);
438 big_mb_num *
sizeof(uint32_t),
fail);
442 const int b_xy = 4 * x + 4 * y * h->
b_stride;
468 int yc_size = y_size + 2 * c_size;
479 memset(er, 0,
sizeof(*er));
481 if (CONFIG_ERROR_RESILIENCE) {
513 yc_size *
sizeof(int16_t),
fail);
517 for (i = 0; i < yc_size; i++)
528 int parse_extradata);
535 if (!buf || size <= 0)
540 const unsigned char *p =
buf;
546 "avcC %d too short\n", size);
553 cnt = *(p + 5) & 0x1f;
555 for (i = 0; i < cnt; i++) {
557 if(nalsize > size - (p-buf))
562 "Decoding sps %d from avcC failed\n", i);
569 for (i = 0; i < cnt; i++) {
571 if(nalsize > size - (p-buf))
576 "Decoding pps %d from avcC failed\n", i);
704 "Error resilience with slice threads is enabled. It is unsafe and unsupported and may crash. "
705 "Use it at your own risk\n");
720 memset(h, 0,
sizeof(*h));
744 int i, pics, out_of_order, out_idx;
918 for (i = 0; 1; i++) {
930 out_of_order =
FFMAX(out_of_order, 1);
1005 int luma_def, chroma_def;
1025 for (list = 0; list < 2; list++) {
1028 for (i = 0; i < sl->
ref_count[list]; i++) {
1029 int luma_weight_flag, chroma_weight_flag;
1032 if (luma_weight_flag) {
1047 if (chroma_weight_flag) {
1049 for (j = 0; j < 2; j++) {
1060 for (j = 0; j < 2; j++) {
1164 int abs_frame_num, expected_delta_per_poc_cycle, expectedpoc;
1175 expected_delta_per_poc_cycle = 0;
1180 if (abs_frame_num > 0) {
1184 expectedpoc = poc_cycle_cnt * expected_delta_per_poc_cycle;
1185 for (i = 0; i <= frame_num_in_poc_cycle; i++)
1193 field_poc[0] = expectedpoc + h->
delta_poc[0];
1209 pic_field_poc[0] = field_poc[0];
1211 pic_field_poc[1] = field_poc[1];
1212 *pic_poc =
FFMIN(pic_field_poc[0], pic_field_poc[1]);
1246 int ref_count[2], list_count;
1247 int num_ref_idx_active_override_flag;
1259 num_ref_idx_active_override_flag =
get_bits1(&sl->
gb);
1261 if (num_ref_idx_active_override_flag) {
1270 if (ref_count[0]-1 > max[0] || ref_count[1]-1 > max[1]){
1271 av_log(h->
avctx,
AV_LOG_ERROR,
"reference overflow %u > %u or %u > %u\n", ref_count[0]-1, max[0], ref_count[1]-1, max[1]);
1283 ref_count[0] = ref_count[1] = 0;
1301 const uint8_t *ptr,
int dst_length,
1302 int i,
int next_avc)
1305 buf[i] == 0x00 && buf[i + 1] == 0x00 &&
1306 buf[i + 2] == 0x01 && buf[i + 3] == 0xE0)
1310 while (dst_length > 0 && ptr[dst_length - 1] == 0)
1321 int next_avc = h->
is_avc ? 0 : buf_size;
1324 int nals_needed = 0;
1325 int first_slice = 0;
1330 int dst_length, bit_length, consumed;
1333 if (buf_index >= next_avc) {
1337 next_avc = buf_index + nalsize;
1340 if (buf_index >= buf_size)
1342 if (buf_index >= next_avc)
1347 next_avc - buf_index);
1349 if (!ptr || dst_length < 0)
1352 buf_index += consumed;
1355 buf_index, next_avc);
1365 nals_needed = nal_index;
1374 nals_needed = nal_index;
1384 int parse_extradata)
1389 unsigned context_count;
1391 int nals_needed = 0;
1409 if (buf_size > 8 &&
AV_RB32(buf) == 1 &&
AV_RB32(buf+5) > (
unsigned)buf_size) {
1411 }
else if(buf_size > 3 &&
AV_RB32(buf) > 1 &&
AV_RB32(buf) <= (
unsigned)buf_size)
1421 next_avc = h->
is_avc ? 0 : buf_size;
1431 if (buf_index >= next_avc) {
1435 next_avc = buf_index + nalsize;
1438 if (buf_index >= buf_size)
1440 if (buf_index >= next_avc)
1447 &consumed, next_avc - buf_index);
1448 if (!ptr || dst_length < 0) {
1454 buf_index + consumed, next_avc);
1458 "NAL %d/%d at %d/%d length %d\n",
1461 if (h->
is_avc && (nalsize != consumed) && nalsize)
1463 "AVC: Consumed only %d bytes instead of %d\n",
1466 buf_index += consumed;
1478 if (parse_extradata) {
1486 "Ignoring NAL %d in global header/extradata\n",
1498 if ((ptr[0] & 0xFC) == 0x98) {
1506 "Invalid mix of idr and non-idr slices\n");
1512 av_log(h,
AV_LOG_ERROR,
"invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n");
1523 if ( nals_needed >= nal_index
1568 #if FF_API_CAP_VDPAU
1569 if (CONFIG_H264_VDPAU_DECODER &&
1578 &buf[buf_index - consumed],
1582 #if FF_API_CAP_VDPAU
1583 }
else if (CONFIG_H264_VDPAU_DECODER &&
1587 sizeof(start_code));
1589 &buf[buf_index - consumed],
1611 if (h->
is_avc ? nalsize : 1) {
1613 "SPS decoding failure, trying again with the complete NAL\n");
1615 av_assert0(next_avc - buf_index + consumed == nalsize);
1616 if ((next_avc - buf_index + consumed - 1) >= INT_MAX/8)
1619 8*(next_avc - buf_index + consumed - 1));
1659 if (context_count > 1) {
1673 if (context_count) {
1687 return (ret < 0) ? ret : buf_index;
1697 if (pos + 10 > buf_size)
1732 dst->
data[i] += off;
1739 int cnt= buf[5]&0x1f;
1743 if(nalsize > buf_size - (p-buf) || p[2]!=0x67)
1752 if(nalsize > buf_size - (p-buf) || p[2]!=0x68)
1763 int buf_size = avpkt->
size;
1790 if (buf_size == 0) {
1828 if(h->
is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
1844 buf_size >= 4 && !memcmp(
"Q264", buf, 4))
1879 for (p = 0; p<4; p++) {
1893 if (CONFIG_MPEGVIDEO) {
1955 #define OFFSET(x) offsetof(H264Context, x)
1956 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
1960 {
"enable_er",
"Enable error resilience on damaged frames (unsafe)",
OFFSET(enable_er),
AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1,
VD },
1991 #if CONFIG_H264_VDPAU_DECODER && FF_API_VDPAU
1992 static const AVClass h264_vdpau_class = {
1999 AVCodec ff_h264_vdpau_decoder = {
2000 .
name =
"h264_vdpau",
2001 .long_name =
NULL_IF_CONFIG_SMALL(
"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
2013 .priv_class = &h264_vdpau_class,
struct H264Context * h264
void ff_h264_unref_picture(H264Context *h, H264Picture *pic)
const struct AVCodec * codec
int ff_h264_check_intra_pred_mode(const H264Context *h, H264SliceContext *sl, int mode, int is_chroma)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
void ff_h264_flush_change(H264Context *h)
int(* start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Called at the beginning of each frame or field picture.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, int parse_extradata)
int sei_recovery_frame_cnt
#define AV_NUM_DATA_POINTERS
#define SLICE_FLAG_ALLOW_FIELD
allow draw_horiz_band() with field slices (MPEG2 field pics)
enum AVPixelFormat backup_pix_fmt
int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count)
Call decode_slice() for each context.
5: top field, bottom field, top field repeated, in that order
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
mpeg2/4 4:2:0, h264 default for 4:2:0
This structure describes decoded (raw) audio or video data.
#define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)
int16_t mv_cache[2][5 *8][2]
Motion vector cache.
static const AVClass h264_class
ptrdiff_t const GLvoid * data
static void flush(AVCodecContext *avctx)
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
int luma_weight[48][2][2]
int edge_emu_buffer_allocated
3: top field, bottom field, in that order
#define H264_MAX_PICTURE_COUNT
#define AV_LOG_WARNING
Something somehow does not look correct.
static int init_thread_copy(AVCodecContext *avctx)
#define LIBAVUTIL_VERSION_INT
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
static av_cold int init(AVCodecContext *avctx)
av_cold int ff_h264_decode_init(AVCodecContext *avctx)
const uint8_t * ff_h264_decode_nal(H264Context *h, H264SliceContext *sl, const uint8_t *src, int *dst_length, int *consumed, int length)
Decode a network abstraction layer unit.
int bitstream_restriction_flag
#define FF_PROFILE_H264_INTRA
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
int repeat_pict
When decoding, this signals how much the picture must be delayed.
int bipred_scratchpad_allocated
static int get_last_needed_nal(H264Context *h, const uint8_t *buf, int buf_size)
#define DELAYED_PIC_REF
Value of Picture.reference when Picture is not a reference picture, but is held for delayed output...
AVBufferPool * mb_type_pool
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height)
int16_t(*[2] motion_val)[2]
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
H264Picture * delayed_pic[MAX_DELAYED_PIC_COUNT+2]
int is_avc
Used to parse AVC variant of h264.
AVBufferPool * ref_index_pool
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...
void ff_h264_free_tables(H264Context *h)
int ff_h264_get_profile(SPS *sps)
Compute profile from profile_idc and constraint_set?_flags.
int sei_reguserdata_afd_present
User data registered by Rec.
void ff_h264_decode_init_vlc(void)
#define AV_CODEC_FLAG2_CHUNKS
Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries...
int prev_poc_msb
poc_msb of the last reference pic for POC type 0
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_RB16
4: bottom field, top field, in that order
#define FRAME_RECOVERED_IDR
We have seen an IDR, so all the following frames in coded order are correctly decodable.
Views are next to each other.
int luma_weight_flag[2]
7.4.3.2 luma_weight_lX_flag
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
unsigned current_sps_id
id of the current SPS
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx)
int ff_set_ref_count(H264Context *h, H264SliceContext *sl)
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
uint8_t * chroma_pred_mode_table
enum AVDiscard skip_frame
Skip decoding for selected frames.
BYTE int const BYTE * srcp
struct AVHWAccel * hwaccel
Hardware accelerator in use.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define FF_PROFILE_H264_BASELINE
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint32_t(*[6] dequant4_coeff)[16]
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
int prev_frame_num_offset
for POC type 2
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int offset_for_non_ref_pic
void ff_h264_reset_sei(H264Context *h)
Reset SEI values at the beginning of the frame.
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
static int h264_init_context(AVCodecContext *avctx, H264Context *h)
static av_cold int end(AVCodecContext *avctx)
Multithreading support functions.
static int find_start_code(const uint8_t *buf, int buf_size, int buf_index, int next_avc)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
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_RB32
uint8_t(*[2] top_borders)[(16 *3)*2]
int frame_recovered
Initial frame has been completely recovered.
Structure to hold side data for an AVFrame.
#define PICT_BOTTOM_FIELD
static int decode_rbsp_trailing(H264Context *h, const uint8_t *src)
Identify the exact end of the bitstream.
#define AV_CODEC_CAP_HWACCEL_VDPAU
Codec can export data for HW decoding (VDPAU).
#define AV_LOG_VERBOSE
Detailed information.
AVDictionary * metadata
metadata.
int interlaced_frame
The content of the picture is interlaced.
#define MAX_DELAYED_PIC_COUNT
static void fill_rectangle(SDL_Surface *screen, int x, int y, int w, int h, int color, int update)
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
high precision timer, useful to profile code
Views are alternated temporally.
int recovered
picture at IDR or recovery point + recovery count
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVAc...
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
unsigned int rbsp_buffer_size
int last_pocs[MAX_DELAYED_PIC_COUNT]
H.264 / AVC / MPEG4 part10 codec.
void ff_h264_hl_decode_mb(const H264Context *h, H264SliceContext *sl)
H264Picture DPB[H264_MAX_PICTURE_COUNT]
int width
width and height of the video frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int has_b_frames
Size of the frame reordering buffer in the decoder.
int flags
Additional information about the frame packing.
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static int get_consumed_bytes(int pos, int buf_size)
Return the number of bytes consumed for building the current frame.
int poc_type
pic_order_cnt_type
static const uint16_t mask[17]
int is_copy
Whether the parent AVCodecContext is a copy of the context which had init() called on it...
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define ALZHEIMER_DC_L0T_PRED8x8
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int active_thread_type
Which multithreading methods are in use by the codec.
int8_t intra4x4_pred_mode_cache[5 *8]
int ff_init_poc(H264Context *h, int pic_field_poc[2], int *pic_poc)
int backup_width
Backup frame properties: needed, because they can be different between returned frame and last decode...
static void flush_dpb(AVCodecContext *avctx)
int capabilities
Codec capabilities.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
ATSC A53 Part 4 Closed Captions.
static const AVOption h264_options[]
int ff_pred_weight_table(H264Context *h, H264SliceContext *sl)
void(* decode_mb)(void *opaque, int ref, int mv_dir, int mv_type, int(*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped)
uint8_t(*[2] mvd_table)[2]
#define FF_PROFILE_H264_HIGH_422
int prev_interlaced_frame
Complement sei_pic_struct SEI_PIC_STRUCT_TOP_BOTTOM and SEI_PIC_STRUCT_BOTTOM_TOP indicate interlaced...
int flags
AV_CODEC_FLAG_*.
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
int direct_spatial_mv_pred
unsigned int top_samples_available
static AVOnce h264_vlc_init
static av_always_inline uint32_t pack16to32(unsigned a, unsigned b)
int valid_recovery_point
Are the SEI recovery points looking valid.
static const uint8_t offset[127][2]
uint8_t * list_counts
Array of list_count per MB specifying the slice type.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
int offset_for_top_to_bottom_field
#define FIELD_OR_MBAFF_PICTURE(h)
int slice_type_nos
S free slice type (SI/SP are remapped to I/P)
int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
Decode a slice header.
static const uint8_t scan8[16 *3+3]
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
uint8_t * error_status_table
int nal_length_size
Number of bytes used for nal length (1, 2 or 4)
useful rectangle filling function
void ff_vdpau_h264_picture_start(H264Context *h)
uint8_t nb_components
The number of components each pixel has, (1-4)
static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, int(*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped)
Views are packed per line, as if interlaced.
int sei_anticlockwise_rotation
void(* draw_horiz_band)(struct AVCodecContext *s, const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height)
If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band...
enum AVPictureType pict_type
Picture type of the frame.
int frame_num_offset
for POC type 2
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define FF_THREAD_FRAME
Decode more than one frame at once.
uint16_t * slice_table
slice_table_base + 2*mb_stride + 1
int poc_cycle_length
num_ref_frames_in_pic_order_cnt_cycle
int sei_frame_packing_present
frame_packing_arrangment SEI message
int width
picture width / height.
#define AV_FRAME_FLAG_CORRUPT
The frame data may be corrupted, e.g.
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
PPS * pps_buffers[MAX_PPS_COUNT]
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
Decode PPS.
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
Context Adaptive Binary Arithmetic Coder inline functions.
H264SliceContext * slice_ctx
#define AV_EF_EXPLODE
abort decoding on minor error detection
static int h264_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
int top_borders_allocated[2]
uint8_t active_format_description
int chroma_log2_weight_denom
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
void av_display_rotation_set(int32_t matrix[9], double angle)
Initialize a transformation matrix describing a pure counterclockwise rotation by the specified angle...
#define PART_NOT_AVAILABLE
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
uint8_t * edge_emu_buffer
Views are packed per column.
int dequant_coeff_pps
reinit tables when pps changes
static unsigned get_ue_golomb_long(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1.
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
SPS * sps_buffers[MAX_SPS_COUNT]
static const int8_t mv[256][2]
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
short offset_for_ref_frame[256]
enum AVStereo3DType type
How views are packed within the video.
int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl)
Init context Allocate buffers which are not shared amongst multiple threads.
#define AV_LOG_INFO
Standard information.
Libavcodec external API header.
H264 / AVC / MPEG4 part10 codec data table
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
static int get_bit_length(H264Context *h, const uint8_t *buf, const uint8_t *ptr, int dst_length, int i, int next_avc)
void ff_h264_remove_all_refs(H264Context *h)
int prev_frame_num
frame_num of the last pic for POC type 1/2
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int ff_h264_decode_sei(H264Context *h)
Decode SEI.
Views are next to each other, but when upscaling apply a checkerboard pattern.
int field_poc[2]
top/bottom POC
#define AV_CODEC_FLAG2_FAST
Allow non spec compliant speedup tricks.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int max_contexts
Max number of threads / contexts.
int recovery_frame
recovery_frame is the frame_num at which the next frame should be fully constructed.
main external API structure.
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
static void decode_postinit(H264Context *h, int setup_finished)
Run setup operations that must be run after slice header decoding.
int ff_h264_alloc_tables(H264Context *h)
Allocate tables.
int ff_h264_check_intra4x4_pred_mode(const H264Context *h, H264SliceContext *sl)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
int frame_packing_arrangement_type
void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, uint32_t *mbtype_table, int8_t *qscale_table, int16_t(*motion_val[2])[2], int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample)
Print debugging info for the given picture.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstre...
int constraint_set_flags
constraint_set[0-3]_flag
static unsigned int get_bits1(GetBitContext *s)
SEI_PicStructType sei_pic_struct
pic_struct in picture timing SEI message
BYTE int const BYTE int int int height
int ff_h264_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
int slice_flags
slice flags
static int get_avc_nalsize(H264Context *h, const uint8_t *buf, int buf_size, int *buf_index)
Describe the class of an AVClass context structure.
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
uint8_t non_zero_count_cache[15 *8]
non zero coeff count cache.
static int h264_decode_end(AVCodecContext *avctx)
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int pixel_shift
0 for 8-bit H264, 1 for high-bit-depth H264
int mmco_reset
MMCO_RESET set this 1.
H264Picture * cur_pic_ptr
int mb_mbaff
mb_aff_frame && mb_field_decoding_flag
#define FF_COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
int frame_packing_arrangement_cancel_flag
is previous arrangement canceled, -1 if never received
int allocate_progress
Whether to allocate progress for frame threading.
int log2_max_poc_lsb
log2_max_pic_order_cnt_lsb_minus4
6: bottom field, top field, bottom field repeated, in that order
static int is_extra(const uint8_t *buf, int buf_size)
static enum AVPixelFormat pix_fmts[]
static const uint8_t start_code[]
#define FF_BUG_AUTODETECT
autodetection
int pic_struct_present_flag
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
av_cold void ff_h264_free_context(H264Context *h)
Free any data that may have been allocated in the H264 context like SPS, PPS etc. ...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
static void idr(H264Context *h)
instantaneous decoder refresh.
int ff_h264_decode_seq_parameter_set(H264Context *h, int ignore_truncation)
Decode SPS.
discard all non reference
AVBufferPool * qscale_table_pool
H264Picture * next_output_pic
AVBufferPool * motion_val_pool
#define SLICE_SINGLETHREAD
common internal api header.
int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size)
#define FRAME_RECOVERED_SEI
Sufficient number of frames have been decoded since a SEI recovery point, so all the following frames...
Video is not stereoscopic (and metadata has to be there).
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
uint16_t * slice_table_base
int log2_max_frame_num
log2_max_frame_num_minus4 + 4
Views are packed in a checkerboard-like structure per pixel.
H.264 / AVC / MPEG4 part10 motion vector predicion.
const char * ff_h264_sei_stereo_mode(H264Context *h)
Get stereo_mode string from the h264 frame_packing_arrangement.
int workaround_bugs
Work around bugs in encoders which sometimes cannot be detected automatically.
const AVProfile ff_h264_profiles[]
int cur_chroma_format_idc
int8_t * intra4x4_pred_mode
int sei_ct_type
Bit set of clock types for fields/frames in picture timing SEI message.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
int prev_poc_lsb
poc_lsb of the last reference pic for POC type 0
#define FF_DEBUG_STARTCODE
int8_t ref_cache[2][5 *8]
#define AV_CODEC_FLAG_OUTPUT_CORRUPT
Output even those frames that might be corrupted.
int top_field_first
If the content is interlaced, is top field displayed first.
const uint16_t ff_h264_mb_sizes[4]
struct AVCodecInternal * internal
Private context used for internal data.
static int ff_thread_once(char *control, void(*routine)(void))
int luma_log2_weight_denom
int chroma_weight[48][2][2][2]
int sei_display_orientation_present
display orientation SEI message
Views are on top of each other.
int content_interpretation_type
int key_frame
1 -> keyframe, 0-> not
enum AVPictureType pict_type
int current_slice
current slice number, used to initialize slice_num of each thread/context
int flags2
AV_CODEC_FLAG2_*.
H264Ref ref_list[2][48]
0..15: frame refs, 16..47: mbaff field refs.
H264Picture last_pic_for_ec
int au_pps_id
pps_id of current access unit
static void * av_mallocz_array(size_t nmemb, size_t size)
#define AV_CODEC_FLAG2_SHOW_ALL
Show all frames before the first keyframe.
unsigned int left_samples_available
uint8_t(*[2] mvd_table)[2]
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf, int buf_size)
int8_t * intra4x4_pred_mode
#define FF_PROFILE_H264_CONSTRAINED
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
int mb_field_decoding_flag
uint8_t(* non_zero_count)[48]
#define FF_PROFILE_H264_HIGH_10
uint8_t * bipred_scratchpad
AVPixelFormat
Pixel format.
This structure stores compressed data.
int sei_recovery_frame_cnt
recovery_frame_cnt from SEI message
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)
Context Adaptive Binary Arithmetic Coder.
int chroma_weight_flag[2]
7.4.3.2 chroma_weight_lX_flag
void ff_h264_init_dequant_tables(H264Context *h)