Commit 086acdd5 authored by Jeff Downs's avatar Jeff Downs Committed by Andreas Öman

Reindent fill_default_ref_list after changes for PAFF

patch by Jeff Downs, heydowns a borg d com
original thread:
Subject: [FFmpeg-devel] [PATCH] Implement PAFF in H.264
Date: 18/09/07 20:30

Originally committed as revision 10670 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 11cc1d8c
......@@ -2916,92 +2916,92 @@ static int fill_default_ref_list(H264Context *h){
}
}
tprintf(h->s.avctx, "current poc: %d, smallest_poc_greater_than_current: %d\n", s->current_picture_ptr->poc, smallest_poc_greater_than_current);
// find the largest poc
for(list=0; list<2; list++){
int index = 0;
int j= -99;
int step= list ? -1 : 1;
for(i=0; i<h->short_ref_count && index < h->ref_count[list]; i++, j+=step) {
int sel;
while(j<0 || j>= h->short_ref_count){
if(j != -99 && step == (list ? -1 : 1))
return -1;
step = -step;
j= smallest_poc_greater_than_current + (step>>1);
}
sel = sorted_short_ref[j].reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[list][index ]= sorted_short_ref[j];
frame_list[list][index++].pic_id= sorted_short_ref[j].frame_num;
}
short_len[list] = index;
for(i = 0; i < 16 && index < h->ref_count[ list ]; i++){
int sel;
if(h->long_ref[i] == NULL) continue;
sel = h->long_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[ list ][index ]= *h->long_ref[i];
frame_list[ list ][index++].pic_id= i;;
}
len[list] = index;
if(list && (smallest_poc_greater_than_current<=0 || smallest_poc_greater_than_current>=h->short_ref_count) && (1 < index)){
// swap the two first elements of L1 when
// L0 and L1 are identical
Picture temp= frame_list[1][0];
frame_list[1][0] = frame_list[1][1];
frame_list[1][1] = temp;
}
}
for(list=0; list<2; list++){
if (FIELD_PICTURE)
len[list] = split_field_ref_list(h->default_ref_list[list],
h->ref_count[list],
frame_list[list],
len[list],
s->picture_structure,
short_len[list]);
if(len[list] < h->ref_count[ list ])
memset(&h->default_ref_list[list][len[list]], 0, sizeof(Picture)*(h->ref_count[ list ] - len[list]));
}
tprintf(h->s.avctx, "current poc: %d, smallest_poc_greater_than_current: %d\n", s->current_picture_ptr->poc, smallest_poc_greater_than_current);
// find the largest poc
for(list=0; list<2; list++){
int index = 0;
int j= -99;
int step= list ? -1 : 1;
}else{
int index=0;
int short_len;
for(i=0; i<h->short_ref_count; i++){
for(i=0; i<h->short_ref_count && index < h->ref_count[list]; i++, j+=step) {
int sel;
sel = h->short_ref[i]->reference | structure_sel;
while(j<0 || j>= h->short_ref_count){
if(j != -99 && step == (list ? -1 : 1))
return -1;
step = -step;
j= smallest_poc_greater_than_current + (step>>1);
}
sel = sorted_short_ref[j].reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[0][index ]= *h->short_ref[i];
frame_list[0][index++].pic_id= h->short_ref[i]->frame_num;
frame_list[list][index ]= sorted_short_ref[j];
frame_list[list][index++].pic_id= sorted_short_ref[j].frame_num;
}
short_len = index;
for(i = 0; i < 16; i++){
short_len[list] = index;
for(i = 0; i < 16 && index < h->ref_count[ list ]; i++){
int sel;
if(h->long_ref[i] == NULL) continue;
sel = h->long_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[0][index ]= *h->long_ref[i];
frame_list[0][index++].pic_id= i;;
frame_list[ list ][index ]= *h->long_ref[i];
frame_list[ list ][index++].pic_id= i;;
}
len[list] = index;
if(list && (smallest_poc_greater_than_current<=0 || smallest_poc_greater_than_current>=h->short_ref_count) && (1 < index)){
// swap the two first elements of L1 when
// L0 and L1 are identical
Picture temp= frame_list[1][0];
frame_list[1][0] = frame_list[1][1];
frame_list[1][1] = temp;
}
}
for(list=0; list<2; list++){
if (FIELD_PICTURE)
index = split_field_ref_list(h->default_ref_list[0],
h->ref_count[0], frame_list[0],
index, s->picture_structure,
short_len);
len[list] = split_field_ref_list(h->default_ref_list[list],
h->ref_count[list],
frame_list[list],
len[list],
s->picture_structure,
short_len[list]);
if(len[list] < h->ref_count[ list ])
memset(&h->default_ref_list[list][len[list]], 0, sizeof(Picture)*(h->ref_count[ list ] - len[list]));
}
if(index < h->ref_count[0])
memset(&h->default_ref_list[0][index], 0, sizeof(Picture)*(h->ref_count[0] - index));
}else{
int index=0;
int short_len;
for(i=0; i<h->short_ref_count; i++){
int sel;
sel = h->short_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[0][index ]= *h->short_ref[i];
frame_list[0][index++].pic_id= h->short_ref[i]->frame_num;
}
short_len = index;
for(i = 0; i < 16; i++){
int sel;
if(h->long_ref[i] == NULL) continue;
sel = h->long_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[0][index ]= *h->long_ref[i];
frame_list[0][index++].pic_id= i;;
}
if (FIELD_PICTURE)
index = split_field_ref_list(h->default_ref_list[0],
h->ref_count[0], frame_list[0],
index, s->picture_structure,
short_len);
if(index < h->ref_count[0])
memset(&h->default_ref_list[0][index], 0, sizeof(Picture)*(h->ref_count[0] - index));
}
#ifdef TRACE
for (i=0; i<h->ref_count[0]; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment