56 int mb_x,
int mb_y,
int mb_intra,
int mb_skipped)
113 offset[2] = (y >> vshift) * src->
linesize[1];
130 static const int8_t top[12] = {
133 static const int8_t left[12] = {
139 for (i = 0; i < 4; i++) {
143 "top block unavailable for requested intra4x4 mode %d at %d %d\n",
153 static const int mask[4] = { 0x8000, 0x2000, 0x80, 0x20 };
154 for (i = 0; i < 4; i++)
159 "left block unavailable for requested intra4x4 mode %d at %d %d\n",
182 "out of range intra chroma pred mode at %d %d\n",
191 "top block unavailable for requested intra mode at %d %d\n",
207 "left block unavailable for requested intra mode at %d %d\n",
217 int *dst_length,
int *consumed,
int length)
230 #define STARTCODE_TEST \
231 if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
232 if (src[i + 2] != 3) { \
239 #if HAVE_FAST_UNALIGNED
240 #define FIND_FIRST_ZERO \
241 if (i > 0 && !src[i]) \
247 for (i = 0; i + 1 < length; i += 9) {
249 (
AV_RN64A(src + i) - 0x0100010001000101ULL)) &
250 0x8000800080008080ULL))
257 for (i = 0; i + 1 < length; i += 5) {
259 (
AV_RN32A(src + i) - 0x01000101U)) &
268 for (i = 0; i + 1 < length; i += 2) {
271 if (i > 0 && src[i - 1] == 0)
277 if (i >= length - 1) {
278 *dst_length = length;
279 *consumed = length + 1;
294 while (si + 2 < length) {
296 if (src[si + 2] > 3) {
297 dst[di++] = src[si++];
298 dst[di++] = src[si++];
299 }
else if (src[si] == 0 && src[si + 1] == 0) {
300 if (src[si + 2] == 3) {
309 dst[di++] = src[si++];
312 dst[di++] = src[si++];
335 for (r = 1; r < 9; r++) {
367 if (free_rbsp && h->
DPB) {
411 row_mb_num * 8 *
sizeof(
uint8_t), fail)
413 big_mb_num * 48 *
sizeof(
uint8_t), fail)
417 big_mb_num *
sizeof(uint16_t), fail)
419 big_mb_num *
sizeof(
uint8_t), fail)
421 16 * row_mb_num *
sizeof(
uint8_t), fail);
423 16 * row_mb_num *
sizeof(
uint8_t), fail);
425 4 * big_mb_num *
sizeof(
uint8_t), fail);
427 big_mb_num *
sizeof(
uint8_t), fail)
434 big_mb_num *
sizeof(uint32_t), fail);
436 big_mb_num *
sizeof(uint32_t), fail);
440 const int b_xy = 4 * x + 4 * y * h->
b_stride;
475 int yc_size = y_size + 2 * c_size;
506 (h->
mb_num + 1) *
sizeof(
int), fail);
516 mb_array_size *
sizeof(
uint8_t), fail);
527 yc_size *
sizeof(int16_t), fail);
531 for (i = 0; i < yc_size; i++)
542 int parse_extradata);
564 cnt = *(p + 5) & 0x1f;
566 for (i = 0; i < cnt; i++) {
573 "Decoding sps %d from avcC failed\n", i);
580 for (i = 0; i < cnt; i++) {
587 "Decoding pps %d from avcC failed\n", i);
706 int i, pics, out_of_order, out_idx;
707 int invalid = 0, cnt = 0;
884 invalid += out->
poc == INT_MIN;
887 cnt + invalid == MAX_DELAYED_PIC_COUNT && cnt > 0) {
896 invalid = MAX_DELAYED_PIC_COUNT;
900 for (i = 1; i < MAX_DELAYED_PIC_COUNT &&
919 if (invalid + cnt < MAX_DELAYED_PIC_COUNT) {
939 sizeof(*h->
last_pocs) * (MAX_DELAYED_PIC_COUNT - 1));
978 int luma_def, chroma_def;
988 for (list = 0; list < 2; list++) {
991 for (i = 0; i < h->
ref_count[list]; i++) {
992 int luma_weight_flag, chroma_weight_flag;
995 if (luma_weight_flag) {
1010 if (chroma_weight_flag) {
1012 for (j = 0; j < 2; j++) {
1023 for (j = 0; j < 2; j++) {
1128 int abs_frame_num, expected_delta_per_poc_cycle, expectedpoc;
1139 expected_delta_per_poc_cycle = 0;
1144 if (abs_frame_num > 0) {
1148 expectedpoc = poc_cycle_cnt * expected_delta_per_poc_cycle;
1149 for (i = 0; i <= frame_num_in_poc_cycle; i++)
1157 field_poc[0] = expectedpoc + h->
delta_poc[0];
1173 pic_field_poc[0] = field_poc[0];
1175 pic_field_poc[1] = field_poc[1];
1176 *pic_poc =
FFMIN(pic_field_poc[0], pic_field_poc[1]);
1215 "Reenabling low delay requires a codec flush.\n");
1250 int ref_count[2], list_count;
1251 int num_ref_idx_active_override_flag, max_refs;
1260 num_ref_idx_active_override_flag =
get_bits1(&h->
gb);
1262 if (num_ref_idx_active_override_flag) {
1264 if (ref_count[0] < 1)
1268 if (ref_count[1] < 1)
1279 ref_count[0] = ref_count[1] = 0;
1284 if (ref_count[0] > max_refs || ref_count[1] > max_refs) {
1303 int buf_index,
int next_avc)
1306 for (; buf_index + 3 < next_avc; buf_index++)
1308 if (buf[buf_index] == 0 &&
1309 buf[buf_index + 1] == 0 &&
1310 buf[buf_index + 2] == 1)
1313 if (buf_index + 3 >= buf_size)
1316 return buf_index + 3;
1320 int buf_size,
int *buf_index)
1328 nalsize = (nalsize << 8) | buf[(*buf_index)++];
1329 if (nalsize <= 0 || nalsize > buf_size - *buf_index) {
1331 "AVC: nal size %d\n", nalsize);
1338 const uint8_t *ptr,
int dst_length,
1339 int i,
int next_avc)
1342 buf[i] == 0x00 && buf[i + 1] == 0x00 &&
1343 buf[i + 2] == 0x01 && buf[i + 3] == 0xE0)
1347 while (dst_length > 0 && ptr[dst_length - 1] == 0)
1358 int next_avc = h->
is_avc ? 0 : buf_size;
1361 int nals_needed = 0;
1365 int dst_length, bit_length, consumed;
1368 if (buf_index >= next_avc) {
1372 next_avc = buf_index + nalsize;
1375 if (buf_index >= buf_size)
1380 next_avc - buf_index);
1382 if (!ptr || dst_length < 0)
1385 buf_index += consumed;
1388 buf_index, next_avc);
1398 nals_needed = nal_index;
1405 nals_needed = nal_index;
1413 int parse_extradata)
1418 unsigned context_count;
1420 int nals_needed = 0;
1438 next_avc = h->
is_avc ? 0 : buf_size;
1448 if (buf_index >= next_avc) {
1452 next_avc = buf_index + nalsize;
1455 if (buf_index >= buf_size)
1462 &consumed, next_avc - buf_index);
1463 if (!ptr || dst_length < 0) {
1469 buf_index + consumed, next_avc);
1473 "NAL %d at %d/%d length %d\n",
1476 if (h->
is_avc && (nalsize != consumed) && nalsize)
1478 "AVC: Consumed only %d bytes instead of %d\n",
1481 buf_index += consumed;
1500 "Ignoring NAL unit %d during extradata parsing\n",
1509 "Invalid mix of idr and non-idr slices\n");
1562 &buf[buf_index - consumed],
1573 "Decoding in chunks is not supported for "
1574 "partitioned slices.\n");
1621 if (ret < 0 && h->is_avc && (nalsize != consumed) && nalsize) {
1623 "SPS decoding failure, trying again with the complete NAL\n");
1664 }
else if (err == 1) {
1676 if (context_count) {
1689 return (ret < 0) ? ret : buf_index;
1699 if (pos + 10 > buf_size)
1715 for (i = 0; i < 3; i++) {
1720 dst->
data[i] += off;
1729 int buf_size = avpkt->
size;
1742 if (buf_size == 0) {
1810 assert(pict->
buf[0] || !*got_frame);
#define FF_PROFILE_H264_MAIN
av_cold void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx)
void ff_h264_unref_picture(H264Context *h, H264Picture *pic)
int ff_h264_decode_seq_parameter_set(H264Context *h)
Decode SPS.
discard all frames except keyframes
uint8_t * edge_emu_buffer
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.
unsigned int top_samples_available
#define FF_PROFILE_H264_CAVLC_444
#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)
void ff_h264_free_tables(H264Context *h, int free_rbsp)
Views are packed per line, as if interlaced.
#define AV_NUM_DATA_POINTERS
#define SLICE_FLAG_ALLOW_FIELD
allow draw_horiz_band() with field slices (MPEG2 field pics)
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
GetBitContext * intra_gb_ptr
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
Views are alternated temporally.
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
3: top field, bottom field, in that order
const uint8_t * ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length)
Decode a network abstraction layer unit.
#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.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
H264ChromaContext h264chroma
av_cold int ff_h264_decode_init(AVCodecContext *avctx)
int luma_weight_flag[2]
7.4.3.2 luma_weight_lX_flag
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.
static int get_last_needed_nal(H264Context *h, const uint8_t *buf, int buf_size)
AVBufferPool * mb_type_pool
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
av_cold void ff_h264chroma_init(H264ChromaContext *c, int bit_depth)
int ff_h264_get_profile(SPS *sps)
Compute profile from profile_idc and constraint_set?_flags.
int16_t mv_cache[2][5 *8][2]
Motion vector cache.
void ff_h264_decode_init_vlc(void)
int prev_poc_msb
poc_msb of the last reference pic for POC type 0
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
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 slice_type_nos
S free slice type (SI/SP are remapped to I/P)
#define CODEC_FLAG_OUTPUT_CORRUPT
Output even those frames that might be corrupted.
static av_always_inline uint32_t pack16to32(int a, int b)
#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...
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
uint8_t * chroma_pred_mode_table
enum AVDiscard skip_frame
struct AVHWAccel * hwaccel
Hardware accelerator in use.
unsigned int crop_top
frame_cropping_rect_top_offset
static int decode_init_thread_copy(AVCodecContext *avctx)
uint8_t scaling_matrix4[6][16]
void h264_init_dequant_tables(H264Context *h)
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
#define FF_PROFILE_H264_BASELINE
uint32_t(*[6] dequant4_coeff)[16]
#define CODEC_FLAG2_CHUNKS
Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries...
av_cold void ff_h264qpel_init(H264QpelContext *c, int bit_depth)
int prev_frame_num_offset
for POC type 2
unsigned int crop_left
frame_cropping_rect_left_offset
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...
int luma_weight[48][2][2]
int bit_depth_chroma
bit_depth_chroma_minus8 + 8
Multithreading support functions.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int frame_recovered
Initial frame has been completely recovered.
#define PICT_BOTTOM_FIELD
H264Picture default_ref_list[2][32]
base reference list for all slices of a coded picture
static int decode_rbsp_trailing(H264Context *h, const uint8_t *src)
Identify the exact end of the bitstream.
#define FF_PROFILE_H264_EXTENDED
int interlaced_frame
The content of the picture is interlaced.
#define MAX_DELAYED_PIC_COUNT
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
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
int luma_log2_weight_denom
int chroma_weight[48][2][2][2]
int last_pocs[MAX_DELAYED_PIC_COUNT]
H.264 / AVC / MPEG4 part10 codec.
int ff_h264_decode_slice_header(H264Context *h, H264Context *h0)
Decode a slice header.
static int output_frame(H264Context *h, AVFrame *dst, AVFrame *src)
int ff_h264_check_intra_pred_mode(H264Context *h, 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...
#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 CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
ParseContext parse_context
int is_copy
Whether the parent AVCodecContext is a copy of the context which had init() called on it...
discard all bidirectional frames
GetBitContext * inter_gb_ptr
#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.
int ff_init_poc(H264Context *h, int pic_field_poc[2], int *pic_poc)
static void flush_dpb(AVCodecContext *avctx)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
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...
#define FF_PROFILE_H264_HIGH
int direct_spatial_mv_pred
simple assert() macros that are a bit more flexible than ISO C assert().
int overread_index
the index into ParseContext.buffer of the overread bytes
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
void ff_init_cabac_states(void)
Video is not stereoscopic (and metadata has to be there).
uint8_t * list_counts
Array of list_count per MB specifying the slice type.
#define CODEC_FLAG_LOW_DELAY
Force low delay.
int offset_for_top_to_bottom_field
#define FIELD_OR_MBAFF_PICTURE(h)
static const uint8_t scan8[16 *3+3]
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
int crop
frame_cropping_flag
uint8_t * error_status_table
int ff_pred_weight_table(H264Context *h)
uint8_t scaling_matrix8[6][64]
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int nal_length_size
Number of bytes used for nal length (1, 2 or 4)
useful rectangle filling function
av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
unsigned int left_samples_available
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 FF_THREAD_FRAME
Decode more than one frame at once.
int needs_realloc
picture needs to be reallocated (eg due to a frame size change)
int overread
the number of bytes which where irreversibly read from the next frame
uint16_t * slice_table
slice_table_base + 2*mb_stride + 1
av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
int poc_cycle_length
num_ref_frames_in_pic_order_cnt_cycle
int sei_frame_packing_present
frame_packing_arrangment SEI message
#define FF_PROFILE_UNKNOWN
#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.
static void fill_rectangle(SDL_Surface *screen, int x, int y, int w, int h, int color)
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length)
Decode PPS.
Context Adaptive Binary Arithmetic Coder inline functions.
H264Picture ref_list[2][48]
0..15: frame refs, 16..47: mbaff field refs.
int8_t intra4x4_pred_mode_cache[5 *8]
uint8_t * bipred_scratchpad
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 ff_set_ref_count(H264Context *h)
#define DELAYED_PIC_REF
Value of Picture.reference when Picture is not a reference picture, but is held for delayed output...
av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc)
Set the intra prediction function pointers.
void av_display_rotation_set(int32_t matrix[9], double angle)
Initialize a transformation matrix describing a pure rotation by the specified angle (in degrees)...
#define PART_NOT_AVAILABLE
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
if(ac->has_optimized_func)
int dequant_coeff_pps
reinit tables when pps changes
SPS * sps_buffers[MAX_SPS_COUNT]
struct H264Context * thread_context[H264_MAX_THREADS]
static const int8_t mv[256][2]
int chroma_log2_weight_denom
int bit_depth_luma
luma bit depth from sps to detect changes
short offset_for_ref_frame[256]
int chroma_format_idc
chroma format from sps to detect changes
enum AVStereo3DType type
How views are packed within the video.
#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)
#define FF_PROFILE_H264_HIGH_422_INTRA
void ff_h264_remove_all_refs(H264Context *h)
int prev_frame_num
frame_num of the last pic for POC type 1/2
int ff_h264_set_parameter_from_sps(H264Context *h)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int ff_h264_decode_sei(H264Context *h)
Decode SEI.
int field_poc[2]
top/bottom POC
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 close(AVCodecParserContext *s)
int ff_h264_check_intra4x4_pred_mode(H264Context *h)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
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 frame_packing_arrangement_type
static int find_start_code(const uint8_t *buf, int buf_size, int buf_index, int next_avc)
uint32_t state
contains the last few bytes in MSB order
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
int ff_h264_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
#define FF_PROFILE_H264_HIGH_10_INTRA
int slice_flags
slice flags
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
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
#define FF_PROFILE_H264_HIGH_444
#define FF_COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
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
void ff_h264_draw_horiz_band(H264Context *h, int y, int height)
Views are on top of each other.
#define FF_BUG_AUTODETECT
autodetection
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
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.
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_dlog(ac->avr,"%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
static void idr(H264Context *h)
instantaneous decoder refresh.
discard all non reference
AVBufferPool * qscale_table_pool
H264Picture * next_output_pic
AVBufferPool * motion_val_pool
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
#define CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
common internal api header.
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define FRAME_RECOVERED_SEI
Sufficient number of frames have been decoded since a SEI recovery point, so all the following frames...
int ff_h264_field_end(H264Context *h, int in_setup)
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
uint16_t * slice_table_base
int log2_max_frame_num
log2_max_frame_num_minus4 + 4
H.264 / AVC / MPEG4 part10 motion vector predicion.
int ff_h264_context_init(H264Context *h)
Init context Allocate buffers which are not shared amongst multiple threads.
int workaround_bugs
Work around bugs in encoders which sometimes cannot be detected automatically.
int cur_chroma_format_idc
int sei_ct_type
Bit set of clock types for fields/frames in picture timing SEI message.
static av_cold int init(AVCodecParserContext *s)
int bit_depth_luma
bit_depth_luma_minus8 + 8
int prev_poc_lsb
poc_lsb of the last reference pic for POC type 0
#define FF_DEBUG_STARTCODE
int top_field_first
If the content is interlaced, is top field displayed first.
const uint16_t ff_h264_mb_sizes[4]
uint8_t non_zero_count_cache[15 *8]
non zero coeff count cache.
int ff_h264_decode_extradata(H264Context *h)
uint8_t(*[2] top_borders)[(16 *3)*2]
struct AVCodecInternal * internal
Private context used for internal data.
Views are packed in a checkerboard-like structure per pixel.
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 initalize slice_num of each thread/context
#define FF_PROFILE_H264_HIGH_444_INTRA
#define SLICE_FLAG_CODED_ORDER
draw_horiz_band() is called in coded order instead of display
static void * av_mallocz_array(size_t nmemb, size_t size)
static int get_avc_nalsize(H264Context *h, const uint8_t *buf, int buf_size, int *buf_index)
int chroma_weight_flag[2]
7.4.3.2 chroma_weight_lX_flag
int8_t * intra4x4_pred_mode
#define FF_PROFILE_H264_CONSTRAINED
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
int(* decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
Callback for each slice.
uint8_t(* non_zero_count)[48]
#define FF_PROFILE_H264_HIGH_10
This structure stores compressed data.
int sei_recovery_frame_cnt
recovery_frame_cnt from SEI message
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)
void ff_h264_hl_decode_mb(H264Context *h)
unsigned int rbsp_buffer_size[2]
Context Adaptive Binary Arithmetic Coder.
int8_t ref_cache[2][5 *8]
static const AVProfile profiles[]