40 for (i = 0; i < 4; ++i) {
50 int parity,
int id_add){
71 while ((i[0] < len || i[1] < len) && index < def_len) {
72 while (i[0] < len && !(in[ i[0] ] && (in[ i[0] ]->
f.reference & sel)))
74 while (i[1] < len && !(in[ i[1] ] && (in[ i[1] ]->
f.reference & (sel^3))))
76 if (i[0] < len && index < def_len) {
80 if (i[1] < len && index < def_len) {
94 best_poc= dir ? INT_MIN : INT_MAX;
97 const int poc= src[i]->
poc;
98 if(((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)){
100 sorted[out_i]= src[i];
103 if(best_poc == (dir ? INT_MIN : INT_MAX))
105 limit= sorted[out_i++]->
poc - dir;
124 for(list= 0; list<2; list++){
135 if(len < h->ref_count[list])
140 if(lens[0] == lens[1] && lens[1] > 1){
152 if(len < h->ref_count[0])
197 int list,
index, pic_structure;
208 for(index=0; ; index++){
214 if(reordering_of_pic_nums_idc==3)
222 if(reordering_of_pic_nums_idc<3){
223 if(reordering_of_pic_nums_idc<2){
232 if(reordering_of_pic_nums_idc == 0) pred-= abs_diff_pic_num;
233 else pred+= abs_diff_pic_num;
262 if (ref && (ref->
f.
reference & pic_structure)) {
275 for(i=index; i+1<h->
ref_count[list]; i++){
279 for(; i >
index; i--){
295 for(index= 0; index < h->
ref_count[list]; index++){
311 for(list=0; list<2; list++){
317 field[0].
f.linesize[j] <<= 1;
392 assert(i >= 0 && i < h->short_ref_count);
477 for(i = 0; i < 16; i++){
509 int current_ref_assigned=0, err=0;
515 for(i=0; i<mmco_count; i++){
534 switch(mmco[i].opcode){
577 current_ref_assigned=1;
580 assert(mmco[i].long_arg <= 16);
582 for(j = mmco[i].long_arg; j<16; j++){
590 for(j = 0; j < 16; j++) {
602 if (!current_ref_assigned) {
614 "assignment for second field "
615 "in complementary field pair "
616 "(first field is long term)\n");
642 "number of reference frames (%d+%d) exceeds max (%d; probably "
643 "corrupt input), discarding one\n",
648 for (i = 0; i < 16; ++i)
Picture default_ref_list[2][32]
base reference list for all slices of a coded picture
#define PICT_BOTTOM_FIELD
Memory management control operation.
static int pic_num_extract(H264Context *h, int pic_num, int *structure)
Extract structure information about the picture described by pic_num in the current decoding context ...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb)
int broken_link
no_output_of_prior_pics_flag
MMCO mmco[MAX_MMCO_COUNT]
memory management control operations buffer.
int ff_h264_fill_default_ref_list(H264Context *h)
Fill the default_ref_list.
static int build_def_list(Picture *def, int def_len, Picture **in, int len, int is_long, int sel)
void ff_h264_fill_mbaff_ref_list(H264Context *h)
int ff_h264_decode_ref_pic_list_reordering(H264Context *h)
MMCOOpcode
Memory management control operation opcode.
#define FF_ARRAY_ELEMS(a)
int mmco_reset
h264 MMCO_RESET set this 1. Reordering code must not mix pictures before and after MMCO_RESET...
int slice_type_nos
S free slice type (SI/SP are remapped to I/P)
void ff_h264_remove_all_refs(H264Context *h)
int long_ref
1->long term reference 0->short term reference
int short_pic_num
pic_num without wrapping (pic_num & max_pic_num)
int luma_weight[48][2][2]
Picture ref_list[2][48]
0..15: frame refs, 16..47: mbaff field refs.
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
int chroma_weight[48][2][2][2]
H.264 / AVC / MPEG4 part10 codec.
static int get_ue_golomb(GetBitContext *gb)
read unsigned exp golomb code.
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
Picture * delayed_pic[MAX_DELAYED_PIC_COUNT+2]
void av_log(void *avcl, int level, const char *fmt,...)
static void pic_as_field(Picture *pic, const int parity)
void ff_generate_sliding_window_mmcos(H264Context *h)
static int add_sorted(Picture **sorted, Picture **src, int len, int limit, int dir)
int ref_frame_count
num_ref_frames
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static Picture * remove_short(H264Context *h, int frame_num, int ref_mask)
Picture * current_picture_ptr
pointer to the current picture
int long_ref_count
number of actual long term references
int frame_num
h264 frame_num (raw frame_num from slice header)
int max_pic_num
max_frame_num or 2*max_frame_num for field pics.
int curr_pic_num
frame_num for frames or 2*frame_num+1 for field pics.
static void remove_short_at_index(H264Context *h, int i)
Remove a picture from the short term reference list by its index in that list.
static const float pred[4]
int first_field
is 1 for the first field of a field picture 0 otherwise
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
Execute the reference picture marking (memory management control operations).
static int get_ue_golomb_31(GetBitContext *gb)
read unsigned exp golomb code, constraint to a max of 31.
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static unsigned int get_bits1(GetBitContext *s)
static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
static Picture * find_short(H264Context *h, int frame_num, int *idx)
Find a Picture in the short term reference list by frame number.
#define DELAYED_PIC_REF
Value of Picture.reference when Picture is not a reference picture, but is held for delayed output...
int field_poc[2]
h264 top/bottom POC
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
struct AVCodecContext * avctx
common internal api header.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static Picture * remove_long(H264Context *h, int i, int ref_mask)
Remove a picture from the long term reference list by its index in that list.
int long_arg
index, pic_num, or num long refs depending on opcode
int pic_id
h264 pic_num (short -> no wrap version of pic_num, pic_num & max_pic_num; long -> long_pic_num) ...
static void print_long_term(H264Context *h)
print long term list
static int unreference_pic(H264Context *h, Picture *pic, int refmask)
Mark a picture as no longer needed for reference.
#define FFSWAP(type, a, b)
static void print_short_term(H264Context *h)
print short term list
int short_ref_count
number of actual short term references