[FFmpeg-cvslog] r16248 - in trunk/libavcodec: h264.c h264.h

michael subversion
Sun Dec 21 00:11:31 CET 2008


Author: michael
Date: Sun Dec 21 00:11:30 2008
New Revision: 16248

Log:
Optimize get_dct8x8_allowed().
30 cpu cycles faster in pentium dual.


Modified:
   trunk/libavcodec/h264.c
   trunk/libavcodec/h264.h

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	(original)
+++ trunk/libavcodec/h264.c	Sun Dec 21 00:11:30 2008
@@ -4039,13 +4039,10 @@ static inline int get_level_prefix(GetBi
 }
 
 static inline int get_dct8x8_allowed(H264Context *h){
-    int i;
-    for(i=0; i<4; i++){
-        if(!IS_SUB_8X8(h->sub_mb_type[i])
-           || (!h->sps.direct_8x8_inference_flag && IS_DIRECT(h->sub_mb_type[i])))
-            return 0;
-    }
-    return 1;
+    if(h->sps.direct_8x8_inference_flag)
+        return !(*(uint64_t*)h->sub_mb_type & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8                )*0x0001000100010001ULL));
+    else
+        return !(*(uint64_t*)h->sub_mb_type & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL));
 }
 
 /**

Modified: trunk/libavcodec/h264.h
==============================================================================
--- trunk/libavcodec/h264.h	(original)
+++ trunk/libavcodec/h264.h	Sun Dec 21 00:11:30 2008
@@ -339,7 +339,7 @@ typedef struct H264Context{
     int mb_field_decoding_flag;
     int mb_mbaff;              ///< mb_aff_frame && mb_field_decoding_flag
 
-    unsigned int sub_mb_type[4];
+    uint16_t sub_mb_type[4];
 
     //POC stuff
     int poc_lsb;




More information about the ffmpeg-cvslog mailing list