40 for (i = 0; i < 4; ++i) {
50 int parity,
int id_add){
69 while(i[0]<len || i[1]<len){
70 while (i[0] < len && !(in[ i[0] ] && (in[ i[0] ]->f.reference & sel)))
72 while (i[1] < len && !(in[ i[1] ] && (in[ i[1] ]->f.reference & (sel^3))))
92 best_poc= dir ? INT_MIN : INT_MAX;
95 const int poc= src[i]->
poc;
96 if(((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)){
98 sorted[out_i]= src[i];
101 if(best_poc == (dir ? INT_MIN : INT_MAX))
103 limit= sorted[out_i++]->
poc - dir;
122 for(list= 0; list<2; list++){
130 if(len < h->ref_count[list])
135 if(lens[0] == lens[1] && lens[1] > 1){
144 if(len < h->ref_count[0])
189 int list,
index, pic_structure;
200 for(index=0; ; index++){
206 if(reordering_of_pic_nums_idc==3)
214 if(reordering_of_pic_nums_idc<3){
215 if(reordering_of_pic_nums_idc<2){
224 if(reordering_of_pic_nums_idc == 0) pred-= abs_diff_pic_num;
225 else pred+= abs_diff_pic_num;
254 if (ref && (ref->
f.
reference & pic_structure)) {
267 for(i=index; i+1<h->
ref_count[list]; i++){
271 for(; i >
index; i--){
287 for(index= 0; index < h->
ref_count[list]; index++){
303 for(list=0; list<2; list++){
309 field[0].f.linesize[j] <<= 1;
384 assert(i >= 0 && i < h->short_ref_count);
469 for(i = 0; i < 16; i++){
483 for (i = 0; i < n_mmcos; i++) {
484 if (mmco1[i].opcode != mmco2[i].opcode)
495 int mmco_index = 0, i;
516 }
else if (!first_slice && mmco_index >= 0 &&
520 "Inconsistent MMCO state between slices [%d, %d, %d]\n",
530 int current_ref_assigned=0, err=0;
536 for(i=0; i<mmco_count; i++){
555 switch(mmco[i].opcode){
598 current_ref_assigned=1;
601 assert(mmco[i].long_arg <= 16);
603 for(j = mmco[i].long_arg; j<16; j++){
611 for(j = 0; j < 16; j++) {
623 if (!current_ref_assigned) {
635 "assignment for second field "
636 "in complementary field pair "
637 "(first field is long term)\n");
663 "number of reference frames (%d+%d) exceeds max (%d; probably "
664 "corrupt input), discarding one\n",
669 for (i = 0; i < 16; ++i)
715 "illegal short ref in memory management control "
716 "operation %d\n", mmco);
724 if (long_arg >= 32 ||
729 "illegal long ref in memory management control "
730 "operation %d\n", opcode);
738 "illegal memory management control operation %d\n",
756 if (first_slice && mmco_index != -1) {
758 }
else if (!first_slice && mmco_index >= 0 &&
762 "Inconsistent MMCO state between slices [%d, %d, %d]\n",
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 ...
static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos)
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.
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.
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)
#define FFSWAP(type, a, b)
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 ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, int first_slice)
int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
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)
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.
#define DELAYED_PIC_REF
Value of Picture.reference when Picture is not a reference picture, but is held for delayed output...
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.
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.
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.
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.
#define AVERROR_INVALIDDATA
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.
static void print_short_term(H264Context *h)
print short term list
static int build_def_list(Picture *def, Picture **in, int len, int is_long, int sel)
int short_ref_count
number of actual short term references