changeset 5779:ad3168a70fbe libavcodec

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
author andoma
date Fri, 05 Oct 2007 13:47:46 +0000
parents c4984d69d373
children bd3d1e4f937a
files h264.c
diffstat 1 files changed, 79 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Fri Oct 05 13:41:27 2007 +0000
+++ b/h264.c	Fri Oct 05 13:47:46 2007 +0000
@@ -2916,92 +2916,92 @@
             }
         }
 
-            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;;
+        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);
                 }
-                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]));
-            }
-
-
-        }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;
+                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;
-            }
-            short_len = index;
-            for(i = 0; i < 16; i++){
+                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[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);
-
-            if(index < h->ref_count[0])
-                memset(&h->default_ref_list[0][index], 0, sizeof(Picture)*(h->ref_count[0] - index));
+                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]));
+        }
+
+
+    }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++) {