[SCM] libav/experimental: Reindent fill_default_ref_list after changes for PAFF

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:07:54 UTC 2013


The following commit has been merged in the experimental branch:
commit 086acdd54b6669680e936d029421aff93eb7a2bf
Author: Jeff Downs <heydowns at borg.com>
Date:   Fri Oct 5 13:47:46 2007 +0000

    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

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index b54cd23..4062ef2 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -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++) {

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list