[FFmpeg-soc] [soc]: r870 - dirac/libavcodec/dirac.c

marco subversion at mplayerhq.hu
Thu Aug 16 16:11:04 CEST 2007


Author: marco
Date: Thu Aug 16 16:11:04 2007
New Revision: 870

Log:
just calculate the block address once

Modified:
   dirac/libavcodec/dirac.c

Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c	(original)
+++ dirac/libavcodec/dirac.c	Thu Aug 16 16:11:04 2007
@@ -1281,12 +1281,13 @@ static int motion_vector_prediction(Dira
     int left = 0, top = 0, lefttop = 0;
     const int refmask = ref + 1;
     const int mask = refmask | DIRAC_REF_MASK_GLOBAL;
+    struct dirac_blockmotion *block = &s->blmotion[y * s->blwidth + x];
 
     if (x > 0) {
         /* Test if the block to the left has a motion vector for this
            reference frame.  */
-        if ((s->blmotion[y * s->blwidth + x - 1].use_ref & mask) == refmask) {
-            left = s->blmotion[y * s->blwidth + x - 1].vect[ref][dir];
+        if ((block[-1].use_ref & mask) == refmask) {
+            left = block[-1].vect[ref][dir];
             cnt++;
         }
 
@@ -1298,8 +1299,8 @@ static int motion_vector_prediction(Dira
     if (y > 0) {
         /* Test if the block above the current one has a motion vector
            for this reference frame.  */
-        if ((s->blmotion[(y - 1) * s->blwidth + x].use_ref & mask) == refmask) {
-            top = s->blmotion[(y - 1) * s->blwidth + x].vect[ref][dir];
+        if ((block[-s->blwidth].use_ref & mask) == refmask) {
+            top = block[-s->blwidth].vect[ref][dir];
             cnt++;
         }
 
@@ -1309,8 +1310,8 @@ static int motion_vector_prediction(Dira
         else if (x > 0) {
             /* Test if the block above the current one has a motion vector
                for this reference frame.  */
-            if ((s->blmotion[(y - 1) * s->blwidth + x - 1].use_ref & mask) == refmask) {
-                lefttop = s->blmotion[(y - 1) * s->blwidth + x - 1].vect[ref][dir];
+            if ((block[-s->blwidth - 1].use_ref & mask) == refmask) {
+                lefttop = block[-s->blwidth - 1].vect[ref][dir];
                 cnt++;
             }
         }



More information about the FFmpeg-soc mailing list