[FFmpeg-cvslog] r21474 - trunk/libavcodec/h264_loopfilter.c

michael subversion
Wed Jan 27 12:14:29 CET 2010


Author: michael
Date: Wed Jan 27 12:14:29 2010
New Revision: 21474

Log:
Use table to speedup access to non_zero_count in MBAFF with differing interlacing.
~4 cpu cycles speedup

Modified:
   trunk/libavcodec/h264_loopfilter.c

Modified: trunk/libavcodec/h264_loopfilter.c
==============================================================================
--- trunk/libavcodec/h264_loopfilter.c	Wed Jan 27 01:31:52 2010	(r21473)
+++ trunk/libavcodec/h264_loopfilter.c	Wed Jan 27 12:14:29 2010	(r21474)
@@ -632,6 +632,16 @@ void ff_h264_filter_mb( H264Context *h, 
             *(uint64_t*)&bS[0]=
             *(uint64_t*)&bS[4]= 0x0004000400040004ULL;
         else {
+            static const uint8_t offset[2][2][8]={
+                {
+                    {7+8*0, 7+8*0, 7+8*0, 7+8*0, 7+8*1, 7+8*1, 7+8*1, 7+8*1},
+                    {7+8*2, 7+8*2, 7+8*2, 7+8*2, 7+8*3, 7+8*3, 7+8*3, 7+8*3},
+                },{
+                    {7+8*0, 7+8*1, 7+8*2, 7+8*3, 7+8*0, 7+8*1, 7+8*2, 7+8*3},
+                    {7+8*0, 7+8*1, 7+8*2, 7+8*3, 7+8*0, 7+8*1, 7+8*2, 7+8*3},
+                }
+            };
+            const uint8_t *off= offset[MB_FIELD][mb_y&1];
             for( i = 0; i < 8; i++ ) {
                 int j= MB_FIELD ? i>>2 : i&1;
                 int mbn_xy = h->left_mb_xy[j];
@@ -644,7 +654,7 @@ void ff_h264_filter_mb( H264Context *h, 
                          ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ?
                             (h->cbp_table[mbn_xy] & ((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2))
                                                                        :
-                            h->non_zero_count[mbn_xy][7+(MB_FIELD ? (i&3) : (i>>2)+(mb_y&1)*2)*8]));
+                            h->non_zero_count[mbn_xy][ off[i] ]));
                 }
             }
         }



More information about the ffmpeg-cvslog mailing list