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

michael subversion
Thu Feb 25 15:02:39 CET 2010


Author: michael
Date: Thu Feb 25 15:02:39 2010
New Revision: 22052

Log:
Store intra4x4_pred_mode per row only.
about 5 cpu cycles slower in the local code but should be overall faster
due to reduced cache use. (my sample though has too few intra4x4 blocks
for this to be meassureable easily either way)

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

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	Thu Feb 25 13:51:32 2010	(r22051)
+++ trunk/libavcodec/h264.c	Thu Feb 25 15:02:39 2010	(r22052)
@@ -52,15 +52,15 @@ static const uint8_t div6[52]={
 };
 
 void ff_h264_write_back_intra_pred_mode(H264Context *h){
-    const int mb_xy= h->mb_xy;
+    int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy];
 
-    h->intra4x4_pred_mode[mb_xy][0]= h->intra4x4_pred_mode_cache[7+8*1];
-    h->intra4x4_pred_mode[mb_xy][1]= h->intra4x4_pred_mode_cache[7+8*2];
-    h->intra4x4_pred_mode[mb_xy][2]= h->intra4x4_pred_mode_cache[7+8*3];
-    h->intra4x4_pred_mode[mb_xy][3]= h->intra4x4_pred_mode_cache[7+8*4];
-    h->intra4x4_pred_mode[mb_xy][4]= h->intra4x4_pred_mode_cache[4+8*4];
-    h->intra4x4_pred_mode[mb_xy][5]= h->intra4x4_pred_mode_cache[5+8*4];
-    h->intra4x4_pred_mode[mb_xy][6]= h->intra4x4_pred_mode_cache[6+8*4];
+    mode[0]= h->intra4x4_pred_mode_cache[7+8*1];
+    mode[1]= h->intra4x4_pred_mode_cache[7+8*2];
+    mode[2]= h->intra4x4_pred_mode_cache[7+8*3];
+    mode[3]= h->intra4x4_pred_mode_cache[7+8*4];
+    mode[4]= h->intra4x4_pred_mode_cache[4+8*4];
+    mode[5]= h->intra4x4_pred_mode_cache[5+8*4];
+    mode[6]= h->intra4x4_pred_mode_cache[6+8*4];
 }
 
 /**

Modified: trunk/libavcodec/h264.h
==============================================================================
--- trunk/libavcodec/h264.h	Thu Feb 25 13:51:32 2010	(r22051)
+++ trunk/libavcodec/h264.h	Thu Feb 25 15:02:39 2010	(r22052)
@@ -298,7 +298,7 @@ typedef struct H264Context{
     int topleft_partition;
 
     int8_t intra4x4_pred_mode_cache[5*8];
-    int8_t (*intra4x4_pred_mode)[8];
+    int8_t (*intra4x4_pred_mode);
     H264PredContext hpc;
     unsigned int topleft_samples_available;
     unsigned int top_samples_available;
@@ -886,10 +886,11 @@ static void fill_decode_caches(H264Conte
 
             if(IS_INTRA4x4(mb_type)){
                 if(IS_INTRA4x4(top_type)){
-                    h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode[top_xy][4];
-                    h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode[top_xy][5];
-                    h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode[top_xy][6];
-                    h->intra4x4_pred_mode_cache[7+8*0]= h->intra4x4_pred_mode[top_xy][3];
+                    int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[top_xy];
+                    h->intra4x4_pred_mode_cache[4+8*0]= mode[4];
+                    h->intra4x4_pred_mode_cache[5+8*0]= mode[5];
+                    h->intra4x4_pred_mode_cache[6+8*0]= mode[6];
+                    h->intra4x4_pred_mode_cache[7+8*0]= mode[3];
                 }else{
                     int pred;
                     if(!(top_type & type_mask))
@@ -904,8 +905,9 @@ static void fill_decode_caches(H264Conte
                 }
                 for(i=0; i<2; i++){
                     if(IS_INTRA4x4(left_type[i])){
-                        h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]];
-                        h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]];
+                        int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]];
+                        h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[left_block[0+2*i]];
+                        h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[left_block[1+2*i]];
                     }else{
                         int pred;
                         if(!(left_type[i] & type_mask))



More information about the ffmpeg-cvslog mailing list