aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-01-23 03:49:36 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-01-23 03:49:36 +0000
commit3b33943e9b3f49da44068f2278b6532efec35114 (patch)
treeb67d1245f6a587101b1c62d2eacc41104d957cab
parent4c12e8bee3a7d70ad3bacec667cea2e572236cac (diff)
downloadffmpeg-3b33943e9b3f49da44068f2278b6532efec35114.tar.gz
simplify
reference list 1 swaping fix? seems its not used by any samples i found though Originally committed as revision 3863 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/h264.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index bbe8a32a55..ec49534152 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2886,32 +2886,17 @@ static int fill_default_ref_list(H264Context *h){
// find the largest poc
for(list=0; list<2; list++){
int index = 0;
- int swap_first_L1 = 0;
+ int j= -99;
+ int step= list ? -1 : 1;
- if (0 == list) {
- for(i=smallest_poc_greater_than_current-1; i>=0 && index < h->ref_count[list]; i--) {
- if(sorted_short_ref[i].reference != 3) continue;
- h->default_ref_list[list][index ]= sorted_short_ref[i];
- h->default_ref_list[list][index++].pic_id= sorted_short_ref[i].frame_num;
- }
- for(i=smallest_poc_greater_than_current; i<h->short_ref_count && index < h->ref_count[list]; i++) {
- if(sorted_short_ref[i].reference != 3) continue;
- h->default_ref_list[list][index ]= sorted_short_ref[i];
- h->default_ref_list[list][index++].pic_id= sorted_short_ref[i].frame_num;
- }
- } else {
- for(i=smallest_poc_greater_than_current; i<h->short_ref_count && index < h->ref_count[list]; i++) {
- if(sorted_short_ref[i].reference != 3) continue;
- swap_first_L1 |= 1;
- h->default_ref_list[list][index ]= sorted_short_ref[i];
- h->default_ref_list[list][index++].pic_id= sorted_short_ref[i].frame_num;
- }
- for(i=smallest_poc_greater_than_current-1; i>=0 && index < h->ref_count[list]; i--) {
- if(sorted_short_ref[i].reference != 3) continue;
- swap_first_L1 |= 2;
- h->default_ref_list[list][index ]= sorted_short_ref[i];
- h->default_ref_list[list][index++].pic_id= sorted_short_ref[i].frame_num;
+ for(i=0; i<h->short_ref_count && index < h->ref_count[list]; i++, j+=step) {
+ while(j<0 || j>= h->short_ref_count){
+ step = -step;
+ j= smallest_poc_greater_than_current + (step>>1);
}
+ if(sorted_short_ref[j].reference != 3) continue;
+ h->default_ref_list[list][index ]= sorted_short_ref[j];
+ h->default_ref_list[list][index++].pic_id= sorted_short_ref[j].frame_num;
}
for(i = 0; i < 16 && index < h->ref_count[ list ]; i++){
@@ -2922,7 +2907,7 @@ static int fill_default_ref_list(H264Context *h){
h->default_ref_list[ list ][index++].pic_id= i;;
}
- if(list && (3 == swap_first_L1) && (1 < 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= h->default_ref_list[1][0];