[FFmpeg-cvslog] h264: increase dist_scale_factor for up to 32 references

Janne Grunau git at videolan.org
Wed Dec 19 14:44:50 CET 2012


ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Mon Dec 17 21:36:05 2012 +0100| [73ad2c2fa725be51215e1c021c5335f8ce65af79] | committer: Janne Grunau

h264: increase dist_scale_factor for up to 32 references

Compute dist_scale_factor_field only for MBAFF since that is the only
case in which it is used.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73ad2c2fa725be51215e1c021c5335f8ce65af79
---

 libavcodec/h264.h        |    2 +-
 libavcodec/h264_direct.c |   17 ++++++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 3049470..6691be4 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -364,7 +364,7 @@ typedef struct H264Context {
     int direct_spatial_mv_pred;
     int col_parity;
     int col_fieldoff;
-    int dist_scale_factor[16];
+    int dist_scale_factor[32];
     int dist_scale_factor_field[2][32];
     int map_col_to_list0[2][16 + 32];
     int map_col_to_list0_field[2][2][16 + 32];
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
index fc429ae..a33efa5 100644
--- a/libavcodec/h264_direct.c
+++ b/libavcodec/h264_direct.c
@@ -54,14 +54,17 @@ void ff_h264_direct_dist_scale_factor(H264Context * const h){
     const int poc = h->s.current_picture_ptr->field_poc[ s->picture_structure == PICT_BOTTOM_FIELD ];
     const int poc1 = h->ref_list[1][0].poc;
     int i, field;
-    for(field=0; field<2; field++){
-        const int poc  = h->s.current_picture_ptr->field_poc[field];
-        const int poc1 = h->ref_list[1][0].field_poc[field];
-        for(i=0; i < 2*h->ref_count[0]; i++)
-            h->dist_scale_factor_field[field][i^field] = get_scale_factor(h, poc, poc1, i+16);
-    }
 
-    for(i=0; i<h->ref_count[0]; i++){
+    if (FRAME_MBAFF)
+        for (field = 0; field < 2; field++){
+            const int poc  = h->s.current_picture_ptr->field_poc[field];
+            const int poc1 = h->ref_list[1][0].field_poc[field];
+            for (i = 0; i < 2 * h->ref_count[0]; i++)
+                h->dist_scale_factor_field[field][i^field] =
+                    get_scale_factor(h, poc, poc1, i+16);
+        }
+
+    for (i = 0; i < h->ref_count[0]; i++){
         h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i);
     }
 }



More information about the ffmpeg-cvslog mailing list