28 #define UNCHECKED_BITSTREAM_READER 1
64 int mb_x,
int mb_y,
int mb_intra,
int mb_skipped)
122 offset[2] = (y >> vshift) * src->
linesize[1];
139 static const int8_t top[12] = {
142 static const int8_t left[12] = {
148 for (i = 0; i < 4; i++) {
152 "top block unavailable for requested intra4x4 mode %d at %d %d\n",
162 static const int mask[4] = { 0x8000, 0x2000, 0x80, 0x20 };
163 for (i = 0; i < 4; i++)
168 "left block unavailable for requested intra4x4 mode %d at %d %d\n",
185 int mode,
int is_chroma)
192 "out of range intra chroma pred mode at %d %d\n",
201 "top block unavailable for requested intra mode at %d %d\n",
211 "left block unavailable for requested intra mode at %d %d\n",
228 int *dst_length,
int *consumed,
int length)
240 #define STARTCODE_TEST \
241 if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
242 if (src[i + 2] != 3 && src[i + 2] != 0) { \
249 #if HAVE_FAST_UNALIGNED
250 #define FIND_FIRST_ZERO \
251 if (i > 0 && !src[i]) \
257 for (i = 0; i + 1 <
length; i += 9) {
259 (
AV_RN64A(src + i) - 0x0100010001000101ULL)) &
260 0x8000800080008080ULL))
267 for (i = 0; i + 1 <
length; i += 5) {
269 (
AV_RN32A(src + i) - 0x01000101U)) &
278 for (i = 0; i + 1 <
length; i += 2) {
281 if (i > 0 && src[i - 1] == 0)
299 memcpy(dst, src, length);
306 while (si + 2 < length) {
308 if (src[si + 2] > 3) {
309 dst[di++] = src[si++];
310 dst[di++] = src[si++];
311 }
else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) {
312 if (src[si + 2] == 3) {
321 dst[di++] = src[si++];
324 dst[di++] = src[si++];
347 for (r = 1; r < 9; r++) {
413 big_mb_num *
sizeof(uint16_t),
fail)
433 big_mb_num *
sizeof(uint32_t),
fail);
435 big_mb_num *
sizeof(uint32_t),
fail);
439 const int b_xy = 4 * x + 4 * y * h->
b_stride;
465 int yc_size = y_size + 2 * c_size;
476 memset(er, 0,
sizeof(*er));
478 if (CONFIG_ERROR_RESILIENCE) {
510 yc_size *
sizeof(int16_t),
fail);
514 for (i = 0; i < yc_size; i++)
525 int parse_extradata);
532 if (!buf || size <= 0)
537 const unsigned char *p =
buf;
543 "avcC %d too short\n", size);
550 cnt = *(p + 5) & 0x1f;
552 for (i = 0; i < cnt; i++) {
554 if(nalsize > size - (p-buf))
559 "Decoding sps %d from avcC failed\n", i);
566 for (i = 0; i < cnt; i++) {
568 if(nalsize > size - (p-buf))
573 "Decoding pps %d from avcC failed\n", i);
697 "Error resilience with slice threads is enabled. It is unsafe and unsupported and may crash. "
698 "Use it at your own risk\n");
712 memset(h, 0,
sizeof(*h));
735 int i, pics, out_of_order, out_idx;
912 for (i = 0; 1; i++) {
924 out_of_order =
FFMAX(out_of_order, 1);
999 int luma_def, chroma_def;
1019 for (list = 0; list < 2; list++) {
1022 for (i = 0; i < sl->
ref_count[list]; i++) {
1023 int luma_weight_flag, chroma_weight_flag;
1026 if (luma_weight_flag) {
1041 if (chroma_weight_flag) {
1043 for (j = 0; j < 2; j++) {
1054 for (j = 0; j < 2; j++) {
1158 int abs_frame_num, expected_delta_per_poc_cycle, expectedpoc;
1169 expected_delta_per_poc_cycle = 0;
1174 if (abs_frame_num > 0) {
1178 expectedpoc = poc_cycle_cnt * expected_delta_per_poc_cycle;
1179 for (i = 0; i <= frame_num_in_poc_cycle; i++)
1187 field_poc[0] = expectedpoc + h->
delta_poc[0];
1203 pic_field_poc[0] = field_poc[0];
1205 pic_field_poc[1] = field_poc[1];
1206 *pic_poc =
FFMIN(pic_field_poc[0], pic_field_poc[1]);
1240 int ref_count[2], list_count;
1241 int num_ref_idx_active_override_flag;
1253 num_ref_idx_active_override_flag =
get_bits1(&sl->
gb);
1255 if (num_ref_idx_active_override_flag) {
1264 if (ref_count[0]-1 > max[0] || ref_count[1]-1 > max[1]){
1265 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]);
1277 ref_count[0] = ref_count[1] = 0;
1295 const uint8_t *ptr,
int dst_length,
1296 int i,
int next_avc)
1299 buf[i] == 0x00 && buf[i + 1] == 0x00 &&
1300 buf[i + 2] == 0x01 && buf[i + 3] == 0xE0)
1304 while (dst_length > 0 && ptr[dst_length - 1] == 0)
1315 int next_avc = h->
is_avc ? 0 : buf_size;
1318 int nals_needed = 0;
1319 int first_slice = 0;
1324 int dst_length, bit_length, consumed;
1327 if (buf_index >= next_avc) {
1331 next_avc = buf_index + nalsize;
1334 if (buf_index >= buf_size)
1336 if (buf_index >= next_avc)
1341 next_avc - buf_index);
1343 if (!ptr || dst_length < 0)
1346 buf_index += consumed;
1349 buf_index, next_avc);
1359 nals_needed = nal_index;
1368 nals_needed = nal_index;
1378 int parse_extradata)
1383 unsigned context_count;
1385 int nals_needed = 0;
1403 if (buf_size > 8 &&
AV_RB32(buf) == 1 &&
AV_RB32(buf+5) > (
unsigned)buf_size) {
1405 }
else if(buf_size > 3 &&
AV_RB32(buf) > 1 &&
AV_RB32(buf) <= (
unsigned)buf_size)
1415 next_avc = h->
is_avc ? 0 : buf_size;
1425 if (buf_index >= next_avc) {
1429 next_avc = buf_index + nalsize;
1432 if (buf_index >= buf_size)
1434 if (buf_index >= next_avc)
1441 &consumed, next_avc - buf_index);
1442 if (!ptr || dst_length < 0) {
1448 buf_index + consumed, next_avc);
1452 "NAL %d/%d at %d/%d length %d\n",
1455 if (h->
is_avc && (nalsize != consumed) && nalsize)
1457 "AVC: Consumed only %d bytes instead of %d\n",
1460 buf_index += consumed;
1472 if (parse_extradata) {
1480 "Ignoring NAL %d in global header/extradata\n",
1492 if ((ptr[0] & 0xFC) == 0x98) {
1500 "Invalid mix of idr and non-idr slices\n");
1506 av_log(h,
AV_LOG_ERROR,
"invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode\n");
1517 if ( nals_needed >= nal_index
1564 #if FF_API_CAP_VDPAU
1565 if (CONFIG_H264_VDPAU_DECODER &&
1574 &buf[buf_index - consumed],
1578 #if FF_API_CAP_VDPAU
1579 }
else if (CONFIG_H264_VDPAU_DECODER &&
1583 sizeof(start_code));
1585 &buf[buf_index - consumed],
1607 if (h->
is_avc ? nalsize : 1) {
1609 "SPS decoding failure, trying again with the complete NAL\n");
1611 av_assert0(next_avc - buf_index + consumed == nalsize);
1612 if ((next_avc - buf_index + consumed - 1) >= INT_MAX/8)
1615 8*(next_avc - buf_index + consumed - 1));
1655 if (context_count > 1) {
1669 if (context_count) {
1683 return (ret < 0) ? ret : buf_index;
1693 if (pos + 10 > buf_size)
1728 dst->
data[i] += off;
1735 int cnt= buf[5]&0x1f;
1739 if(nalsize > buf_size - (p-buf) || p[2]!=0x67)
1748 if(nalsize > buf_size - (p-buf) || p[2]!=0x68)
1759 int buf_size = avpkt->
size;
1786 if (buf_size == 0) {
1824 if(h->
is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
1840 buf_size >= 4 && !memcmp(
"Q264", buf, 4))
1874 for (p = 0; p<4; p++) {
1888 if (CONFIG_MPEGVIDEO) {
1947 #define OFFSET(x) offsetof(H264Context, x)
1948 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
1952 {
"enable_er",
"Enable error resilience on damaged frames (unsafe)",
OFFSET(enable_er),
AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1,
VD },
1999 #if CONFIG_H264_VDPAU_DECODER && FF_API_VDPAU
2000 static const AVClass h264_vdpau_class = {
2007 AVCodec ff_h264_vdpau_decoder = {
2008 .
name =
"h264_vdpau",
2009 .long_name =
NULL_IF_CONFIG_SMALL(
"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
2021 .priv_class = &h264_vdpau_class,
struct H264Context * h264
void ff_h264_unref_picture(H264Context *h, H264Picture *pic)
#define FF_PROFILE_H264_HIGH_10
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
Views are packed per line, as if interlaced.
#define AV_NUM_DATA_POINTERS
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)
Views are alternated temporally.
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 FF_PROFILE_H264_HIGH_444
#define H264_MAX_PICTURE_COUNT
Views are next to each other, but when upscaling apply a checkerboard pattern.
#define AV_LOG_WARNING
Something somehow does not look correct.
#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
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
#define FF_PROFILE_H264_MAIN
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.
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)
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...
static int decode_init_thread_copy(AVCodecContext *avctx)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
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]
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...
#define FF_PROFILE_H264_EXTENDED
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.
#define FF_PROFILE_UNKNOWN
#define FF_PROFILE_H264_CONSTRAINED
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]
#define FF_PROFILE_H264_HIGH_444_INTRA
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)
#define FF_PROFILE_H264_HIGH_422_INTRA
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
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 unsigned exp golomb code.
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]
#define AV_EF_EXPLODE
abort decoding on minor error detection
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]
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_*.
#define FF_BUG_AUTODETECT
autodetection
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
void ff_init_cabac_states(void)
unsigned int top_samples_available
static av_always_inline uint32_t pack16to32(unsigned a, unsigned b)
int valid_recovery_point
Are the SEI recovery points looking valid.
Video is not stereoscopic (and metadata has to be there).
static const uint8_t offset[127][2]
uint8_t * list_counts
Array of list_count per MB specifying the slice type.
Libavcodec external API header.
#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
#define FF_DEBUG_STARTCODE
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)
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.
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 FF_PROFILE_H264_HIGH_10_INTRA
#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]
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
Decode PPS.
Context Adaptive Binary Arithmetic Coder inline functions.
H264SliceContext * slice_ctx
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)
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() ...
#define SLICE_FLAG_ALLOW_FIELD
allow draw_horiz_band() with field slices (MPEG2 field pics)
uint8_t * edge_emu_buffer
int dequant_coeff_pps
reinit tables when pps changes
#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.
H264 / AVC / MPEG4 part10 codec data table
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
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.
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
int ff_h264_decode_sei(H264Context *h)
Decode SEI.
int field_poc[2]
top/bottom POC
#define AV_CODEC_FLAG2_FAST
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE
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)
#define FF_THREAD_FRAME
Decode more than one frame at once.
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.
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 av_cold 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
int frame_packing_arrangement_cancel_flag
is previous arrangement canceled, -1 if never received
#define FF_PROFILE_H264_CAVLC_444
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
#define FF_PROFILE_H264_INTRA
static int is_extra(const uint8_t *buf, int buf_size)
static enum AVPixelFormat pix_fmts[]
static const uint8_t start_code[]
Views are on top of each other.
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.
Views are next to each other.
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 FF_PROFILE_H264_HIGH
#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...
#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
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.
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 AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
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
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.
#define FF_PROFILE_H264_BASELINE
int luma_log2_weight_denom
int chroma_weight[48][2][2][2]
Views are packed in a checkerboard-like structure per pixel.
#define FF_COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
int sei_display_orientation_present
display orientation SEI message
int content_interpretation_type
int key_frame
1 -> keyframe, 0-> not
Views are packed per column.
enum AVPictureType pict_type
int current_slice
current slice number, used to initialize slice_num of each thread/context
#define FF_PROFILE_H264_HIGH_422
int flags2
AV_CODEC_FLAG2_*.
H264Ref ref_list[2][48]
0..15: frame refs, 16..47: mbaff field refs.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
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]
static int init_thread_copy(AVCodecContext *avctx)
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
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]
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
static const AVProfile profiles[]
void ff_h264_init_dequant_tables(H264Context *h)