#define AVCODEC_H264_H
#include "libavutil/intreadwrite.h"
+#include "libavutil/thread.h"
#include "cabac.h"
#include "error_resilience.h"
#include "get_bits.h"
#include "h264dsp.h"
#include "h264pred.h"
#include "h264qpel.h"
+#include "internal.h"
#include "mpegutils.h"
#include "parser.h"
#include "qpeldsp.h"
typedef enum {
SEI_TYPE_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1)
SEI_TYPE_PIC_TIMING = 1, ///< picture timing
+ SEI_TYPE_USER_DATA_REGISTERED = 4, ///< registered user data as specified by Rec. ITU-T T.35
SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data
SEI_TYPE_RECOVERY_POINT = 6, ///< recovery point (frame # to decoder sync)
SEI_TYPE_FRAME_PACKING = 45, ///< frame packing arrangement
} MMCO;
typedef struct H264Picture {
- struct AVFrame f;
+ AVFrame *f;
ThreadFrame tf;
AVBufferRef *qscale_table_buf;
int mbaff; ///< 1 -> MBAFF frame 0-> not MBAFF
int field_picture; ///< whether or not picture was encoded in separate fields
- int needs_realloc; ///< picture needs to be reallocated (eg due to a frame size change)
int reference;
int recovered; ///< picture at IDR or recovery point + recovery count
} H264Picture;
+typedef struct H264Ref {
+ uint8_t *data[3];
+ int linesize[3];
+
+ int reference;
+ int poc;
+ int pic_id;
+
+ H264Picture *parent;
+} H264Ref;
+
typedef struct H264SliceContext {
struct H264Context *h264;
GetBitContext gb;
unsigned int topright_samples_available;
unsigned int left_samples_available;
+ ptrdiff_t linesize, uvlinesize;
ptrdiff_t mb_linesize; ///< may be equal to s->linesize or s->linesize * 2, for mbaff
ptrdiff_t mb_uvlinesize;
int mb_xy;
int resync_mb_x;
int resync_mb_y;
+ // index of the first MB of the next slice
+ int next_slice_idx;
int mb_skip_run;
int is_complex;
*/
unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode
unsigned int list_count;
- H264Picture ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs.
+ H264Ref ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs.
* Reordered version of default_ref_list
* according to picture reordering in slice header */
int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
H264QpelContext h264qpel;
GetBitContext gb;
- H264Picture *DPB;
+ H264Picture DPB[H264_MAX_PICTURE_COUNT];
H264Picture *cur_pic_ptr;
H264Picture cur_pic;
/* coded dimensions -- 16 * mb w/h */
int width, height;
- ptrdiff_t linesize, uvlinesize;
int chroma_x_shift, chroma_y_shift;
int droppable;
*/
int max_pic_num;
- H264Picture default_ref_list[2][32]; ///< base reference list for all slices of a coded picture
H264Picture *short_ref[32];
H264Picture *long_ref[32];
H264Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size?
int last_pocs[MAX_DELAYED_PIC_COUNT];
H264Picture *next_output_pic;
- int outputed_poc;
int next_outputed_poc;
/**
* @name Members for slice based multithreading
* @{
*/
- struct H264Context *thread_context[H264_MAX_THREADS];
-
/**
* current slice number, used to initalize slice_num of each thread/context
*/
enum AVPictureType pict_type;
- int last_slice_type;
/** @} */
/**
int sei_anticlockwise_rotation;
int sei_hflip, sei_vflip;
+ /**
+ * User data registered by Rec. ITU-T T.35 SEI
+ */
+ int sei_reguserdata_afd_present;
+ uint8_t active_format_description;
+ int a53_caption_size;
+ uint8_t *a53_caption;
+
/**
* Bit set of clock types for fields/frames in picture timing SEI message.
* For each found ct_type, appropriate bit is set (e.g., bit 1 for
int frame_recovered; ///< Initial frame has been completely recovered
+ /* for frame threading, this is set to 1
+ * after finish_setup() has been called, so we cannot modify
+ * some context properties (which are supposed to stay constant between
+ * slices) anymore */
+ int setup_finished;
// Timestamp stuff
int sei_buffering_period_present; ///< Buffering period SEI flag
int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
- int cur_chroma_format_idc;
+ int enable_er;
AVBufferPool *qscale_table_pool;
AVBufferPool *mb_type_pool;
*/
int ff_h264_alloc_tables(H264Context *h);
-/**
- * Fill the default_ref_list.
- */
-int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl);
-
int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl);
void ff_h264_fill_mbaff_ref_list(H264Context *h, H264SliceContext *sl);
void ff_h264_remove_all_refs(H264Context *h);
const int top = sl->intra4x4_pred_mode_cache[index8 - 8];
const int min = FFMIN(left, top);
- tprintf(h->avctx, "mode:%d %d min:%d\n", left, top, min);
+ ff_tlog(h->avctx, "mode:%d %d min:%d\n", left, top, min);
if (min < 0)
return DC_PRED;
void ff_h264_unref_picture(H264Context *h, H264Picture *pic);
int ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl);
-int ff_h264_set_parameter_from_sps(H264Context *h);
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height);
int ff_init_poc(H264Context *h, int pic_field_poc[2], int *pic_poc);
int ff_pred_weight_table(H264Context *h, H264SliceContext *sl);
int ff_set_ref_count(H264Context *h, H264SliceContext *sl);
-int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Context *h0);
+int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl);
int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count);
int ff_h264_update_thread_context(AVCodecContext *dst,
const AVCodecContext *src);
void ff_h264_flush_change(H264Context *h);
-void ff_h264_free_tables(H264Context *h, int free_rbsp);
+void ff_h264_free_tables(H264Context *h);
#endif /* AVCODEC_H264_H */