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;
123 for(list= 0; list<2; list++){
134 if(len < h->ref_count[list])
139 if(lens[0] == lens[1] && lens[1] > 1){
151 if(len < h->ref_count[0])
193 int list,
index, pic_structure;
204 for(index=0; ; index++){
210 if(reordering_of_pic_nums_idc==3)
218 if(reordering_of_pic_nums_idc<3){
219 if(reordering_of_pic_nums_idc<2){
228 if(reordering_of_pic_nums_idc == 0) pred-= abs_diff_pic_num;
229 else pred+= abs_diff_pic_num;
258 if (ref && (ref->
f.
reference & pic_structure)) {
271 for(i=index; i+1<h->
ref_count[list]; i++){
275 for(; i >
index; i--){
291 for(index= 0; index < h->
ref_count[list]; index++){
307 for(list=0; list<2; list++){
313 field[0].f.linesize[j] <<= 1;
387 assert(i >= 0 && i < h->short_ref_count);
471 for(i = 0; i < 16; i++){
485 for (i = 0; i < n_mmcos; i++) {
486 if (mmco1[i].opcode != mmco2[i].opcode)
496 int mmco_index = 0, i;
516 }
else if (!first_slice && mmco_index >= 0 &&
520 "Inconsistent MMCO state between slices [%d, %d, %d]\n",
529 int current_ref_assigned=0, err=0;
535 for(i=0; i<mmco_count; i++){
554 switch(mmco[i].opcode){
597 current_ref_assigned=1;
600 assert(mmco[i].long_arg <= 16);
602 for(j = mmco[i].long_arg; j<16; j++){
610 for(j = 0; j < 16; j++) {
622 if (!current_ref_assigned) {
634 "assignment for second field "
635 "in complementary field pair "
636 "(first field is long term)\n");
662 "number of reference frames (%d+%d) exceeds max (%d; probably "
663 "corrupt input), discarding one\n",
668 for (i = 0; i < 16; ++i)
713 "illegal short ref in memory management control "
714 "operation %d\n", mmco);
722 if (long_arg >= 32 ||
727 "illegal long ref in memory management control "
728 "operation %d\n", opcode);
736 "illegal memory management control operation %d\n",
754 if (first_slice && mmco_index != -1) {
756 }
else if (!first_slice && mmco_index >= 0 &&
760 "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)
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.
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)
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 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 void skip_bits1(GetBitContext *s)
#define FF_ARRAY_ELEMS(a)
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.
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
int short_ref_count
number of actual short term references